PaiGram/plugins/wiki.py

29 lines
832 B
Python
Raw Normal View History

from telegram import Update
2022-06-26 06:17:43 +00:00
from telegram.ext import CallbackContext, CommandHandler
2022-06-26 06:17:43 +00:00
from manager import listener_plugins_class
from plugins.admin import bot_admins_only
from plugins.base import BasePlugins
2022-06-26 06:17:43 +00:00
from service import BaseService
2022-06-26 06:17:43 +00:00
@listener_plugins_class()
class Wiki(BasePlugins):
"""
有关WIKI
"""
2022-06-26 06:17:43 +00:00
@staticmethod
def create_handlers(service: BaseService) -> list:
wiki = Wiki(service)
return [
CommandHandler("refresh_wiki", wiki.refresh_wiki, block=False),
]
@bot_admins_only
async def refresh_wiki(self, update: Update, _: CallbackContext):
message = update.message
await message.reply_text("正在刷新Wiki缓存请稍等")
await self.service.wiki.refresh_wiki()
await message.reply_text("刷新Wiki缓存成功")