enter image description here Hello! I am writing a bot in a python telegram (first time). The first part of the code works and then no. Not even an error. As if there is nothing further. I do not know why. I don’t even know how to make the rest of the code run. Maybe some kind of bundle is needed between variables. Maybe I'm missing something. Please, help!!! Telegram bot: @godevelopbot. I will send the weight code: (for bad Russian)

import telebot from telebot import types token = 'XXX:XXX' bot = telebot.TeleBot(token) @bot.message_handler(commands=['start']) def start(message): sent = bot.send_message(message.chat.id, 'Как тебя зовут?') bot.register_next_step_handler(sent, hello) def hello(message): bot.send_message(message.chat.id, 'Привет, {name}. Рад тебя видеть. Пожалуйста, отправте мне свой номер для этого есть команда /geophone'.format(name=message.text)) @bot.message_handler(commands=['geophone']) def geophone(message): keyboard = types.ReplyKeyboardMarkup(row_width=1, resize_keyboard=True, one_time_keyboard=True) button_phone = types.KeyboardButton(text="Отправить номер телефона", request_contact=True) keyboard.add(button_phone) bot.send_message(message.chat.id, "Согласны ли вы предоставить ваш номер телефона для регистрации в системе?", reply_markup=keyboard) # Вот до сюда всё работает а дальше нет. @bot.message_handler(content_types=["text"]) def handle_text(message): if message.text == "🤝Hamkorlarimiz✅": j = "@yurtboshim kanali - bu kanalda siz, prezidentimiz tomonidan chiqarilayotgan farmonlar, farmoyishlar hamda rasmiy tashriflar haqida xabardor bo'lasiz" v = "@yurtdoshim kanali - bu kanalda siz, yurtimizda va dunyoda ro'y berayotgan xodisalar va yangiliklardan xabardor bo'lasiz." bot.send_message(message.chat.id, j) bot.send_message(message.chat.id, v) if message.text == "💵Pul ishlash💸": j = "'Pul ishlash' bo'timizning pul ishlash bo'limiga xush kelibsiz! Pul ishlash uchun bu ssilkani 👉 (ref ssilka) do'stlaringizga yuboring. Siz yuborgan ssilka bo'yicha kirgan xar bitta do'stingiz uchun sizga 100 so'm miqdorida mablag' qo'shiladi. Demak, qancha ko'p do'stingizga yuborsangiz shuncha ko'p pul ishlaysiz :)\n" v = "Ishlagan pullaringizni esa telefon raqamingizga paynet qildirish, yoki bo'lmasam click plastik kartangizga tushurib olishingiz mumkin! Nimani qarab turibsiz? Qani olg'a pul ishlang!😊 Omadingizni bersin!\n" '''bot.send_message(message.chat.id, j) bot.send_message(message.chat.id, v)''' user_markup = telebot.types.ReplyKeyboardMarkup(True, False,row_width=3) user_markup.row("💵Mening hisobim💵", "💰Pullarimni olish💰","⏪Orqaga qaytish!!!⏪") bot.send_message(message.chat.id, j,reply_markup=user_markup) bot.send_message(message.chat.id, v, reply_markup=user_markup) if message.text == "💵Mening hisobim💵": j = "Hozirda sizning hisobingiz 0 sum." v = "Do'stlaringizni botimizga olib keling va hisobingizni ko'paytiring :)" bot.send_message(message.chat.id,j) bot.send_message(message.chat.id,v) if message.text == "💰Pullarimni olish💰": j = "Minimal pul yechib olish summasi 5.000 so'm." v = "Hisobingizni yechib olish uchun telefon raqamingizni kiriting:" d = "Misol uchun:" s = "+998901234562" k = "yoki" n = "8600 8765 5453 5895" l = "Raqam kiritishda yanglishmang :)" bot.send_message(message.chat.id, j) bot.send_message(message.chat.id, v) bot.send_message(message.chat.id, d) bot.send_message(message.chat.id, s) bot.send_message(message.chat.id, k) bot.send_message(message.chat.id, n) bot.send_message(message.chat.id, l) if message.text == "⏪Orqaga qaytish!!!⏪": user_markup = telebot.types.ReplyKeyboardMarkup(True, False,row_width=3) user_markup.row("🤝Hamkorlarimiz✅", "💵Pul ishlash💸") bot.send_message(message.chat.id,"Asosiy sahifa!!!!",reply_markup=user_markup) bot.polling() 
  • In published questions, it is customary to hide tokens, logins and passwords, for security - DaemonHK
  • @DaemonHK, only editing the message does not help to hide the leaked key - there is a history of edits. A key will have to withdraw and make a replacement. - mymedia
  • @mymedia well, at least somehow ((Although the key, yes, will have to be changed anyway - DaemonHK
  • Token Invalid - Adik

1 answer 1

I, of course, are not familiar with the Telegram API, but as far as I understand conceptually, you did not set handle_text as a handler for the geophone command response, as you did for start on this line:

 bot.register_next_step_handler(sent, hello) 

Although there is a slightly different case, but oh well.

PS in vain you token burned ..

  • It is better to use the Finite state machine as register_next_step_handler not stable - Pavel Durmanov
  • Token Invalid - Adik