fix: wecombot id (#1747)

This commit is contained in:
Guanchao Wang
2025-11-05 12:14:01 +08:00
committed by GitHub
parent 94aa175c1a
commit 973e7bae42
3 changed files with 29 additions and 5 deletions
+15 -1
View File
@@ -22,7 +22,21 @@ class WecomBotEvent(dict):
"""
用户id
"""
return self.get('from', {}).get('userid', '')
return self.get('from', {}).get('userid', '') or self.get('userid', '')
@property
def username(self) -> str:
"""
用户名称
"""
return self.get('username', '') or self.get('from', {}).get('alias', '') or self.get('from', {}).get('name', '') or self.userid
@property
def chatname(self) -> str:
"""
群组名称
"""
return self.get('chatname', '') or str(self.chatid)
@property
def content(self) -> str: