Update aiocqhttp.py

针对报错对"role"做存在性检查
This commit is contained in:
Tigrex Dai 2024-09-22 15:39:48 +08:00 committed by GitHub
parent ee0d6dcdae
commit ce56f79687
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,10 +173,11 @@ class AiocqhttpEventConverter(adapter.EventConverter):
if event.message_type == "group": if event.message_type == "group":
permission = "MEMBER" permission = "MEMBER"
if event.sender["role"] == "admin": if "role" in event.sender:
permission = "ADMINISTRATOR" if event.sender["role"] == "admin":
elif event.sender["role"] == "owner": permission = "ADMINISTRATOR"
permission = "OWNER" elif event.sender["role"] == "owner":
permission = "OWNER"
converted_event = mirai.GroupMessage( converted_event = mirai.GroupMessage(
sender=mirai.models.entities.GroupMember( sender=mirai.models.entities.GroupMember(
id=event.sender["user_id"], # message_seq 放哪? id=event.sender["user_id"], # message_seq 放哪?