加入了头像信息
This commit is contained in:
17
robot.py
17
robot.py
@@ -163,7 +163,6 @@ class Robot:
|
||||
else: # 已登录
|
||||
self.ipad_bot.wxid = wxid
|
||||
profile = await self.ipad_bot.get_profile()
|
||||
|
||||
self.ipad_bot.nickname = profile.get("NickName").get("string")
|
||||
self.ipad_bot.alias = profile.get("Alias")
|
||||
self.ipad_bot.phone = profile.get("BindMobile").get("string")
|
||||
@@ -189,6 +188,11 @@ class Robot:
|
||||
|
||||
self.message_storage = MessageStorage(self.ipad_bot)
|
||||
|
||||
# 获取扩展信息,显示相关内容
|
||||
ext_profile = await self.ipad_bot.get_profile_info_ext()
|
||||
self.ipad_bot.profile_ext = ext_profile
|
||||
self.ipad_bot.head_image = ext_profile.get("SmallHeadImgUrl").get("string")
|
||||
|
||||
# 先接受堆积消息
|
||||
self.LOG.info("处理堆积消息中")
|
||||
|
||||
@@ -222,7 +226,8 @@ class Robot:
|
||||
self.LOG.error(f"获取新消息失败 {e}")
|
||||
if "用户可能退出" in str(e):
|
||||
self.LOG.error(f"用户可能退出: {e}")
|
||||
self.email_sender.send_wechat_alert(self.config.email.get("alert_recipient"), f"用户可能退出: {e}", self.wxid,
|
||||
self.email_sender.send_wechat_alert(self.config.email.get("alert_recipient"),
|
||||
f"用户可能退出: {e}", self.wxid,
|
||||
self.nickname)
|
||||
await self.login_twice_auto_auth()
|
||||
await asyncio.sleep(5)
|
||||
@@ -324,7 +329,8 @@ class Robot:
|
||||
self.LOG.error(f"wechat_ipad heartbeat: {e}")
|
||||
if "用户可能退出" in str(e):
|
||||
self.LOG.error(f"用户可能退出: {e}")
|
||||
self.email_sender.send_wechat_alert(self.config.email.get("alert_recipient"), f"用户可能退出: {e}", self.wxid,
|
||||
self.email_sender.send_wechat_alert(self.config.email.get("alert_recipient"), f"用户可能退出: {e}",
|
||||
self.wxid,
|
||||
self.nickname)
|
||||
await self.login_twice_auto_auth()
|
||||
await asyncio.sleep(60)
|
||||
@@ -343,7 +349,8 @@ class Robot:
|
||||
self.LOG.error(f"wechat_ipad heartbeat long: {e}")
|
||||
if "用户可能退出" in str(e):
|
||||
self.LOG.error(f"用户可能退出: {e}")
|
||||
self.email_sender.send_wechat_alert(self.config.email.get("alert_recipient"), f"用户可能退出: {e}", self.wxid,
|
||||
self.email_sender.send_wechat_alert(self.config.email.get("alert_recipient"), f"用户可能退出: {e}",
|
||||
self.wxid,
|
||||
self.nickname)
|
||||
await self.login_twice_auto_auth()
|
||||
await asyncio.sleep(120)
|
||||
@@ -351,7 +358,7 @@ class Robot:
|
||||
async def _process_ipad_message(self, message: WxMessage):
|
||||
"""处理wechat_ipad消息"""
|
||||
try:
|
||||
self.LOG.debug(f"message: {message}")
|
||||
# self.LOG.debug(f"message: {message}")
|
||||
# 消息已经是WxMessage对象,直接使用其属性和方法
|
||||
from_user = message.sender
|
||||
to_user = message.to_user
|
||||
|
||||
Reference in New Issue
Block a user