diff options
author | Kyomotoi <[email protected]> | 2021-04-24 16:20:19 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2021-04-24 16:20:19 +0800 |
commit | e01b1ed882a01d03b763e9b06b8b5d0608fc5f21 (patch) | |
tree | a2226a4c1c505f66d5226a1ddae02038ad92a046 /ATRI/plugins/manage/modules/shutdown.py | |
parent | 0678347859176671d5ff11852f339336a595e2f5 (diff) | |
download | ATRI-e01b1ed882a01d03b763e9b06b8b5d0608fc5f21.tar.gz ATRI-e01b1ed882a01d03b763e9b06b8b5d0608fc5f21.tar.bz2 ATRI-e01b1ed882a01d03b763e9b06b8b5d0608fc5f21.zip |
✨🔥🎨🐛♻️📝 更新
新增:开发工具中ub paste,再也不怕长消息了。
新增:错误处理两项`ReadFileError`、`FormatError`
修复:bot退群显示被自己踢出群
删除:Service部分内容
删除:hitokoto本地库,改用请求
优化:b站小程序抓取
重构:bot管理部分,对命令进行简化
Diffstat (limited to 'ATRI/plugins/manage/modules/shutdown.py')
-rw-r--r-- | ATRI/plugins/manage/modules/shutdown.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ATRI/plugins/manage/modules/shutdown.py b/ATRI/plugins/manage/modules/shutdown.py new file mode 100644 index 0000000..11b2b1b --- /dev/null +++ b/ATRI/plugins/manage/modules/shutdown.py @@ -0,0 +1,34 @@ +from nonebot.typing import T_State +from nonebot.permission import SUPERUSER +from nonebot.adapters.cqhttp import Bot, MessageEvent + +from ATRI.service import Service as sv + + +__doc__ = """ +紧急停机 +权限组:维护者 +用法: + @ 关机 +""" + +shutdown = sv.on_command( + cmd="关机", + docs=__doc__, + permission=SUPERUSER +) + +async def _shutdown(bot: Bot, event: MessageEvent, state: T_State) -> None: + msg = str(event.message).strip() + if msg: + state["msg"] = msg + [email protected]("msg", prompt="[WARNING]此项操作将强行终止bot运行,是否继续(y/n)") +async def __shutdown(bot: Bot, event: MessageEvent, state: T_State) -> None: + t = ['y', 'Y', '是'] + if state["msg"] in t: + await bot.send(event, "咱还会醒来的,一定") + exit(0) + else: + await shutdown.finish("再考虑下吧 ;w;") |