-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTelebot.py
32 lines (23 loc) · 815 Bytes
/
Telebot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import telebot
from dotenv import load_dotenv
##!/usr/bin/python
# This is a simple echo bot using the decorator mechanism.
# It echoes any incoming text messages.
res = load_dotenv('venv\.env')
if res:
print('yep')
else:
print('no')
bot = telebot.TeleBot(os.environ['BOT_TOKEN'])
# Handle '/start' and '/help'
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
bot.reply_to(message, """\
Hi there, I am EchoBot.
I am here to echo your kind Words back to you. Just say anything nice and I'll say the exact same thing to you!12Wertys34\
""")
# Handle all other messages with content_type 'text' (content_types defaults to ['text'])
@bot.message_handler(func=lambda message: True)
def echo_message(message):
bot.reply_to(message, message.text)
bot.infinity_polling()