class Bot: def __init__(self): self.commands = Commands().initialize() self.scheduler = Scheduler().initialize() def start(self): self.scheduler.start() self.commands.start()
def init(bot: Bot, u: Updater): global updater updater = u global scheduler scheduler = Scheduler(database, updater) for user in database.users: for name in database.reqs[user]: if database.reqs[user][name]['enabled']: scheduler.start(user, name)
def set_schedule(interval, unit): Scheduler.start(interval, unit)
def open_ui(): eel.init('web') eel.start('index.html', port=8686) def run_systray_icon(): icon = pystray.Icon('test name') icon.title = APP_NAME icon.icon = Image.open(resource_path('src/icon.png')) icon.menu = pystray.Menu( pystray.MenuItem(text='Options', action=open_ui, default=True), pystray.MenuItem(text='Next photo', action=Options.set_wallpaper_next), pystray.MenuItem(text='Previous photo', action=Options.set_wallpaper_prev), pystray.MenuItem(text='Random photo', action=Options.set_wallpaper_random)) icon.run() if __name__ == '__main__': print('running') time.sleep(1) Scheduler.start() # # ui = threading.Thread(target = open_ui) # # ui.start() run_systray_icon()