From e3273ea0814c3b6a0ae98032b9da23d2a63bc5b8 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Fri, 2 Jul 2021 01:06:00 -0600 Subject: [PATCH] Add modlog setting for eventual modlog command --- jarvis/cogs/settings.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/jarvis/cogs/settings.py b/jarvis/cogs/settings.py index 80638ff..0e6c25a 100644 --- a/jarvis/cogs/settings.py +++ b/jarvis/cogs/settings.py @@ -1,6 +1,6 @@ import discord import jarvis -from discord import Role +from discord import Role, TextChannel from discord.ext import commands from discord_slash import cog_ext from discord_slash.utils.manage_commands import create_option @@ -45,6 +45,27 @@ class SettingsCog(commands.Cog): self.update_settings("mute", role.id, ctx.guild.id) await ctx.send(f"Settings applied. New mute role is `{role.name}`") + @cog_ext.cog_subcommand( + base="settings", + name="modlog", + description="Set modlog channel", + options=[ + create_option( + name="channel", + description="Modlog channel", + option_type=7, + required=True, + ) + ], + ) + @admin_or_permissions(mute_members=True) + async def _modlog(self, ctx, channel: TextChannel): + await ctx.defer() + self.update_settings("modlog", channel.id, ctx.guild.id) + await ctx.send( + f"Settings applied. New modlog channel is `{channel.name}`" + ) + def setup(bot): bot.add_cog(SettingsCog(bot))