Skip to content

Commit

Permalink
CQ bot client json data reading fail-proof
Browse files Browse the repository at this point in the history
fixed #35
  • Loading branch information
Fallen-Breath committed Feb 27, 2023
1 parent 9c3c4a3 commit 4f4915b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chatbridge/impl/cqhttp/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def on_message(self, _, message: str):
if chatClient is None:
return
data = json.loads(message)
if data['post_type'] == 'message' and data['message_type'] == 'group':
if data.get('post_type') == 'message' and data.get('message_type') == 'group':
if data['anonymous'] is None and data['group_id'] == self.config.react_group_id:
self.logger.info('QQ chat message: {}'.format(data))
args = data['raw_message'].split(' ')
Expand Down

0 comments on commit 4f4915b

Please sign in to comment.