Skip to content

Commit

Permalink
Merge pull request #6678 from bevnign/patch-7
Browse files Browse the repository at this point in the history
Create telegrambot.py
  • Loading branch information
ossamamehmood authored Oct 31, 2023
2 parents 41c2929 + da63b08 commit 07e2c9c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Add Code Here/PYTHON/telegrambot.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 07e2c9c

Please sign in to comment.