Search code examples
pythonpython-3.xbotstelegram-botpython-telegram-bot

How can I input() using TeleBot?


I was wondering if i can make input() using TeleBot dependency.

e.g. console way:

POL = float(input("Enter your POL: ))

Is there a way to do using Telebot, like:

bot.send_message(message.chat.id, "Enter your POL")
## Get message.text into POL variable. 

Solution

  • From what I understand, there isn't a direct way of doing this, but you can look at the message that the user has replied to from

    replied_message = message.reply_to_message.message_id
    

    If it matches the id of the message that you sent then that would be the reply to your message. You can get the id of your sent message from

    sent_message = bot.send_message(message.chat.id, "Enter your POL")
    sent_message_id = sent_message.message_id