@almaska

Когда пишу код происходит ошибка invalid syntax, что делать?

Выдает ошибку
Вот код:
import telebot
import config

bot = telebot.TeleBot(config.TOKEN)

@bot.message_handler(commands=["start"])
def welcome(message):
    sti = open("static/welcome.webp", "rb")
    bot.send_sticker(message.chat.id, sti)

    bot.send_message(message.chat.id , "Добро пожаловать, {0.first_name}!\nЯ -  </b>{1.first_name}, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me())
    	parse_mode="html")


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

#RUN
bot.polling(none_stop=True)


-------------------------------------------

c:\Python>python bot.py
  File "bot.py", line 12
    parse_mode="html")
    ^
SyntaxError: invalid syntax
  • Вопрос задан
  • 978 просмотров
Решения вопроса 1
Ternick
@Ternick
Запятую потерял !
import telebot
import config

bot = telebot.TeleBot(config.TOKEN)

@bot.message_handler(commands=["start"])
def welcome(message):
sti = open("static/welcome.webp", "rb")
bot.send_sticker(message.chat.id, sti)

bot.send_message(message.chat.id , "Добро пожаловать, {0.first_name}!\nЯ - {1.first_name}, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()),
parse_mode="html")

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

#RUN
bot.polling(none_stop=True)

Вот в этой строке (12):
bot.send_message(message.chat.id , "Добро пожаловать, {0.first_name}!\nЯ - {1.first_name}, бот созданный чтобы быть подопытным кроликом.".format(message.from_user, bot.get_me()),
parse_mode="html")
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы