From ede780236985471a8365823ee55a10e401c32495 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Tue, 21 Jul 2020 08:53:16 +0100 Subject: [PATCH] Making sure that it doesn't try to set the guildid if the guild has not set up the modmail system --- cogs/modmail/modmail.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cogs/modmail/modmail.py b/cogs/modmail/modmail.py index ef6c362e..9fd99485 100644 --- a/cogs/modmail/modmail.py +++ b/cogs/modmail/modmail.py @@ -153,6 +153,7 @@ class Modmail(commands.Cog, command_attrs=dict(hidden=True)): # Don't count reactions that are made by the bot if payload.user_id == self.bot.user.id: return + # Don't count other reactions other than ✅ and ❌ elif payload.user_id: if str(payload.emoji) not in ['✅', '❌']: return @@ -172,6 +173,11 @@ class Modmail(commands.Cog, command_attrs=dict(hidden=True)): cursor.execute(select_query, val) result = cursor.fetchone() + # Adding error handling + if result is None: + return + + # Define variables guild_id = int(result[0]) channel_id = int(result[1]) message_id = int(result[2])