tomer8007 / kik-bot-api-unofficial

Python API for writing unoffical Kik bots that act like humans
MIT License
126 stars 76 forks source link

Roster function throws AttributeError #153

Closed kaaswe closed 4 years ago

kaaswe commented 4 years ago

Hello

Since around 8th of May the Roster function returns AttributeError. Here it's from the echo_bot that I have implemented it in, but the same error goes with the interactive_client.py. I downloaded the latest code after I noticed the first error and it's still the same. So it's not in my code. I'm a newbie in Python so I can't trace why it occurs, perhaps KIK has changed on the API side.

 Exception in thread Thread-8: Traceback (most recent call last): File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/kik-bot-api-unofficial-new/kik_unofficial/client.py", line 503, in _on_new_data_received self._handle_received_iq_element(xml_element) File "/kik-bot-api-unofficial-new/kik_unofficial/client.py", line 544, in _handle_received_iq_element self._handle_response(xml_namespace, iq_element) File "/kik-bot-api-unofficial-new/kik_unofficial/client.py", line 559, in _handle_response xmlns_handlers.RosterResponseHandler(self.callback, self).handle(iq_element) File "/kik-bot-api-unofficial-new/kik_unofficial/xmlns_handlers.py", line 163, in handle self.callback.on_roster_received(FetchRosterResponse(data)) File "/kik-bot-api-unofficial-new/examples/echo_bot.py", line 236, in on_roster_received friends[m.jid] = m AttributeError: 'NoneType' object has no attribute 'jid'

tomer8007 commented 4 years ago

What echo_bot.py are you using? this one doesn't even have 236 lines or friends[m.jid] = m in it.

If you edited the file, does that work for you without edits?

kaaswe commented 4 years ago

it's the same roster function as in 'interactive_client.py', line 236 in both cases would match: friends[m.jid] = m

the entire function is:

def on_roster_received(self, response: FetchRosterResponse):
    for m in response.peers:
        friends[m.jid] = m
    print("-Peers-\n{}".format("\n".join([str(m) for m in response.peers])))

I get the exact same error on Interactive_client, pointing to the sam row. Do you mean the roster works for you?

kaaswe commented 4 years ago

Line 24 in Interactive_client.py

kaaswe commented 4 years ago

forget about echo_bot.py and lets focus on Interactive_client.py. Plain code, no changes, doesn't work for me now, and it worked last week

kaaswe commented 4 years ago

echo_bot.py standard code do work as that roster function doesn't add to friends list, in my code I haver merged that in as I thought that interactive part was nice.

tomer8007 commented 4 years ago

Both echo_client.py and interactive_client.py are working for me. I suggest looking at the raw response object, it appears you are having a None peer member for some reason.

kaaswe commented 4 years ago

I created a new user and now it's working so it has to be some user as you said. Strange. Thanx for pointing me to the right direction. case closed

tomer8007 commented 3 years ago

Could be #161 .