-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
32 lines (24 loc) · 1.01 KB
/
main.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 os
from dotenv import load_dotenv
from health_ping import HealthPing
from telegram.ext import Application, CommandHandler, MessageHandler, filters
from submodules.user_input import show_help, get_input
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
load_dotenv(dotenv_path)
if os.getenv("HEALTHCHECKS_ENDPOINT"):
HealthPing(url=os.getenv("HEALTHCHECKS_ENDPOINT"),
schedule="1 * * * *",
retries=[60, 300, 720]).start()
def main():
"""
Handles the initial launch of the program (entry point).
"""
token = os.getenv("BOT_TOKEN")
application = Application.builder().token(token).concurrent_updates(True).read_timeout(30).write_timeout(30).build() # noqa
application.add_handler(CommandHandler('start', show_help))
application.add_handler(CommandHandler('help', show_help))
application.add_handler(MessageHandler(filters.TEXT, get_input))
print("TeleQR instance started!")
application.run_polling()
if __name__ == '__main__':
main()