فهرست منبع

fix: add check for empty command and return error message if so

lanvent 3 سال پیش
والد
کامیت
0f8dc91a8b
1فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  1. 7 0
      plugins/godcmd/godcmd.py

+ 7 - 0
plugins/godcmd/godcmd.py

@@ -209,6 +209,13 @@ class Godcmd(Plugin):
         content = e_context["context"].content
         content = e_context["context"].content
         logger.debug("[Godcmd] on_handle_context. content: %s" % content)
         logger.debug("[Godcmd] on_handle_context. content: %s" % content)
         if content.startswith("#"):
         if content.startswith("#"):
+            if len(content) == 1:
+                reply = Reply()
+                reply.type = ReplyType.ERROR
+                reply.content = f"空指令,输入#help查看指令列表\n"
+                e_context["reply"] = reply
+                e_context.action = EventAction.BREAK_PASS
+                return 
             # msg = e_context['context']['msg']
             # msg = e_context['context']['msg']
             channel = e_context["channel"]
             channel = e_context["channel"]
             user = e_context["context"]["receiver"]
             user = e_context["context"]["receiver"]