From 1f49a8996374ada4535047769e1b884fa5b6386a Mon Sep 17 00:00:00 2001 From: Eibe Date: Mon, 29 Jun 2020 13:50:01 +0200 Subject: [PATCH] Fix wrong db errors --- bot.py | 2 +- core/database.py | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bot.py b/bot.py index 50d9197e..fe051dea 100644 --- a/bot.py +++ b/bot.py @@ -361,7 +361,7 @@ async def on_message(message): if error and system_channel: await message.channel.send( "I could not commit the changes to the database. Check" - f" {system_channel.mention} for more information." + f" the system channel for more information." ) await system_notification( message.channel.id, diff --git a/core/database.py b/core/database.py index 4365f7d1..eeb0fd08 100644 --- a/core/database.py +++ b/core/database.py @@ -84,16 +84,15 @@ def commit(self): conn = sqlite3.connect(self.database) cursor = conn.cursor() cursor.execute( - "INSERT INTO 'messages' ('message_id', 'channel', 'reactionrole_id')" - " values(?, ?, ?);", - (self.message_id, self.target_channel, self.reactionrole_id), + "INSERT INTO 'messages' ('message_id', 'channel', 'reactionrole_id', 'guild_id')" + " values(?, ?, ?, ?);", + (self.message_id, self.target_channel, self.reactionrole_id, self.guild), ) for reaction in self.combos: role_id = self.combos[reaction] cursor.execute( - "INSERT INTO 'reactionroles' ('reactionrole_id', 'reaction', 'role_id'," - " 'guild_id') values(?, ?, ?, ?);", - (self.reactionrole_id, reaction, role_id, self.guild), + "INSERT INTO 'reactionroles' ('reactionrole_id', 'reaction', 'role_id') values(?, ?, ?);", + (self.reactionrole_id, reaction, role_id), ) conn.commit() cursor.close()