P
P
Peter Pnev2022-02-20 14:08:30
Python
Peter Pnev, 2022-02-20 14:08:30

I wanted to write a bot from YouTube, but it doesn’t work for me, it gives an error. How to fix it?

import telebot
import config

bot = telebot.Telebot(config.Token)
@bot.message_handlers(content_types=['text'])
def lalala(message):
bot.send_message(message.chat.id, message.text)

bot.polling (none_stop=True)

ERROR: 'list' object is not callable
621227e43012a282030452.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ruslan, 2022-02-22
@PetrogradPP1

Slightly corrected some errors in the form of quotes and method names.
What exactly is the bot supposed to do?
If you respond with the same message to the user, then here, try this option:

import telebot

bot = telebot.TeleBot("TOKEN" )
@bot.message_handler(content_types=['text'])

def send_echo(message):
  bot.send_message(message.chat.id, message.text)

bot.polling(none_stop=True)

D
Daniil Dedinets, 2022-02-20
@donko1

import telebot
import config

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

bot.polling(none_stop=True)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question