2

Ошибка:

$ C:/Users/sorre/AppData/Local/Programs/Python/Python39/python.exe d:/Python/IlyaSamaelLondony1Bot/main.py
2021-09-22 20:49:37,567 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:49:37,899 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:49:38,461 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:49:39,535 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:49:41,605 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:49:45,676 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:49:53,749 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:50:09,815 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2021-09-22 20:50:41,880 (__init__.py:653 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"

Код:

import config
import telebot

bot = telebot.TeleBot(config.token)

@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    bot.send_message(message.chat.id, "Привет "  + message.from_user.first_name + ' ' +message.from_user.last_name + ", я бот!")

if __name__ == '__main__':
    bot.polling(none_stop=True)```
0

1 ответ 1

1

Данная ошибка выдается при авторизации (когда токен указан неверно - попробуйте проверить все ли вы указали корректно)

bot = telebot.TeleBot(config.token)

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.