fix for deleted servers

This commit is contained in:
Matthias Nadler 2019-03-23 12:26:20 +01:00
parent f140fd4c91
commit 81a9599997

View File

@ -45,8 +45,11 @@ class PollControls:
if not p.server: if not p.server:
continue continue
if p.active: if p.active:
try:
await self.bot.send_message(p.channel, 'This poll has been scheduled and is active now!') await self.bot.send_message(p.channel, 'This poll has been scheduled and is active now!')
await p.post_embed(destination=p.channel) await p.post_embed(destination=p.channel)
except:
continue
query = self.bot.db.polls.find({'open': True, 'duration': {"$not": re.compile("0")}}) query = self.bot.db.polls.find({'open': True, 'duration': {"$not": re.compile("0")}})
if query: if query:
@ -56,8 +59,11 @@ class PollControls:
if not p.server: if not p.server:
continue continue
if not p.open: if not p.open:
try:
await self.bot.send_message(p.channel, 'This poll has reached the deadline and is closed!') await self.bot.send_message(p.channel, 'This poll has reached the deadline and is closed!')
await p.post_embed(destination=p.channel) await p.post_embed(destination=p.channel)
except:
continue
except AttributeError as ae: except AttributeError as ae:
#Database not loaded yet #Database not loaded yet
logger.warning("Attribute Error in close_polls loop") logger.warning("Attribute Error in close_polls loop")