PaiGram/plugins/genshin/wiki.py

22 lines
764 B
Python
Raw Normal View History

2022-07-26 15:54:48 +00:00
from telegram import Update
from telegram.ext import CommandHandler, CallbackContext
from core.plugin import Plugin, handler
from core.wiki.services import WikiService
2022-07-26 15:54:48 +00:00
from utils.decorators.admins import bot_admins_rights_check
class Wiki(Plugin):
2022-07-31 04:51:22 +00:00
"""有关WIKI操作"""
def __init__(self, wiki_service: WikiService = None):
2022-07-31 04:51:22 +00:00
self.wiki_service = wiki_service
2022-07-26 15:54:48 +00:00
@handler(CommandHandler, command="refresh_wiki", block=False)
2022-07-26 15:54:48 +00:00
@bot_admins_rights_check
2022-07-31 04:51:22 +00:00
async def refresh_wiki(self, update: Update, _: CallbackContext):
message = update.effective_message
2022-07-26 15:54:48 +00:00
await message.reply_text("正在刷新Wiki缓存请稍等")
2022-07-31 04:51:22 +00:00
await self.wiki_service.refresh_wiki()
2022-07-26 15:54:48 +00:00
await message.reply_text("刷新Wiki缓存成功")