Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I stop the bot from receiving messages when the script was off?? #223

Open
Milaquia opened this issue Sep 2, 2022 · 3 comments
Open

Comments

@Milaquia
Copy link

Milaquia commented Sep 2, 2022

As the title say, Im kinda new to this telebot library, but well, I made a command to shut down the bot, and it works, but, when I restart the bot, it starts getting the messages it didn't recorded while it was off, the last message was the shutdown command, so it goes to a loop of shutting down. So I want to know how to make the bot only get updates of the messages when is on, and not the messages that it got when the script was off. Help because I don't know how to fix this

@VDS13
Copy link

VDS13 commented Jan 10, 2023

Hello, @ThePinkLyna.
Since this library has not been updated for a long time, it lacks the options added in later versions of the Telegram Bot API.
If you want to add the library yourself:
For Webhooks: There is an option drop_pending_updates (Pass True to drop all pending updates) in the setWebhook method.
For Polling: do not call the getUpdates method.

@Milaquia
Copy link
Author

Thank you for answering, even if it was 4 months later.

I see, well, back then I solved it just by adding a variable that increases by 1 every second, until the variable isn't on more than 10, the bot won't execute any command. It's just... That this library feels easier to use than telegraf, so i would like to stick with it a little more.✨

@VDS13
Copy link

VDS13 commented Feb 22, 2023

@ThePinkLyna, you can use node-telegarm-bot-api, the library is actively maintained, the syntax is very similar to telebot and quite simple))).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants