How to wait for answer from user in telegrambotapi

Viewed 258

Hello i am making rock paper scissors game in telegram and i have a problem with waiting for user input after i ask what they choose from the list of choices ['rock', 'paper', 'scissors']. I am using PyTelegramBotApi

def hello(message):
    if message.text == '/info':
        bot.send_message(message.chat.id, 'daada :)')

    elif message.text == '/start':
        bot.send_message(message.chat.id, 'Hello! My name is Anton and I am telegram bot')

    elif message.text == '/game':
        rock_paper_scissors(message)

this is how game is called

def rock_paper_scissors(message):

    bot.send_message(message.chat.id, '1 - Rock\n2 - Paper\n3 - Scissors')

    choice = ['rock', 'paper', 'scissors']

    if answer.text.lower() not in choice:
        bot.send_message(answer.chat.id, 'Uknown choice!')
    else:
        bot.send_message(answer.chat.id, game(answer.text.lower()))

This is the game func
game fucn returns string: lose win draw
so i want to put user input in answer variable

0 Answers
Related