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

When TELEGRAM_DISABLE_COMMANDS is enabled Telegram notifier shouldn't register commands #440

Open
dissidente opened this issue Jan 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@dissidente
Copy link

When the ability to use commands for tgtg on Telegram notifier is disabled, the notifier should only be used to send notices on events, and should not register any tgtg-related commands (as they can't be used).

This is specially important when using a bot for multiple purposes, one of which receive tgtg notices without the intention of executing any commands to tgtg through the bot (hence the TELEGRAM_DISABLE_COMMANDS being enabled).

@Der-Henning
Copy link
Owner

Hi @dissidente.
This should already be the case. But the bot also does not unregister the commands on shutdown. So if the scanner was started with TELEGRAM_DISABLE_COMMANDS=False once, the commands will remain...
I will have a look into this later.
Do you know any best practices for this?
I for myself use a separate bot for every project or purpose, so I don't have this problem.

@Der-Henning Der-Henning added the bug Something isn't working label Jan 7, 2024
@dissidente
Copy link
Author

Hummm not sure if this is a false positive.

A couple of days ago I changed the setting to false, and removed the commands from the bot, as I actually mainly use the bot for notifications, with tgtg as well. At the time the bot was left without a command list.

Yesterday when I ran into my issue with upgrading the container, I actually made a copy of the container configuration and restored it at the side of the main one, just pointing to the previous container version. I checked the configuration and the setting was still false, so I found weird when I successfully started the container and then got the menu back.

However, a few minutes ago, after having fixed my issue, and starting a new tgtg container, the menu didn't come back (with the setting as false, as it should), so... 🤷‍♂️

I see the telegram notifier was rebuilt. This might have been present on v1.17.1, which was the previous version I used to keep the notifier going while sorting the container upgrade issue.

@floriegl
Copy link
Contributor

floriegl commented May 8, 2024

Shouldn't we just call https://docs.python-telegram-bot.org/en/v21.1.1/telegram.bot.html#telegram.Bot.delete_my_commands when the bot starts up with TELEGRAM_DISABLE_COMMANDS=false?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants