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 with the buttons not working is related to the warning you're seeing in the logs:
code
PTBUserWarning: If 'per_message=False', 'CallbackQueryHandler' will not be tracked for every message.
This warning indicates that the CallbackQueryHandler in your ConversationHandler is not properly configured to handle callback queries on a per-message basis.
Problem Explanation:
per_message=False: This means that the CallbackQueryHandler is not being tracked for every individual message. As a result, the bot might not correctly handle the callback queries (button presses) because it can't associate them with the correct conversation state.
Solution:
To fix this issue, you need to set per_message=True in your ConversationHandler. This ensures that the CallbackQueryHandler is tracked for every message, allowing the bot to correctly handle button presses.
Updated Code:
Here’s how you can modify your ConversationHandler in main.py:
per_message=True: This setting ensures that each message is tracked individually, which is crucial for handling callback queries (button presses) correctly. When a user presses a button, the bot can associate that button press with the correct conversation state.
Additional Notes:
Make sure that your keyboard buttons are correctly configured to send callback data that matches the patterns you've set up in the CallbackQueryHandler.
If the issue persists after making this change, double-check the callback data being sent by the buttons to ensure they match the expected patterns in your handlers.
After making this change, restart your bot, and the buttons should work as expected.