-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.py
More file actions
43 lines (29 loc) · 1.2 KB
/
main.py
File metadata and controls
43 lines (29 loc) · 1.2 KB
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
33
34
35
36
37
38
39
40
41
42
43
import logging
import telegram
from telegram.ext import CommandHandler, MessageHandler, Filters, Updater
from secrets import BOT_TOKEN
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
def start(bot, update):
bot.send_message(chat_id=update.message.chat_id,
text="Hi there, I am EventBoy, your errand boy for your events!\n\n"
+ "Choose /help if you are unsure how to proceed!")
def help(bot, update, args):
help_text = "/start\n/help\n/baba\n/ali"
if args:
help_text = help_text[:18]
bot.send_message(chat_id=update.message.chat_id,
text=help_text)
def echo(bot, update):
bot.send_message(chat_id=update.message.chat_id,
text=update.message.text)
updater = Updater(token=BOT_TOKEN)
dispatcher = updater.dispatcher
start_handler = CommandHandler('start', start)
help_handler = CommandHandler('help', help, pass_args=True)
echo_handler = MessageHandler(Filters.text, echo)
dispatcher.add_handler(start_handler)
dispatcher.add_handler(help_handler)
dispatcher.add_handler(echo_handler)
updater.start_polling()
updater.idle()