You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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