feat: made skip_confirmation's default value configurable
This commit is contained in:
parent
ae972376bb
commit
4bd296d52a
1 changed files with 22 additions and 2 deletions
|
@ -12,6 +12,7 @@ class Shortmute(commands.Cog):
|
||||||
self.config = Config.get_conf(self, identifier=25781647388294, force_registration=True)
|
self.config = Config.get_conf(self, identifier=25781647388294, force_registration=True)
|
||||||
self.config.register_guild(
|
self.config.register_guild(
|
||||||
dm = True,
|
dm = True,
|
||||||
|
confirm = True,
|
||||||
logging_channels = [],
|
logging_channels = [],
|
||||||
immune_roles = [],
|
immune_roles = [],
|
||||||
blacklisted_users = []
|
blacklisted_users = []
|
||||||
|
@ -19,7 +20,7 @@ class Shortmute(commands.Cog):
|
||||||
|
|
||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
@app_commands.rename(target='member')
|
@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.
|
"""Shortmute someone for up to 30m.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@ -34,7 +35,7 @@ class Shortmute(commands.Cog):
|
||||||
An image link to evidence for the shortmute, do not use with evidence_image
|
An image link to evidence for the shortmute, do not use with evidence_image
|
||||||
evidence_image: discord.Attachment = None
|
evidence_image: discord.Attachment = None
|
||||||
An image file used as evidence for the shortmute, do not use with evidence_link
|
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.
|
This allows you skip the confirmation prompt and immediately shortmute the user.
|
||||||
"""
|
"""
|
||||||
disable_dateutil()
|
disable_dateutil()
|
||||||
|
@ -48,6 +49,8 @@ class Shortmute(commands.Cog):
|
||||||
evidence = str(evidence_image)
|
evidence = str(evidence_image)
|
||||||
else:
|
else:
|
||||||
evidence = None
|
evidence = None
|
||||||
|
if skip_confirmation is None:
|
||||||
|
skip_confirmation = await self.config.guild(interaction.guild).confirm()
|
||||||
passed_info = {
|
passed_info = {
|
||||||
"target": target,
|
"target": target,
|
||||||
"timedelta": timedelta,
|
"timedelta": timedelta,
|
||||||
|
@ -320,3 +323,20 @@ class Shortmute(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await self.config.guild(ctx.guild).dm.set(enabled)
|
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}`")
|
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}`")
|
||||||
|
|
Loading…
Reference in a new issue