Updating commentary

pull/8/head
sgoudham 4 years ago
parent f9498302f4
commit 8f97cb51cd

@ -168,9 +168,10 @@ class Modmail(commands.Cog):
@has_permissions(manage_guild=True) @has_permissions(manage_guild=True)
@bot_has_permissions(administrator=True) @bot_has_permissions(administrator=True)
async def setup(self, ctx, channelID: int): async def setup(self, ctx, channelID: int):
"""Setup Modmail System through inputting ChannelID """
of the Modmail Channel and the Channel you want the Modmail Setup Modmail System
to be logged to""" Input the ID of the Channel where the Modmail will be sent
"""
# Retrieve a list of channel id's in the guild # Retrieve a list of channel id's in the guild
channels = [channel.id for channel in ctx.guild.channels] channels = [channel.id for channel in ctx.guild.channels]
@ -263,7 +264,10 @@ class Modmail(commands.Cog):
@has_permissions(manage_guild=True) @has_permissions(manage_guild=True)
@bot_has_permissions(administrator=True) @bot_has_permissions(administrator=True)
async def update(self, ctx, channelID: int): async def update(self, ctx, channelID: int):
"""Update the Channel that the Modmail is logged to""" """
Update the Channel that the Modmail is logged to
Input the ID of the New Channel
"""
# Retrieve a list of channel id's in the guild # Retrieve a list of channel id's in the guild
channels = [channel.id for channel in ctx.guild.channels] channels = [channel.id for channel in ctx.guild.channels]
@ -290,9 +294,11 @@ class Modmail(commands.Cog):
try: try:
# Store the information within the database # Store the information within the database
with db.connection() as conn: with db.connection() as conn:
# Define the insert statement that will insert information about the modmail channel
# Define the update statement that will insert information about the modmail channel
update_query = """UPDATE moderatormail SET modmailChannelID = (?) WHERE guildID = (?)""" update_query = """UPDATE moderatormail SET modmailChannelID = (?) WHERE guildID = (?)"""
vals = channelID, ctx.author.guild.id vals = channelID, ctx.author.guild.id
with closing(conn.cursor()) as cursor: with closing(conn.cursor()) as cursor:
# Execute the SQL Query # Execute the SQL Query
cursor.execute(update_query, vals) cursor.execute(update_query, vals)
@ -300,9 +306,9 @@ class Modmail(commands.Cog):
except mariadb.Error as err: except mariadb.Error as err:
print(err) print(err)
await ctx.send("**Looks like something went wrong during the update!" await ctx.send("**Looks like something went wrong during the update!**")
"\nMake sure that the Channel ID is correct!**")
# Send confirmation that the channel has been updated
channel = ctx.author.guild.get_channel(channelID) channel = ctx.author.guild.get_channel(channelID)
await ctx.send( await ctx.send(
f"**The channel has been updated! Your new modmail will be sent to** {channel.mention}") f"**The channel has been updated! Your new modmail will be sent to** {channel.mention}")
@ -316,7 +322,7 @@ class Modmail(commands.Cog):
@has_permissions(manage_guild=True) @has_permissions(manage_guild=True)
@bot_has_permissions(administrator=True) @bot_has_permissions(administrator=True)
async def delete(self, ctx): async def delete(self, ctx):
"""Delete the entire Modmail System from the Guild""" """Delete the Entire Modmail System from the Guild"""
# Checking if the guild already exists within the database # Checking if the guild already exists within the database
with db.connection() as conn: with db.connection() as conn:

Loading…
Cancel
Save