PaiGram/plugins/wiki.py
2022-06-26 14:17:43 +08:00

29 lines
832 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from telegram import Update
from telegram.ext import CallbackContext, CommandHandler
from manager import listener_plugins_class
from plugins.admin import bot_admins_only
from plugins.base import BasePlugins
from service import BaseService
@listener_plugins_class()
class Wiki(BasePlugins):
"""
有关WIKI
"""
@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缓存成功")