def update_cache(self): Logger.log_debug('Updating cache') self.message_handlers.update() self.button_handlers.update() self.tick_handlers.update() Cache.store_cache() Config.store_config(self)
def start(self): """ Start the bot. """ self.updater.start_polling() # Set up the tick trigger self.dispatcher.job_queue.run_repeating( self.on_receive_tick, timedelta(minutes=1), first=timedelta(seconds=60 - datetime.now().second)) self.dispatcher.job_queue.run_repeating( lambda b, j, self=self: self.update_cache(), timedelta(days=1), first=timedelta(hours=24 - datetime.now().hour)) Logger.log_info('%s started' % self.bot.first_name) Cache.store_cache() Config.store_config(self) self.updater.idle()
def on_exit(self): Logger.log_info(msg='Shutting down') Cache.store_cache() Config.store_config(self)