You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
这是我的源代码:
async def on_friendship(self, friendship: Friendship) -> None:
"""when receive a new friendship application, or accept a new friendship
Args:
friendship (Friendship): contains the status and friendship info,
eg: hello text, friend contact object
"""
MAX_ROOM_MEMBER_COUNT = 500
# 1. receive a new friendship from someone
if friendship.type() == FriendshipType.FRIENDSHIP_TYPE_RECEIVE:
hello_text: str = friendship.hello()
# friend: Contact = friendship.contact()
# await friend.ready()
# fri_name = friend.name
# accept friendship when there is a keyword in hello text
# if 'wechaty' in hello_text.lower():
await friendship.accept()
# 2. you have a new friend to your contact list
elif friendship.type() == FriendshipType.FRIENDSHIP_TYPE_CONFIRM:
# 2.1 invite the user to wechaty group
# find the topic of room which contains Wechaty keyword
friend: Contact = friendship.contact()
await friend.ready()
fri_wxid = friend.weixin() #get wxid
fri_contact_id = friend.contact_id
print(fri_wxid)
这是报错:
2022-06-21 19:33:56,246 - Wechaty - INFO - receive event <EventFriendshipPayload(friendship_id='5913457775617322356')>
2022-06-21 19:33:56,246 - FriendShip - INFO - Friendship constructor 5913457775617322356
2022-06-21 19:33:56,246 - FriendShip - INFO - ready() sync the friendship payload
2022-06-21 19:33:56,297 - FriendShip - INFO - get hello message <申请> of friendship <<wechaty_grpc.wechaty.puppet.FriendshipPayloadResponse object at 0x7fc8528f7460>>
2022-06-21 19:33:56,297 - FriendShip - INFO - get hello message <申请> of friendship <<wechaty_grpc.wechaty.puppet.FriendshipPayloadResponse object at 0x7fc8528f7460>>
2022-06-21 19:33:56,297 - FriendShip - INFO - accept friendship, friendship_id: <5913457775617322356>
2022-06-21 19:33:56,297 - FriendShip - INFO - friendship accept to wxid_20qh1k68nuon
2022-06-21 19:33:57,344 - Wechaty - INFO - receive event <EventFriendshipPayload(friendship_id='4943574653437041188')>
2022-06-21 19:33:57,345 - FriendShip - INFO - Friendship constructor 4943574653437041188
2022-06-21 19:33:57,345 - FriendShip - INFO - ready() sync the friendship payload
2022-06-21 19:33:57,394 - FriendShip - INFO - get hello message <> of friendship <<wechaty_grpc.wechaty.puppet.FriendshipPayloadResponse object at 0x7fc8528f7880>>
2022-06-21 19:33:57,441 - Contact - INFO - load contact <Contact <wxid_20qh1k68nuon> >
2022-06-21 19:33:59,702 - Wechaty - ERROR - internal error <'userStatus'>
2022-06-21 19:33:59,751 - Wechaty - INFO - receive message <Message#message_type_text[🗣 Contact <wxid_20qh1k68nuon22> 申请>
already get wechat id:
already get contact_id id:wxid_20qh1k68nuon
2022-06-21 19:33:59,751 - Wechaty - INFO - receive message <Message#message_type_unspecified[🗣 Contact <wxid_20qh1k68nuon> >
already get wechat id:
already get contact_id id:wxid_20qh1k68nuon
同样的代码几个月前能够在被加好友时,在申请通过后获取该好友的微信号,现在经常出现userstate异常获取不到。偶尔可以获取到,不知道是否为版本原因。
这是我的源代码:
async def on_friendship(self, friendship: Friendship) -> None:
"""when receive a new friendship application, or accept a new friendship
Args:
friendship (Friendship): contains the status and friendship info,
eg: hello text, friend contact object
"""
MAX_ROOM_MEMBER_COUNT = 500
# 1. receive a new friendship from someone
if friendship.type() == FriendshipType.FRIENDSHIP_TYPE_RECEIVE:
hello_text: str = friendship.hello()
# friend: Contact = friendship.contact()
# await friend.ready()
# fri_name = friend.name
这是报错:
![image](https://user-images.githubusercontent.com/38806779/174790279-fbcd5f9a-ccbf-484a-ab32-4b194ddb028f.png)
2022-06-21 19:33:56,246 - Wechaty - INFO - receive event <EventFriendshipPayload(friendship_id='5913457775617322356')>
2022-06-21 19:33:56,246 - FriendShip - INFO - Friendship constructor 5913457775617322356
2022-06-21 19:33:56,246 - FriendShip - INFO - ready() sync the friendship payload
2022-06-21 19:33:56,297 - FriendShip - INFO - get hello message <申请> of friendship <<wechaty_grpc.wechaty.puppet.FriendshipPayloadResponse object at 0x7fc8528f7460>>
2022-06-21 19:33:56,297 - FriendShip - INFO - get hello message <申请> of friendship <<wechaty_grpc.wechaty.puppet.FriendshipPayloadResponse object at 0x7fc8528f7460>>
2022-06-21 19:33:56,297 - FriendShip - INFO - accept friendship, friendship_id: <5913457775617322356>
2022-06-21 19:33:56,297 - FriendShip - INFO - friendship accept to wxid_20qh1k68nuon
2022-06-21 19:33:57,344 - Wechaty - INFO - receive event <EventFriendshipPayload(friendship_id='4943574653437041188')>
2022-06-21 19:33:57,345 - FriendShip - INFO - Friendship constructor 4943574653437041188
2022-06-21 19:33:57,345 - FriendShip - INFO - ready() sync the friendship payload
2022-06-21 19:33:57,394 - FriendShip - INFO - get hello message <> of friendship <<wechaty_grpc.wechaty.puppet.FriendshipPayloadResponse object at 0x7fc8528f7880>>
2022-06-21 19:33:57,441 - Contact - INFO - load contact <Contact <wxid_20qh1k68nuon> >
2022-06-21 19:33:59,702 - Wechaty - ERROR - internal error <'userStatus'>
2022-06-21 19:33:59,751 - Wechaty - INFO - receive message <Message#message_type_text[🗣 Contact <wxid_20qh1k68nuon22> 申请>
already get wechat id:
already get contact_id id:wxid_20qh1k68nuon
2022-06-21 19:33:59,751 - Wechaty - INFO - receive message <Message#message_type_unspecified[🗣 Contact <wxid_20qh1k68nuon> >
already get wechat id:
already get contact_id id:wxid_20qh1k68nuon
这是我版本:
wechaty 0.8.35
wechaty-grpc 0.20.19
wechaty-puppet 0.4.19
wechaty-puppet-service 0.8.8
The text was updated successfully, but these errors were encountered: