From 9cf048fce4dda2e7979c1faef42e5b087ff23c60 Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Fri, 10 May 2024 12:10:45 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=A8=A1=E6=9D=BF=20=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_tetris_stats/utils/templates.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nonebot_plugin_tetris_stats/utils/templates.py b/nonebot_plugin_tetris_stats/utils/templates.py index 833ab2b..1873802 100644 --- a/nonebot_plugin_tetris_stats/utils/templates.py +++ b/nonebot_plugin_tetris_stats/utils/templates.py @@ -3,12 +3,16 @@ from shutil import rmtree from nonebot import get_driver from nonebot.log import logger +from nonebot.permission import SUPERUSER +from nonebot_plugin_alconna import on_alconna from nonebot_plugin_localstore import get_data_dir # type: ignore[import-untyped] driver = get_driver() templates_dir = get_data_dir('nonebot_plugin_tetris_stats') / 'templates' +alc = on_alconna('更新模板', permission=SUPERUSER) + @driver.on_startup async def init_templates() -> None: @@ -58,3 +62,9 @@ async def init_templates() -> None: logger.error(i) raise RuntimeError('更新模板仓库失败') logger.success('模板仓库更新成功') + + +@alc.handle() +async def _(): + await init_templates() + await alc.finish('模板仓库更新成功')