Answer the question
In order to leave comments, you need to log in
How to accept only one message from a user in a telegram bot?
It is necessary after the int_on command that the bot processed only one message
User [03/21/19 09:37]
/int_on
BOT [03/21/19 09:37]
To enable the Internet on the workstation, enter the ip-address in the format of note 10.98.10.36
For example
BOT
The command is completed, click.
import telebot
from telebot import types
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
msg = bot.send_message(message.chat.id, 'Привет! Я Красная королева!')
@bot.message_handler(commands=['stop'])
def handle_text_1 (message):
msg = bot.send_message(message.chat.id, 'Our buisness is life itself')
@bot.message_handler(commands=['int_on'])
def handle_text (message):
bot.send_message(message.chat.id, "Чтобы включить интернет на АРМ введите ip-адрес в формате прим.")
@bot.message_handler(content_types=['text'])
def handle_text(message):
ip_addr = message.text
print(ip_addr)
bot.send_message(message.chat.id, "Выполнение команды завершено")
bot.polling()
Answer the question
In order to leave comments, you need to log in
sent = bot.send_message(message.chat.id, 'Чтобы включить интернет на АРМ введите ip-адрес в формате прим.')
bot.register_next_step_handler(sent, test)
def test(message):
ip_addr = message.text
print(ip_addr)
bot.send_message(message.chat.id, "Выполнение команды завершено")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question