W
W
WiF Azapro2022-04-04 14:23:31
Python
WiF Azapro, 2022-04-04 14:23:31

Telegram bot not working What to do?

Everywhere is@bot.message_handler

Even in the documentation
https://github.com/eternnoir/pyTelegramBotAPI/blob...


My code

import os
import telebot

token = os.environ['TOKEN']
bot = telebot.TeleBot(token)

@bot.message_handler(content_types=["text"])
def repeat_all_messages(message):
  bot.send_message(
    message.chat.id,
    message.text
  )

if __name__ == '__main__':
  bot.infinity_polling()


Withdrawal of conzola

Traceback (most recent call last):
    file "main.py", line 7, in <module>
        @bot.message_handler(content_types=["text"])
AttributeError: 'TeleBot' object has no attri bute 'message_handler'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bezmenov, 2022-04-04
@Azapro_html

https://stackoverflow.com/questions/64951712/teleb...
https://qna.habr.com/q/957821
the first two links in Google according to the error text

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question