tomer8007 / kik-bot-api-unofficial

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

Fixed gifs and minor bugs #230

Closed PointlessUser closed 1 year ago

tomer8007 commented 1 year ago

Thanks for the GIF bugs

PointlessUser commented 1 year ago

Thanks for the GIF bugs

PointlessUser commented 1 year ago

That was an accident, but np on the bug fix, it still doesn't work in groups tho :(

tomer8007 commented 1 year ago

it still doesn't work in groups tho :(

I hope it still works for direct messages then

PointlessUser commented 1 year ago

It does work for direct messages, but when sending it to a group, it says it's successful but it never actually sends a gif

tomer8007 commented 1 year ago

How is wait_for_messages creating a new thread? The idea of adding self.kik_connection_thread.join() was to not let the main thread exit before the connection thread exists so that #172 won't happen. You can also see this in https://github.com/tomer8007/kik-bot-api-unofficial/issues/223#issuecomment-1477011924.

Perhaps it's a behavior of thread.join in newer versions of python which I am not aware of?

PointlessUser commented 1 year ago

How is wait_for_messages creating a new thread? The idea of adding self.kik_connection_thread.join() was to not let the main thread exit before the connection thread exists so that #172 won't happen. You can also see this in #223 (comment).

Perhaps it's a behavior of thread.join in newer versions of python which I am not aware of?

When I have my code like this, I get something similar to issue #172

class EchoBot(KikClientCallback):
    def __init__(self):
        self.client = KikClient(self, username, password)
        self.client.wait_for_messages()

if __name__ == '__main__':
    # Creates the bot and start listening for incoming chat messages
    callback = EchoBot()

But when I change self.kik_connection_thread.join() to self._kik_connection_thread_function() it works fine

I'm using python 3.11, so that could be the reason, but idk

Also does logging in with no captcha still work for you? Because I need to use captcha every time

PointlessUser commented 1 year ago

@tomer8007 Nvm, learned more about threading and I finally found a proper solution, I'll push it once I test it a bit more

PointlessUser commented 1 year ago

Yeh I think it's good now, it works how we want it to work

tomer8007 commented 1 year ago

But now you're assuming that when kik_connection_thread exists it means the connection has failed. There has to be a more elagantic way to do this than sleeping

tomer8007 commented 1 year ago

Also does logging in with no captcha still work for you? Because I need to use captcha every time

The last time I tried I needed captcha to login

PointlessUser commented 1 year ago

But now you're assuming that when kik_connection_thread exists it means the connection has failed. There has to be a more elagantic way to do this than sleeping

Currently, if the person needs to login with captcha, the login fails, so self.kik_connection_thread.join() starts and ends before the program can re-connect and ask for a captcha. There probably is a more elegant way to resolve it, but this is the best simple solution I could find. I could try finding a more elegant solution on my next pull request

PointlessUser commented 1 year ago

Also does logging in with no captcha still work for you? Because I need to use captcha every time

The last time I tried I needed captcha to login

I found a way to do it without captcha. So the first time you log in, you need to do the captcha and get the device_id and android_id used for that session. After that, you have to log in with your node and use the same device_id and android_id as the first session so that kik thinks its the same device and doesn't need you to re-verify

PointlessUser commented 1 year ago

I tested gifs again, I think you just need to be in the group for 12 hours for them to work

PointlessUser commented 1 year ago

Should be good now