From 07de4b3f0c6d173ebf49c683bbcadcc073d677ec Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Tue, 7 Nov 2017 20:19:10 +0000 Subject: [PATCH] update members first then deal with the messages --- discordbot/titanembeds/bot.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index 6d03394..ae1ac8b 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -116,17 +116,17 @@ class Titan(discord.Client): async def on_server_join(self, guild): await self.database.update_guild(guild) - for channel in guild.channels: - if not channel.permissions_for(channel.server.me).read_messages: - continue - async for message in self.logs_from(channel, limit=50, reverse=True): - await self.database.push_message(message) for member in guild.members: await self.database.update_guild_member(member, True, False) if guild.me.server_permissions.ban_members: banned = await self.get_bans(guild) for ban in banned: await self.database.update_guild_member(ban, False, True) + for channel in guild.channels: + if not channel.permissions_for(channel.server.me).read_messages: + continue + async for message in self.logs_from(channel, limit=50, reverse=True): + await self.database.push_message(message) async def on_server_remove(self, guild): await self.database.remove_guild(guild)