wxpy icon indicating copy to clipboard operation
wxpy copied to clipboard

发送消息失败

Open ShihanZhang44419 opened this issue 7 years ago • 1 comments

如图所示 为什么发送消息的代码会报错呢? 我是python小白。 my_friends = bot.search().search('Shi',sex=MALE,) my_friends.send("hi")

Traceback (most recent call last): File "C:/Users/Dell/PycharmProjects/WBot/venv/WBot_test.py", line 12, in my_friends.send("hi") AttributeError: 'Chats' object has no attribute 'send'

ShihanZhang44419 avatar Mar 02 '19 07:03 ShihanZhang44419

bot.friends()返回的是一个数组,.search返回的是一个数组,所以需要取下标,你的代码也写错了

my_friends = bot.friends().search('Shi',sex=MALE)[0]
my_friends.send("hi")

qiaolevip avatar Apr 05 '19 13:04 qiaolevip