Closed pinghajen closed 7 years ago
edit: I tried passing the chatID as an integer also
If I edit the code to print out j['payload'] and the returned json is this
{'message_blocked_ids': [], 'payload_source': 'server_fetch_thread_info', 'end_of_history': [{'type': 'user', 'id': 890328284337788, 'fbid': '890328284337788'}], 'roger': None }
it doesn't seem to have an actions element
Is this chatID a user id apart from yours?
Facebook has changed a lot of things, and fbchat
has been updated, so I'm assuming this is outdated ;)
I am getting this error
Logging in... Traceback (most recent call last): File "C:\Users\jerem\Source\Repos\FBChatBot\FBChatBot\FBChatBot\FBChatBot.py", line 8, in
last_messages = client.getThreadInfo(bot["chatID"],0)
File "C:\Users\jerem\AppData\Local\Programs\Python\Python35\lib\site-packages\fbchat-0.3.1-py3.5.egg\fbchat\client.py", line 266, in getThreadInfo
for message in j['payload']['actions']:
KeyError: 'actions'
Press any key to continue . . .
and this is my code
import fbchat, json
with open("data/user.json") as user: bot = json.load(user)
client = fbchat.Client(bot["username"], bot["password"])
last_messages = client.getThreadInfo(bot["chatID"],0)