Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

12345678910111213141516171819202122232425262728293031323334
  1. # encoding:utf-8
  2. from bridge.context import ContextType
  3. from bridge.reply import Reply, ReplyType
  4. from config import conf
  5. import plugins
  6. from plugins import *
  7. from common.log import logger
  8. @plugins.register(name="Finish", desire_priority=-999, hidden=True, desc="A plugin that check unknown command", version="1.0", author="js00000")
  9. class Finish(Plugin):
  10. def __init__(self):
  11. super().__init__()
  12. self.handlers[Event.ON_HANDLE_CONTEXT] = self.on_handle_context
  13. logger.info("[Finish] inited")
  14. def on_handle_context(self, e_context: EventContext):
  15. if e_context['context'].type != ContextType.TEXT:
  16. return
  17. content = e_context['context'].content
  18. logger.debug("[Finish] on_handle_context. content: %s" % content)
  19. trigger_prefix = conf().get('plugin_trigger_prefix',"$")
  20. if content.startswith(trigger_prefix):
  21. reply = Reply()
  22. reply.type = ReplyType.ERROR
  23. reply.content = "未知插件命令\n查看插件命令列表请输入#help 插件名\n"
  24. e_context['reply'] = reply
  25. e_context.action = EventAction.BREAK_PASS # 事件结束,并跳过处理context的默认逻辑
  26. def get_help_text(self, **kwargs):
  27. return ""