Python-telegram-bot: Reply message when using telegram.ext.Updater

Created on 3 Apr 2016  路  3Comments  路  Source: python-telegram-bot/python-telegram-bot

I'm using telegram.ext.Updater to build a bot just like the example echobot2.
In the echo function, I want to reply message, and tried piece of code found in README as followed.

>>> chat_id = bot.getUpdates()[-1].message.chat_id

But it went wrong. Then I found that bot.getUpdates() in the echo function is an empty list.

Is that a bug? Or reply message is not supported in telegram.ext.Updater?

question

Most helpful comment

I see. Use sendMessage(..., reply_to_message_id=update.message.message_id)

All 3 comments

If you are using the Updater, you don't have to use getUpdates. The update object is already passed to the echo function, so you can just use update.message.chat_id

@jh0ker Thanks for your answer.
But when I use update.message.chat_id, the bot just 'send' the message directly, instead of 'reply' the message I just sent.
The reply function is what I really want to do. Could it be done in any way?

I see. Use sendMessage(..., reply_to_message_id=update.message.message_id)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marekyggdrasil picture marekyggdrasil  路  5Comments

rahiel picture rahiel  路  5Comments

kmahsi picture kmahsi  路  4Comments

persian-telegram picture persian-telegram  路  3Comments

moonbaseDelta picture moonbaseDelta  路  4Comments