Search code examples
pythonbotstelegram-botpython-telegram-botpy-telegram-bot-api

bot.polling() issue with pytelegramapi


I was just doing a simple lines of code and it gives a lot of issues just for using bot.polling().

import telebot

token = '19*******:********-********-lmY'
bot = telebot.TeleBot(token)

@bot.message_handler(commands=['greet'])
def send_welcome(message):
    bot.reply_to(message, "Howdy, how are you doing?")


bot.polling()

Solution

  • First pip uninstall telebot

    Then pip install pyTelegramBotAPI

    import telebot
    
    API_KEYS = "API TOKEN"
    bot = telebot.TeleBot(API_KEYS)
    
    @bot.message_handler(commands=['greet'])
    def send_welcome(message):
        bot.reply_to(message, "Howdy, how are you doing?")
    
    bot.polling()