Making sure that it doesn't try to set the guildid if the guild has not set up the modmail system

pull/8/head
sgoudham 4 years ago
parent 1f0452c18f
commit ede7802369

@ -153,6 +153,7 @@ class Modmail(commands.Cog, command_attrs=dict(hidden=True)):
# Don't count reactions that are made by the bot # Don't count reactions that are made by the bot
if payload.user_id == self.bot.user.id: if payload.user_id == self.bot.user.id:
return return
# Don't count other reactions other than ✅ and ❌
elif payload.user_id: elif payload.user_id:
if str(payload.emoji) not in ['', '']: if str(payload.emoji) not in ['', '']:
return return
@ -172,6 +173,11 @@ class Modmail(commands.Cog, command_attrs=dict(hidden=True)):
cursor.execute(select_query, val) cursor.execute(select_query, val)
result = cursor.fetchone() result = cursor.fetchone()
# Adding error handling
if result is None:
return
# Define variables
guild_id = int(result[0]) guild_id = int(result[0])
channel_id = int(result[1]) channel_id = int(result[1])
message_id = int(result[2]) message_id = int(result[2])

Loading…
Cancel
Save