♻️ Refactor WikiPlugin

This commit is contained in:
洛水居室 2023-03-14 14:09:18 +08:00
parent 7b62d86f46
commit bd11e7d831
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

19
plugins/admin/wiki.py Normal file
View File

@ -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缓存成功")