diff --git a/shortmute/shortmute.py b/shortmute/shortmute.py index 073ea65..bdb2bc6 100644 --- a/shortmute/shortmute.py +++ b/shortmute/shortmute.py @@ -12,6 +12,7 @@ class Shortmute(commands.Cog): self.config = Config.get_conf(self, identifier=25781647388294, force_registration=True) self.config.register_guild( dm = True, + confirm = True, logging_channels = [], immune_roles = [], blacklisted_users = [] @@ -19,7 +20,7 @@ class Shortmute(commands.Cog): @app_commands.command() @app_commands.rename(target='member') - async def shortmute(self, interaction: discord.Interaction, target: discord.Member, duration: int, reason: str, evidence_link: str = None, evidence_image: discord.Attachment = None, skip_confirmation: bool = True): + async def shortmute(self, interaction: discord.Interaction, target: discord.Member, duration: int, reason: str, evidence_link: str = None, evidence_image: discord.Attachment = None, skip_confirmation: bool = None): """Shortmute someone for up to 30m. Parameters @@ -34,7 +35,7 @@ class Shortmute(commands.Cog): An image link to evidence for the shortmute, do not use with evidence_image evidence_image: discord.Attachment = None An image file used as evidence for the shortmute, do not use with evidence_link - skip_confirmation: bool = True + skip_confirmation: bool = None This allows you skip the confirmation prompt and immediately shortmute the user. """ disable_dateutil() @@ -48,6 +49,8 @@ class Shortmute(commands.Cog): evidence = str(evidence_image) else: evidence = None + if skip_confirmation is None: + skip_confirmation = await self.config.guild(interaction.guild).confirm() passed_info = { "target": target, "timedelta": timedelta, @@ -320,3 +323,20 @@ class Shortmute(commands.Cog): else: await self.config.guild(ctx.guild).dm.set(enabled) await ctx.send(content=f"Shortmute Direct Message setting changed!\nOld value: `{old_value}`\nNew value: `{enabled}`") + + @shortmute_config.command(name='confirmation') + @commands.guild_only() + @commands.admin() + async def shortmute_config_confirmation(self, ctx: commands.Context, enabled: bool = None): + """Manages if /shortmute has a confirmation prompt by default. + + Parameters + ------------ + enabled: bool (optional) + This parameter, if set, will toggle this setting to either True or False.""" + old_value = await self.config.guild(ctx.guild).confirm() + if enabled is None: + await ctx.send(content=f"Shortmute Confirmations are currently {'enabled' if old_value else 'disabled'} by default!") + else: + await self.config.guild(ctx.guild).confirm.set(enabled) + await ctx.send(content=f"Shortmute Confirmation setting changed!\nOld value: `{old_value}`\nNew value: `{enabled}`")