From a2f378da57b68429d2ba7df5f6a61ea5240c48b4 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Thu, 25 Jan 2018 11:20:56 +0000 Subject: [PATCH] Only act upon servers for channel create and remove --- discordbot/titanembeds/bot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index dca26a2..6abfa89 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -170,12 +170,14 @@ class Titan(discord.Client): await self.socketio.on_guild_role_update(roleafter) async def on_channel_delete(self, channel): - await self.database.update_guild(channel.server) - await self.socketio.on_channel_delete(channel) + if channel.server: + await self.database.update_guild(channel.server) + await self.socketio.on_channel_delete(channel) async def on_channel_create(self, channel): - await self.database.update_guild(channel.server) - await self.socketio.on_channel_create(channel) + if channel.server: + await self.database.update_guild(channel.server) + await self.socketio.on_channel_create(channel) async def on_channel_update(self, channelbefore, channelafter): await self.database.update_guild(channelafter.server)