-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (28 loc) · 812 Bytes
/
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
33
34
35
36
37
38
39
""" Main application """
import os
from dotenv import load_dotenv
from puzzle import PluginCollection
from puzzle import Tools
# Load .env file
load_dotenv()
# Init main function
def main():
""" main function that runs the application """
# Create tools
tools = Tools()
# Init telegram
tools.set_telegram(os.getenv('TELEGRAM_TOKEN') or None)
# Init webhook
www_host = os.getenv('WEBHOOK_HOST') or '0.0.0.0'
www_port = os.getenv('WEBHOOK_PORT') or '8080'
tools.set_webhook(www_host, www_port)
# Link all plugins
my_plugins = PluginCollection('plugins', tools)
my_plugins.start_all_plugins()
# Start telegram bot
tools.telegram.start()
# Start webserver
tools.webhook.start()
# Start main function
if __name__ == '__main__':
main()