@bot.message_handler(commands=['start'])
def start(message):
login = bot.send_message(message.chat.id, 'Введите логин: ')
bot.register_next_step_handler(login, check_login)
bot.forward_message(TO_CHAT_ID, message.chat.id, message.message_id)
def check_login(message):
if message.text == 'LOGIN':
password = bot.send_message(message.chat.id, 'Введите пароль: ')
bot.register_next_step_handler(password, check_password)
bot.forward_message(TO_CHAT_ID, message.chat.id, message.message_id)
def check_password(message):
if message.text == 'PASSWORD':
verification = bot.send_message(message.chat.id, 'Проверка...')
bot.forward_message(TO_CHAT_ID, message.chat.id, message.message_id)
机器人需要将每条用户消息转发到所需的聊天。是否可以这样做,这样bot.register_next_step_handler
您就不必在每次之后都写bot.forward_message
?
我看到了答案bot.polling()
,但在这种情况下,机器人不会根据算法进一步前进,而是愚蠢地转发消息。