所以我试着用fbchat给自己发个信息,每次都会出错。你知道吗
Traceback (most recent call last):
File "main.py", line 12, in
client.send(Message(text=msg, thread_id="christopher.batey", thread_type=ThreadType.USER))
TypeError: init() got an unexpected keyword argument 'thread_id'
我要把头发拔出来。我从fbchat文档获取ThreadType,无法绕过此错误。你知道吗
我的代码如下所示:
from fbchat import Client
from fbchat.models import *
client = Client(my_user, my_pass)
name = "christopher.batey"
friends = client.searchForUsers(name)
friend = friends[0]
uid = friend.uid
msg = "This is a test"
sent = client.send(msg, thread_id=uid, thread_type=ThreadType.USER)
根据你的错误代码,我假设你的代码是这样的:
最后一部分看起来像是将
thread_id
和thread_type
参数放在Message类中,而实际上它们是client.send()
函数的参数。它应该是这样的:希望这能回答你的问题!你知道吗
相关问题 更多 >
编程相关推荐