Skip to content
This repository was archived by the owner on May 23, 2025. It is now read-only.

Commit 7270e05

Browse files
Merge pull request #62 from wspzf/patch-1
fix: 解决启动报错NoneType
2 parents 3a3d10b + 8797956 commit 7270e05

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,17 @@ async def run_bot():
162162
bot.wxid = wxid
163163
profile = await bot.get_profile()
164164

165-
bot.nickname = profile.get("NickName").get("string")
166-
bot.alias = profile.get("Alias")
167-
bot.phone = profile.get("BindMobile").get("string")
165+
bot.nickname = profile.get("NickName", {}).get("string", "")
166+
bot.alias = profile.get("Alias", "")
167+
bot.phone = profile.get("BindMobile", {}).get("string", "")
168168

169169
logger.info("登录账号信息: wxid: {} 昵称: {} 微信号: {} 手机号: {}", bot.wxid, bot.nickname, bot.alias,
170170
bot.phone)
171171

172-
bot_bridge.save_profile(avatar_url=profile.get("userInfoExt").get("BigHeadImgUrl"),
173-
nickname=profile.get("NickName").get("string"),
172+
bot_bridge.save_profile(avatar_url=profile.get("userInfoExt", {}).get("BigHeadImgUrl", ""),
173+
nickname=profile.get("NickName", {}).get("string", ""),
174174
wxid=wxid,
175-
alias=profile.get("Alias"))
175+
alias=profile.get("Alias", ""))
176176

177177
logger.info("登录设备信息: device_name: {} device_id: {}", device_name, device_id)
178178

0 commit comments

Comments
 (0)