P
P
pecenuska21352021-08-19 19:18:09
Python
pecenuska2135, 2021-08-19 19:18:09

telebot error, how to fix?

error:
Traceback (most recent call last):
File "C:\Users\Admin\PycharmProjects\Callv2\main.py", line 32, in
bot.polling()
File "C:\Users\Admin\AppData\Local\ Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 617, in polling
self.__threaded_polling(none_stop, interval, timeout, long_polling_timeout, allowed_updates)
File "C:\Users\Admin\AppData\Local \Programs\Python\Python39\lib\site-packages\telebot\__init__.py", line 676, in __threaded_polling
raise e
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site- packages\telebot\__init__.py", line 639, in __threaded_polling
self.worker_pool.raise_exceptions()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\util.py", line 130, in raise_exceptions
raise self.exception_info
File "C:\Users\Admin\ AppData\Local\Programs\Python\Python39\lib\site-packages\telebot\util.py", line 82, in run
task(*args, **kwargs)
File "C:\Users\Admin\PycharmProjects\Invocationv2\ main.py", line 30, in menu
time.sleep(2)(bot.send_message(1113732336, text="Sent"))
TypeError: 'NoneType' object is not
callable

bot = telebot.TeleBot("")
i = 0
while i != 1:

    @bot.message_handler(commands=['start'])
    def send_welcome(message):

        markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
        but1 = types.KeyboardButton("0")
        but2 = types.KeyboardButton("9")
        but3 = types.KeyboardButton("4")
        but4 = types.KeyboardButton("2")
        but5 = types.KeyboardButton("Своё сообщение")
        markup.add(but1, but2, but3, but4, but5)

        bot.reply_to(message, "Бот запущен".format(message.from_user)
        ,parse_mode='html',reply_markup=markup)


    @bot.message_handler(func=lambda message: True)
    def menu(message):
        if message.chat.type == 'private':
            sendmsg = message.text
            bot.send_message(xxx, text=sendmsg)
            time.sleep(2)(bot.send_message(xxx, text="Отправлено"))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2021-08-19
@pecenuska2135

time.sleep(2)(bot.send_message(xxx, text="Отправлено"))

What is this line???
Do it right, it will work fine.
And this question in general could not even be asked, but only at least look at what was displayed in the errors

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question