python code with telebot library ignores bot.polling



  • After the code is launched, there are two prints and no mistakes, but the second print should have stopped, because the code was supposed to stop. bot.polling(none_stop=True, interval=0)

    The token is right, the telebot(3.0.0) library has been installed, the interval has also been altered, the tokens are directly transferred, and the botts have been launched through the console.

    Here's the code:

    import telebot
    import config
    

    bot = telebot.TeleBot(config.TOKEN)
    print(bot.get_me())

    @bot.message_handler(content_types=['text'])
    def lalala (massage):
    bot.send_message(massage.chat.id, massage.text)

    bot.polling(none_stop=True, interval=0)
    print('out')



  • bot.polling(none_stop=True) should be recorded in the cycle while

    while True:
        try:
            bot.polling(none_stop=True)    
        except Exception as e:
            time.sleep(15)
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2