2022-07-26 15:54:48 +00:00
|
|
|
|
from telegram import Update
|
|
|
|
|
from telegram.ext import CommandHandler, CallbackContext
|
|
|
|
|
|
2022-09-08 01:08:37 +00:00
|
|
|
|
from core.plugin import Plugin, handler
|
2022-08-06 12:37:41 +00:00
|
|
|
|
from core.wiki.services import WikiService
|
2022-07-26 15:54:48 +00:00
|
|
|
|
from utils.decorators.admins import bot_admins_rights_check
|
|
|
|
|
|
|
|
|
|
|
2022-09-08 01:08:37 +00:00
|
|
|
|
class Wiki(Plugin):
|
2022-07-31 04:51:22 +00:00
|
|
|
|
"""有关WIKI操作"""
|
|
|
|
|
|
2022-09-02 08:27:54 +00:00
|
|
|
|
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
|
|
|
|
|
2022-09-08 01:08:37 +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):
|
2022-09-08 01:08:37 +00:00
|
|
|
|
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缓存成功")
|