From bd11e7d83183d11a515dd3b2e52b56d881ec76f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Tue, 14 Mar 2023 14:09:18 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20`WikiPlugin`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/admin/wiki.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/admin/wiki.py diff --git a/plugins/admin/wiki.py b/plugins/admin/wiki.py new file mode 100644 index 0000000..2480ad4 --- /dev/null +++ b/plugins/admin/wiki.py @@ -0,0 +1,19 @@ +from telegram import Update +from telegram.ext import CallbackContext + +from core.plugin import Plugin, handler +from core.services.wiki.services import WikiService + + +class WikiPlugin(Plugin): + """有关WIKI操作""" + + def __init__(self, wiki_service: WikiService): + self.wiki_service = wiki_service + + @handler.command("refresh_wiki", block=False, admin=True) + async def refresh_wiki(self, update: Update, _: CallbackContext): + message = update.effective_message + await message.reply_text("正在刷新Wiki缓存,请稍等") + await self.wiki_service.refresh_wiki() + await message.reply_text("刷新Wiki缓存成功")