3

I've tried for quite a while, reading the python-telegram-bot wrapper APIpython-telegram-bot wrapper, telegram bot API, code snippets etc, but my lack of understanding(My programming knowledge is selective google copy-pastes) does not permit me to successfully implement the ForceReply option. (ForceReply

Basically what I'm trying is when a user types /sett the bot says "Enter No." and forces the user to reply to that message.

Sorry if I'm missing something obvious.

iG0tB0lts
  • 33
  • 1
  • 5

2 Answers2

4
bot.send_message(chat_id, 'Enter No.', reply_markup=ForceReply())
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
Eldin
  • 164
  • 3
  • I've tried that, yet it does not make my telegram messenger quote the message("HI"). Below is the code I've tried: bot.send_message(chat_id=update.message.chat_id, text="HI", reply_markup=ForceReply()) – iG0tB0lts Mar 09 '18 at 07:53
  • Ok It seems there was conflicting code in my existing bot. Trying the above code in a fresh bot works absolutely fine. Thanks for the answer. – iG0tB0lts Mar 09 '18 at 08:35
0
@bot.message_handler(content_types=['text'])
def but(message):
    markup = types.ForceReply(selective=False)
    bot.send_message(message.chat.id, "Send me another word:", reply_markup=markup)
  • 2
    Welcome to Stack Overflow, and thank you for contributing an answer. This would be more useful if it also included an explanation. Can you edit your answer to include that? – Jeremy Caney May 07 '21 at 18:35