from threading import Thread from time import time from os import getpid, path from modules.birthdays import check_birthdays from modules.utils import * from modules.inline import * from schedule import run_pending, every from app import app from modules.commands_register import commands_register from pyrogram import idle pid = getpid() # Importing from modules.commands.application import * from modules.commands.applications import * from modules.commands.message import * from modules.commands.reapply import * from modules.commands.reboot import * from modules.commands.rules import * from modules.commands.sponsorship import * from modules.commands.start import * from modules.commands.warn import * from modules.commands.warnings import * from modules.callbacks.nothing import * from modules.callbacks.reapply import * from modules.callbacks.rules import * from modules.callbacks.sub import * from modules.callbacks.sus import * from modules.handlers.confirmation import * from modules.handlers.contact import * from modules.handlers.group_join import * from modules.handlers.welcome import * from modules.handlers.everything import * if __name__ == "__main__": logWrite(f"Starting up with pid {pid}") # Yes, it should be in some kind of async main() function but I don't give a shit. # I did compare performance, almost no difference and it's much more useful this way. Change my mind. app.start() if configGet("birthdays_notify"): every().day.at(configGet("birthdays_time")).do(check_birthdays, app) # Background tasks checker def background_task(): try: while True: try: run_pending() #print('Checked') time.sleep(1) except: pass except KeyboardInterrupt: print('\nShutting down') killProc(pid) t = Thread(target=background_task) t.start() app.send_message(configGet("owner"), f"Starting up with pid `{pid}`") commands_register(app) idle() app.send_message(configGet("owner"), f"Shutting with pid `{pid}`") app.stop() killProc(pid)