From 8e97808ef05346f7f21884cb405c0d86d265609a Mon Sep 17 00:00:00 2001 From: Matthias Nadler Date: Sat, 23 Mar 2019 12:13:05 +0100 Subject: [PATCH] fix for deleted servers --- cogs/poll.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cogs/poll.py b/cogs/poll.py index b63de8b..7ccee57 100644 --- a/cogs/poll.py +++ b/cogs/poll.py @@ -76,6 +76,8 @@ class Poll: self.votes = {} async def is_open(self, update_db=True): + if self.server is None: + return if open and self.duration != 0 \ and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_duration_with_tz(): self.open = False @@ -84,6 +86,8 @@ class Poll: return self.open async def is_active(self, update_db=True): + if self.server is None: + return if not self.active and self.activation != 0 \ and datetime.datetime.utcnow().replace(tzinfo=pytz.utc) > self.get_activation_with_tz(): self.active = True