diff --git a/bots/models.py b/bots/models.py index d23af66..bd94536 100644 --- a/bots/models.py +++ b/bots/models.py @@ -40,7 +40,8 @@ class TelegramBot(models.Model): return dispatcher def run_periodic_task(self): - if not hasattr(self.config, 'periodic_task') or not self.periodic_interval or \ + if not self.active or \ + not hasattr(self.config, 'periodic_task') or not self.periodic_interval or \ (self.periodic_last_run and self.periodic_last_run > timezone.now() - self.periodic_interval): return self.config.periodic_task(self.get_bot())