We have a telegram bot with methods
@asyncio.coroutine def on_chat_message(msg): chat_id = msg['chat']['id'] command = msg['text'] full_name = msg['chat']['first_name'] + ' ' + msg['chat']['last_name'] username = msg['chat']['username'] print('User:', full_name, '\nNickname:', username, '\nGot command:', command) markup = ReplyKeyboardMarkup(keyboard=[ ['Check once'], ['Start autoinformer', 'Stop autoinformer'] ]) if command == '/start': yield from bot.sendMessage(chat_id, 'Choose option:', reply_markup=markup) elif command == 'Check once': yield from bot.sendMessage(chat_id, latest_build_number) elif command == 'Start autoinformer': stop_markup = ReplyKeyboardMarkup(keyboard=[['Stop autoinformer']], resize_keyboard=True) yield from bot.sendMessage(chat_id, //TODO, reply_markup=stop_markup) elif command == 'Stop autoinformer': yield from bot.sendMessage(chat_id, 'Got you.'//TODO, reply_markup=markup) def check_always(chat_id): global latest_build_number latest_build_number = check_build() print(latest_build_number) while 1: build_new = check_build() if latest_build_number == build_new: time.sleep(10) else: latest_build_number = build_new bot.sendMessage(chat_id, latest_build_number) How can I implement the ability to receive new messages to the on_chat_message (msg) method and, moreover, if the Start autoinformer command is received, start the check_always (chat_id) method until the auto automaker command is received?