Home > Enterprise >  How does BotFather link CallbackQueryHandler with MessageHandler?
How does BotFather link CallbackQueryHandler with MessageHandler?

Time:08-03

BotFather Case

BotFather uses inline keyboards a lot. Let's say I'm going to edit my bot. There are some options, for example: Edit Name, Edit About, Edit Commands...

Let's say I clicked Edit About. Now it sends me a text message says:

OK. Send me the new 'About' text. People will see this text on the bot's profile page and it will be sent together with a link to your bot when they share it with someone.

When I sent an about text for my bot, BotFather must be connecting the incoming message with the Edit About in the background. How the MessageHandler knows what's coming? The message I'm sending might be related with Edit Commands maybe.

Related Screenshot

Example from BotFather

My Case

I was curious about this, and to be honest I still lack of knowledge about all these. I can't say I'm expert. I generally check out python-telegram-bot docs and Telegram API webpage itself to find out what can be done for my own specific problem.

I'm planning to make an inline keyboard which is related with making feedback. I will ask user to enter something and then bot will forward the message to another chat. Long story short, how my bot will expect an input for feedback?

CodePudding user response:

It's almost sureley using some sort of finite state machine. python-telegram-bot offers the ConversationHandler for such use cases. Also have a look at the conversationbot.py example.


Disclaimer: I'm currently the maintainer of python-telegram-bot.

  • Related