-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
29 lines (26 loc) · 841 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
from dotenv import load_dotenv
import os
import modules as bot_modules
import schedules as bot_schedules
from utils.init import init
from telegram.ext import Updater
load_dotenv()
def main():
updater = Updater(os.getenv("BOTTOKEN"), use_context=True)
dispatcher = updater.dispatcher
queue = updater.job_queue
for plugin in bot_modules.__all__:
if plugin.enabled:
plugin.load()
for handler in plugin.handlers:
dispatcher.add_handler(handler)
for schedule in bot_schedules.__all__:
if schedule.enabled:
schedule.load()
for job in schedule.jobs:
queue.run_repeating(job["callback"], interval=job["interval"], first=job["first"])
updater.start_polling()
updater.idle()
if __name__ == "__main__":
init()
main()