tomer8007 / kik-bot-api-unofficial

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

How to reply to non new messages? #198

Closed Somberor closed 2 years ago

Somberor commented 3 years ago

Hey, If I have a bunch of waiting chats how can I fetch them and reply to them 1 by 1? (since on_message is not firing because its not new messages I need another way to do it) thanks!

PunkSoul commented 3 years ago

What do you mean by "Waiting chats"? Every message recieved by your bot should fire on_message from what I've seen?

Somberor commented 3 years ago

What do you mean by "Waiting chats"? Every message recieved by your bot should fire on_message from what I've seen? Perhaps I'm misunderstanding what you mean, an example would be appreciated.

When people message my account and python bot is not active the chats being archived, once I start the bot I want these chats to be messaged, but that is not happening because the bot only replies to new chats How can I also reply to the already waiting chats?

GreenBed commented 3 years ago

I don’t know of any way to access waiting messages, sadly. Maybe @tomer8007 or @bluemods might know how to access that archive? But you could make an “off” toggle to stop your bot from replying to messages, instead logging new messages to a text file with JID/GJID. Then it could reply to each logged message line by line in a for loop when it’s toggled back “on”. Your bot would still need to be technically active/online the whole time, I’m afraid.

bluemods commented 3 years ago

I don’t know of any way to access waiting messages, sadly. Maybe @tomer8007 or @bluemods might know how to access that archive? But you could make an “off” toggle to stop your bot from replying to messages, instead logging new messages to a text file with JID/GJID. Then it could reply to each logged message line by line in a for loop when it’s toggled back “on”. Your bot would still need to be technically active/online the whole time, I’m afraid.

This is a bad idea, since spamming a bunch of messages at once might trigger a captcha. It's best to have your bot reply immediately to make it responsive.

The process of getting message history is documented in this flow:

https://github.com/tomer8007/kik-bot-api-unofficial/wiki/Message-Formats#history-retrieval

History fetching is not implemented in this API yet (it's one of the more complicated tasks to do properly). Remember to fetch subsequent pages, you need to ack the messages for the page you received.

tomer8007 commented 2 years ago

@bluemods History fetching should now be supported since #200.