From c35743b498c10cec9273da6131096f854465029b Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 25 Mar 2018 05:57:00 +0000 Subject: [PATCH] JustDelete the message instead of iterating during guild remove --- discordbot/titanembeds/database/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/discordbot/titanembeds/database/__init__.py b/discordbot/titanembeds/database/__init__.py index 353588a..47cabd5 100644 --- a/discordbot/titanembeds/database/__init__.py +++ b/discordbot/titanembeds/database/__init__.py @@ -152,9 +152,7 @@ class DatabaseInterface(object): with self.get_session() as session: gui = session.query(Guilds).filter(Guilds.guild_id == int(guild.id)).first() if gui: - dbmsgs = session.query(Messages).filter(Messages.guild_id == int(guild.id)).all() - for msg in dbmsgs: - session.delete(msg) + dbmsgs = session.query(Messages).filter(Messages.guild_id == int(guild.id)).delete() session.delete(gui) session.commit()