Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

之前能够获取新好友的微信号,现在经常出现userstate异常获取不到。 #44

Closed
Hyfred opened this issue Jun 21, 2022 · 1 comment

Comments

@Hyfred
Copy link

Hyfred commented Jun 21, 2022

同样的代码几个月前能够在被加好友时,在申请通过后获取该好友的微信号,现在经常出现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

        # 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)

这是报错:
image
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

@Hyfred Hyfred closed this as completed Jun 21, 2022
@wj-Mcat
Copy link
Collaborator

wj-Mcat commented Jun 21, 2022

why do you close this issue ? have this problem been fixed ? if it is, can you share your solution for us ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants