From 81a95999974d79a1f098f68fa88332cdc8e63079 Mon Sep 17 00:00:00 2001 From: Matthias Nadler Date: Sat, 23 Mar 2019 12:26:20 +0100 Subject: [PATCH] fix for deleted servers --- cogs/poll_controls.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cogs/poll_controls.py b/cogs/poll_controls.py index 15f602f..5dcb959 100644 --- a/cogs/poll_controls.py +++ b/cogs/poll_controls.py @@ -45,8 +45,11 @@ class PollControls: if not p.server: continue if p.active: - await self.bot.send_message(p.channel, 'This poll has been scheduled and is active now!') - await p.post_embed(destination=p.channel) + try: + await self.bot.send_message(p.channel, 'This poll has been scheduled and is active now!') + await p.post_embed(destination=p.channel) + except: + continue query = self.bot.db.polls.find({'open': True, 'duration': {"$not": re.compile("0")}}) if query: @@ -56,8 +59,11 @@ class PollControls: if not p.server: continue if not p.open: - await self.bot.send_message(p.channel, 'This poll has reached the deadline and is closed!') - await p.post_embed(destination=p.channel) + try: + await self.bot.send_message(p.channel, 'This poll has reached the deadline and is closed!') + await p.post_embed(destination=p.channel) + except: + continue except AttributeError as ae: #Database not loaded yet logger.warning("Attribute Error in close_polls loop")