2022-06-15 11:52:36 +00:00
|
|
|
|
from telegram import Update
|
2022-07-07 01:36:34 +00:00
|
|
|
|
from telegram.ext import CommandHandler
|
2022-06-15 11:52:36 +00:00
|
|
|
|
|
2022-06-26 06:17:43 +00:00
|
|
|
|
from manager import listener_plugins_class
|
2022-06-15 11:52:36 +00:00
|
|
|
|
from plugins.admin import bot_admins_only
|
|
|
|
|
from plugins.base import BasePlugins
|
2022-07-07 01:36:34 +00:00
|
|
|
|
from utils.base import PaimonContext
|
2022-06-15 11:52:36 +00:00
|
|
|
|
|
|
|
|
|
|
2022-06-26 06:17:43 +00:00
|
|
|
|
@listener_plugins_class()
|
2022-06-15 11:52:36 +00:00
|
|
|
|
class Wiki(BasePlugins):
|
|
|
|
|
"""
|
|
|
|
|
有关WIKI
|
|
|
|
|
"""
|
2022-06-26 06:17:43 +00:00
|
|
|
|
|
2022-07-07 01:36:34 +00:00
|
|
|
|
@classmethod
|
|
|
|
|
def create_handlers(cls) -> list:
|
|
|
|
|
wiki = cls()
|
2022-06-26 06:17:43 +00:00
|
|
|
|
return [
|
|
|
|
|
CommandHandler("refresh_wiki", wiki.refresh_wiki, block=False),
|
|
|
|
|
]
|
|
|
|
|
|
2022-06-15 11:52:36 +00:00
|
|
|
|
@bot_admins_only
|
2022-07-07 01:36:34 +00:00
|
|
|
|
async def refresh_wiki(self, update: Update, context: PaimonContext):
|
2022-06-15 11:52:36 +00:00
|
|
|
|
message = update.message
|
2022-07-07 01:36:34 +00:00
|
|
|
|
service = context.service
|
2022-06-15 11:52:36 +00:00
|
|
|
|
await message.reply_text("正在刷新Wiki缓存,请稍等")
|
2022-07-07 01:36:34 +00:00
|
|
|
|
await service.wiki.refresh_wiki()
|
2022-06-15 11:52:36 +00:00
|
|
|
|
await message.reply_text("刷新Wiki缓存成功")
|