diff --git a/Add Code Here/PYTHON/telegrambot.py b/Add Code Here/PYTHON/telegrambot.py new file mode 100644 index 00000000000..f8b5ff40866 --- /dev/null +++ b/Add Code Here/PYTHON/telegrambot.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +import telebot + +bot = telebot.TeleBot("830686394:AAEhR8rx4YHxhQfh7L7msuhyK7-FiRu1gU4") + +@bot.message_handler(content_types=["text"]) +def handle_text(message): + if message.text == "Hi": + bot.send_message(message.from_user.id, "Hello! I'm in test mode. What' up?") + + elif message.text == "How are you?" or message.text == "How are u?": + bot.send_message(message.from_user.id, "I'm fine, thanks. And you?") + + else: + bot.send_message(message.from_user.id, "Sorry, i dont understand you.") + +bot.polling(none_stop=True, interval=0) + +# Обработчик команд '/start' и '/help'. +@bot.message_handler(commands=['start', 'help']) +def handle_start_help(message): + pass + + # Обработчик для документов и аудиофайлов +@bot.message_handler(content_types=['document', 'audio']) +def handle_document_audio(message): + pass + +bot.polling(none_stop=True, interval=0)