what is problem
inventory/myenv/bin/python3.10 /home/ragaman/telegram_bot_inventory/main.py
/home/ragaman/telegram_bot_inventory/main.py:43: PTBUserWarning: If 'per_message=False', 'CallbackQueryHandler' will not be tracked for every message. Read this FAQ entry to learn more about the per_* settings: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Frequently-Asked-Questions#what-do-the-per_-settings-in-conversationhandler-do.
conv_handler = ConversationHandler(
2025-01-20 13:09:42,577 - main - INFO - Bot is running...
2025-01-20 13:09:43,910 - telegram.ext._application - INFO - Application started
the button dont work
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
The issue you're experiencing, where buttons don't work in your Telegram bot, is likely related to how the CallbackQueryHandler is configured in your ConversationHandler and the warning message about the per_* settings in the python-telegram-bot library.
Explanation of the Warning
The warning message you are seeing:
code
/home/ragaman/telegram_bot_inventory/main.py:43: PTBUserWarning: If 'per_message=False', 'CallbackQueryHandler' will not be tracked for every message. Read this FAQ entry to learn more about the per_* settings: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Frequently-Asked-Questions#what-do-the-per_-settings-in-conversationhandler-do.
means that the ConversationHandler is not configured to properly track the CallbackQueryHandler for every incoming message or callback query. By default, per_message=False causes the ConversationHandler to keep state based on the entire chat (per_chat=True), rather than tracking state for each individual message. This can lead to unexpected behavior, especially when handling callback queries from inline keyboards.
Why Buttons Don’t Work
The root cause is likely one of the following:
State Tracking Issue:
The ConversationHandler may not properly track the state transitions when the user interacts with the inline keyboard buttons (CallbackQueryHandler).
Improper State Return in Handlers:
If a handler (e.g., handle_size_selection) doesn’t correctly return the expected state (e.g., "COLOR"), the ConversationHandler won't know what to do next, and button presses will appear to "do nothing".
Callback Data Mismatch:
The callback_data of the buttons in your inline keyboards may not match the patterns expected by the CallbackQueryHandler.
Per-Message Tracking Needed:
Since your bot heavily relies on CallbackQueryHandler (for handling inline keyboard interactions), you should configure ConversationHandler to track per-message state using the per_message=True parameter.
Solution
1. Enable per_message=True in ConversationHandler
Update the ConversationHandler in your main.py file to include per_message=True: