Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ConversationHandler do not support per_message_thread_id conversations #4768

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

Closed
RomanValov opened this issue Apr 25, 2025 · 1 comment
Closed

Comments

@RomanValov
Copy link

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

Hello,

I'm developing a bot based on python-telegram-bot which leverages topics (threads) in group chats. In particular I would like to use ConversationHandler to interact with a bot independently per message thread. But it looks that ConversationHandler supports per_user and per_chat modes.

Currently it's possible to start conversation in one topic and continue in another.

Describe the solution you'd like

Additional property for ConversationHandler to support chat topics

Describe alternatives you've considered

There is also per_message mode available for ConversationHandler, but using it with the following code:

        app.add_handler(ConversationHandler(
            entry_points=[CommandHandler('edit', self.edit_command)],
            states={
                self.EDIT: [
                    MessageHandler(filters.TEXT & ~filters.COMMAND, self.edit_command_done)],
            },
            fallbacks=[CommandHandler('cancel', self.cancel_command)],
            per_message=True,
        ))

makes ConversationHandler not working and cresults in a warning:

PTBUserWarning: If 'per_message=True', all entry points, state handlers, and fallbacks must be 'CallbackQueryHandler', since no other handlers have a message context. 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.
  app.add_handler(ConversationHandler(

Additional context

No response

@RomanValov RomanValov added the 📋 triage work status: triage label Apr 25, 2025
@Bibo-Joshi
Copy link
Member

Hi. That's a valid request, but I'll have to merge it into the long-standing list in #2770 ... I'll close this ticket here for easy of tracking, but that doesn't mean that I'm rejecting it :)

@Bibo-Joshi Bibo-Joshi removed the 📋 triage work status: triage label Apr 25, 2025
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants