Answer the question
In order to leave comments, you need to log in
Error IndentationError: unexpected unindent, what should I do?
I tried to create a telegram bot
here is the code
import telebot;
bot = telebot.TeleBot('####');
message_handler(content_types=['text'])
def get_text_messages(message):
@bot.message_handler(content_types=['text', 'document', 'audio'])
if message.text == "Привет":
bot.send_message(message.from_user.id, "Привет, чем я могу тебе помочь?")
elif message.text == "/help":
bot.send_message(message.from_user.id, "Напиши привет")
else:
bot.send_message(message.from_user.id, "Я тебя не понимаю. Напиши /help.")
bot.polling(none_stop=True, interval=0)
Answer the question
In order to leave comments, you need to log in
You did something with the arrangement of decorators. Learn the basics of the language first.
import telebot
bot = telebot.TeleBot('####')
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
if message.text == "Привет":
bot.send_message(message.from_user.id, "Привет, чем я могу тебе помочь?")
elif message.text == "/help":
bot.send_message(message.from_user.id, "Напиши привет")
else:
bot.send_message(message.from_user.id, "Я тебя не понимаю. Напиши /help.")
bot.polling(none_stop=True, interval=0)
def get_text_messages(message):
@bot.message_handler(content_types=['text', 'document', 'audio'])
if message.text == "Привет":
bot.send_message(message.from_user.id, "Привет, чем я могу тебе помочь?")
elif message.text == "/help":
bot.send_message(message.from_user.id, "Напиши привет")
else:
bot.send_message(message.from_user.id, "Я тебя не понимаю. Напиши /help.")
bot.polling(none_stop=True, interval=0)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question