From 0f8dc91a8bcf97d33c4135ddea5bbad1768fbef5 Mon Sep 17 00:00:00 2001 From: lanvent Date: Thu, 20 Apr 2023 23:13:07 +0800 Subject: [PATCH] fix: add check for empty command and return error message if so --- plugins/godcmd/godcmd.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/godcmd/godcmd.py b/plugins/godcmd/godcmd.py index 4e1b059..1b89df1 100644 --- a/plugins/godcmd/godcmd.py +++ b/plugins/godcmd/godcmd.py @@ -209,6 +209,13 @@ class Godcmd(Plugin): content = e_context["context"].content logger.debug("[Godcmd] on_handle_context. content: %s" % content) 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'] channel = e_context["channel"] user = e_context["context"]["receiver"]