zhenxun_bot/basic_plugins/admin_help/__init__.py

28 lines
877 B
Python
Raw Normal View History

2021-11-23 21:44:59 +08:00
from nonebot import on_command
from nonebot.typing import T_State
from nonebot.adapters import Bot
2022-02-19 18:20:19 +08:00
from nonebot.adapters.onebot.v11 import GroupMessageEvent
2021-11-23 21:44:59 +08:00
from utils.message_builder import image
from .data_source import create_help_image, ADMIN_HELP_IMAGE
2021-11-23 21:44:59 +08:00
__zx_plugin_name__ = '管理帮助 [Admin]'
__plugin_usage__ = '管理员帮助,在群内回复“管理员帮助”'
__plugin_version__ = 0.1
__plugin_author__ = 'HibiKier'
__plugin_settings__ = {
"admin_level": 1,
}
admin_help = on_command("管理员帮助", aliases={"管理帮助"}, priority=5, block=True)
if ADMIN_HELP_IMAGE.exists():
ADMIN_HELP_IMAGE.unlink()
2021-11-23 21:44:59 +08:00
@admin_help.handle()
async def _(bot: Bot, event: GroupMessageEvent, state: T_State):
if not ADMIN_HELP_IMAGE.exists():
2021-11-23 21:44:59 +08:00
await create_help_image()
await admin_help.send(image(ADMIN_HELP_IMAGE))