On telegram the bot is showing me the "reply keyboard" but nothing further happens as the below error gets raised
async def start (update: Update, context: CallbackContext):
reply_keyboard = [["A", "B", "C"]]
await update.message.reply_text(
"Select any one",
reply_markup = ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True)
)
def handle_inputs (update: Update, context: CallbackContext):
comd = update.message.text
if (comd == '/start'):
asyncio.run(start(update, context))
else:
update.message.reply_text("Sorry '%s' is not a valid command" % update.message.text)
def main():
updater = Updater(BOT_TOKEN, use_context=True)
dispatcher = updater.dispatcher
updater.dispatcher.add_handler(MessageHandler(Filters.text, handle_inputs))
updater.start_polling()
if __name__ == '__main__':
main()
I am new to Telegram bot and have less knowledge for Async Functions. Any help will be greatly appreciated! Thank you!
I tried to understand more about co-routines but and not quite sure how to implement it here. I am expecting couple of telegram features to implement like:
- wait for user to input something
- reply keyboard, inline keyboard, etc.
python-telegram-bot
, but that looks likeupdate.message.reply_text
is synchronous and returns aMessage
object without the need to beawait
ed.await
, it only generate the "reply keyboard" on telegram bot and nothing else. It does not wait for the user to select an option