wechaty / python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
https://wechaty.readthedocs.io/zh_CN/latest/
Apache License 2.0
1.62k stars 234 forks source link

🐛🐛 Bug Report: 添加好友没有响应 #246

Open JoffreyN opened 3 years ago

JoffreyN commented 3 years ago

Describe your problem

A clear and concise description of what the bug is.

Reproduce your problem

async def addFriend(self):
    try:
        self.keyword=str(int(self.keyword))
        print(f'debug1 查找手机号: {[self.keyword]}')
        wx_contact=await self.Friendship.search(phone=self.keyword)
        print(f'debug2 查找手机号: {[self.keyword]}')
    except ValueError:
        print(f'debug3 查找微信号: {[self.keyword]}')
        wx_contact=await self.Friendship.search(weixin=self.keyword)
        print(f'debug4 查找微信号: {[self.keyword]}')

    if wx_contact:
        # await self.Friendship.add(wx_contact)
        await self.Friendship.add(wx_contact,'hello')
        return '好友请求发送成功'
    else:
        return '好友请求发送失败'

Error info

Additional context

日志里没有打印出 debug2或debug4 这句,似乎没有执行到那里 哪里写的不对吗?