youfou / wxpy

微信机器人 / 可能是最优雅的微信个人号 API ✨✨
http://wxpy.readthedocs.io
MIT License
13.99k stars 2.38k forks source link

如何获取登录的用户头像 #108

Open davieds opened 7 years ago

davieds commented 7 years ago

使用获取头像的方法 bot.self.get_avatar('./%s'%bot.self.name) 提示 :TypeError: expected Friend, Group or Member, got<class 'wxpy.api.chats.user.User'> 这是只能获取 Friend Group Member 类型的吗?

honwenle commented 7 years ago

yes , only Friend Group Member , but you can use is_friend return a Friend object , then you can use get_avatar

bot.self.is_friend.get_avatar('myself_avatar.png')