fix for deleted servers

This commit is contained in:
Matthias Nadler 2019-03-23 12:08:45 +01:00
parent ccc7546765
commit 9607a98013
2 changed files with 6 additions and 2 deletions

View File

@ -856,7 +856,10 @@ class Poll:
self.server = self.bot.get_server(str(d['server_id']))
self.channel = self.bot.get_channel(str(d['channel_id']))
# self.author = await self.bot.get_user_info(str(d['author']))
if self.server:
self.author = self.server.get_member(d['author'])
else:
self.author = None
self.name = d['name']
self.short = d['short']
self.anonymous = d['anonymous']

View File

@ -54,9 +54,10 @@ class PollControls:
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)
except AttributeError:
except AttributeError as ae:
#Database not loaded yet
logger.warning("Attribute Error in close_polls loop")
logger.exception(ae)
pass
except:
#Never break this loop due to an error