fix for deleted servers

This commit is contained in:
Matthias Nadler 2019-03-23 12:20:56 +01:00
parent c2542b0840
commit f140fd4c91

View File

@ -42,6 +42,8 @@ class PollControls:
for pd in [poll async for poll in query]: for pd in [poll async for poll in query]:
p = Poll(self.bot, load=True) p = Poll(self.bot, load=True)
await p.from_dict(pd) await p.from_dict(pd)
if not p.server:
continue
if p.active: if p.active:
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)
@ -51,6 +53,8 @@ class PollControls:
for pd in [poll async for poll in query]: for pd in [poll async for poll in query]:
p = Poll(self.bot, load=True) p = Poll(self.bot, load=True)
await p.from_dict(pd) await p.from_dict(pd)
if not p.server:
continue
if not p.open: if not p.open:
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)