R
R
RieldaBot2021-10-13 14:00:37
Python
RieldaBot, 2021-10-13 14:00:37

PyTelegramBotAPI SyntaxError how to fix?

i have this code

import telebot
import config

bot = telebot.TeleBot(config.TOKEN)

bot.message_handler(content_types=['text'])
def lapochka(message):
    bot.send_message(message.chat.id, message.text)

bot.polling(none_stop=True)

The console writes this error:
C:\Users\Admin\Desktop\Bots>cd C:\Users\Admin\Desktop\Bots\TelegramBot
C:\Users\Admin\Desktop\Bots\TelegramBot>python bot.py
File "C: \Users\Admin\Desktop\Bots\TelegramBot\bot.py", line 7
def async(message):
^
SyntaxError: invalid syntax

How to solve??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-10-13
@SoreMix

Well, firstly, in the piece of code that you have attached, this error does not exist.
Secondly, async is a reserved word, you should not use it for other purposes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question