From 3bd40e727127e04646b1626f3bf700fa2ff6a9fc Mon Sep 17 00:00:00 2001 From: snowy Date: Thu, 8 Aug 2024 18:10:18 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=E7=94=9F=E5=91=BD?= =?UTF-8?q?=E5=91=A8=E6=9C=9F=E9=92=A9=E5=AD=90=E5=87=BD=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/plugins/lifespan_monitor.py | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 liteyuki/plugins/lifespan_monitor.py diff --git a/liteyuki/plugins/lifespan_monitor.py b/liteyuki/plugins/lifespan_monitor.py new file mode 100644 index 00000000..c17fd7d3 --- /dev/null +++ b/liteyuki/plugins/lifespan_monitor.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved +# +# @Time : 2024/7/22 上午11:25 +# @Author : snowykami +# @Email : snowykami@outlook.com +# @File : asa.py +# @Software: PyCharm +from liteyuki.plugin import PluginMetadata +from liteyuki import get_bot, logger + +__plugin_meta__ = PluginMetadata( + name="lifespan_monitor", +) + +bot = get_bot() + + +@bot.on_before_start +def _(): + logger.info("生命周期监控器:准备启动") + + +@bot.on_before_shutdown +def _(): + logger.info("生命周期监控器:准备停止") + + +@bot.on_before_restart +def _(): + logger.info("生命周期监控器:准备重启") + + +@bot.on_after_start +def _(): + logger.info("生命周期监控器:启动完成")