From fc7cd0a14d5e1689614f0c2b20ea634257e3356c Mon Sep 17 00:00:00 2001 From: willkyu <87601487+willkyu@users.noreply.github.com> Date: Mon, 11 Mar 2024 10:52:53 +0800 Subject: [PATCH 1/2] Update onebotSDK.py --- OlivOS/adapter/onebotV11/onebotSDK.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index f5ede9df..628d566f 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -61,7 +61,8 @@ def send_onebot_post_json(self): return None else: try: - json_str_tmp = json.dumps(obj=self.obj.__dict__, ensure_ascii=False) + clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + json_str_tmp = json.dumps(obj=clear_dict, ensure_ascii=False) tmp_host = self.bot_info.host if tmp_host.startswith('http://') or tmp_host.startswith('https://'): pass From d4105862a877e92a7e4dad18e879ac37a91f1f16 Mon Sep 17 00:00:00 2001 From: willkyu <87601487+willkyu@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:04:09 +0800 Subject: [PATCH 2/2] Update onebotSDK.py --- OlivOS/adapter/onebotV11/onebotSDK.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OlivOS/adapter/onebotV11/onebotSDK.py b/OlivOS/adapter/onebotV11/onebotSDK.py index 628d566f..17dc03c9 100644 --- a/OlivOS/adapter/onebotV11/onebotSDK.py +++ b/OlivOS/adapter/onebotV11/onebotSDK.py @@ -61,7 +61,10 @@ def send_onebot_post_json(self): return None else: try: - clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + # clear_dict = {k: v for k, v in self.obj.__dict__.items() if v != -1} + clear_dict = self.obj.__dict__ + if clear_dict['message_type']=='private': + clear_dict.pop('group_id','No "group_id"') json_str_tmp = json.dumps(obj=clear_dict, ensure_ascii=False) tmp_host = self.bot_info.host if tmp_host.startswith('http://') or tmp_host.startswith('https://'):