-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.py
35 lines (30 loc) · 1.19 KB
/
bot.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
33
34
35
# import the Telegram API token from config.py
from config import TELEGRAM_API_TOKEN
import logging
# import the required Telegram modules
from telegram.ext import (
ApplicationBuilder,
filters,
CommandHandler,
MessageHandler
)
# import the required module
from modules.commands import *
logging.basicConfig(level=logging.WARN)
if __name__ == '__main__':
# we start the bot application
application = ApplicationBuilder().token(TELEGRAM_API_TOKEN).build()
# entry command for all private chats
application.add_handler(CommandHandler('start', start))
# all handlers to get the Bible text [/get, /getBible, /Bible]
application.add_handler(CommandHandler('get', get))
application.add_handler(CommandHandler('getbible', get))
application.add_handler(CommandHandler('bible', get))
# the search handle
application.add_handler(CommandHandler('search', search))
# the help handle
application.add_handler(CommandHandler('help', bot_help))
# add a message handler to handle unknown commands or messages
application.add_handler(MessageHandler(filters.ALL, unknown))
# start polling for now (will add webhook later)
application.run_polling()