misc(aurora): renamed moderationset command

This commit is contained in:
Seaswimmer 2023-12-28 05:45:18 -05:00
parent 77efa6b5c1
commit cd3d581883
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -997,12 +997,12 @@ class Aurora(commands.Cog):
### CONFIGURATION COMMANDS
#######################################################################################################################
@commands.group(autohelp=True, aliases=['modset', 'moderationsettings'])
async def moderationset(self, ctx: commands.Context):
@commands.group(autohelp=True, aliases=['moderationset', 'modset', 'moderationsettings', 'aurorasettings', 'auroraconfig'])
async def auroraset(self, ctx: commands.Context):
"""Manage moderation commands."""
@moderationset.command(name='list', aliases=['view', 'show'])
async def moderationset_list(self, ctx: commands.Context):
@auroraset.command(name='list', aliases=['view', 'show'])
async def auroraset_list(self, ctx: commands.Context):
"""List all moderation settings."""
if ctx.guild:
guild_settings = await config.guild(ctx.guild).all()
@ -1030,28 +1030,28 @@ class Aurora(commands.Cog):
await ctx.send(embed=embed)
@moderationset.group(autohelp=True, name='user')
async def moderationset_user(self, ctx: commands.Context):
@auroraset.group(autohelp=True, name='user')
async def auroraset_user(self, ctx: commands.Context):
"""Manage configurations for user configuration options."""
@moderationset_user.command(name='autoevidence')
async def moderationset_user_autoevidence(self, ctx: commands.Context, enabled: bool):
@auroraset_user.command(name='autoevidence')
async def auroraset_user_autoevidence(self, ctx: commands.Context, enabled: bool):
"""Toggle if the evidenceformat codeblock should be sent automatically."""
await config.user(ctx.author).auto_evidenceformat.set(enabled)
await ctx.send(f"Auto evidenceformat setting set to {enabled}")
@moderationset_user.group(autohelp=True, name='history')
async def moderationset_user_history(self, ctx: commands.Context):
@auroraset_user.group(autohelp=True, name='history')
async def auroraset_user_history(self, ctx: commands.Context):
"""Manage configuration for the /history command."""
@moderationset_user_history.command(name='ephemeral', aliases=['hidden', 'hide'])
async def moderationset_user_history_ephemeral(self, ctx: commands.Context, enabled: bool):
@auroraset_user_history.command(name='ephemeral', aliases=['hidden', 'hide'])
async def auroraset_user_history_ephemeral(self, ctx: commands.Context, enabled: bool):
"""Toggle if the /history command should be ephemeral."""
await config.user(ctx.author).history_ephemeral.set(enabled)
await ctx.send(f"Ephemeral setting set to {enabled}")
@moderationset_user_history.command(name='pagesize')
async def moderationset_user_history_pagesize(self, ctx: commands.Context, pagesize: int):
@auroraset_user_history.command(name='pagesize')
async def auroraset_user_history_pagesize(self, ctx: commands.Context, pagesize: int):
"""Set the amount of cases to display per page."""
if pagesize > 20:
await ctx.send("Pagesize cannot be greater than 20!")
@ -1062,18 +1062,18 @@ class Aurora(commands.Cog):
await config.user(ctx.author).history_pagesize.set(pagesize)
await ctx.send(f"Pagesize set to {await config.user(ctx.author).history_pagesize()}")
@moderationset_user_history.group(name='inline')
async def moderationset_user_history_inline(self, ctx: commands.Context):
@auroraset_user_history.group(name='inline')
async def auroraset_user_history_inline(self, ctx: commands.Context):
"""Manage configuration for the /history command's inline argument."""
@moderationset_user_history_inline.command(name='toggle')
async def moderationset_user_history_inline_toggle(self, ctx: commands.Context, enabled: bool):
@auroraset_user_history_inline.command(name='toggle')
async def auroraset_user_history_inline_toggle(self, ctx: commands.Context, enabled: bool):
"""Enable the /history command's inline argument by default."""
await config.user(ctx.author).history_inline.set(enabled)
await ctx.send(f"Inline setting set to {enabled}")
@moderationset_user_history_inline.command(name='pagesize')
async def moderationset_user_history_inline_pagesize(self, ctx: commands.Context, pagesize: int):
@auroraset_user_history_inline.command(name='pagesize')
async def auroraset_user_history_inline_pagesize(self, ctx: commands.Context, pagesize: int):
"""Set the amount of cases to display per page."""
if pagesize > 20:
await ctx.send("Pagesize cannot be greater than 20!")
@ -1084,32 +1084,32 @@ class Aurora(commands.Cog):
await config.user(ctx.author).history_inline_pagesize.set(pagesize)
await ctx.send(f"Inline pagesize set to {await config.user(ctx.author).history_inline_pagesize()}")
@moderationset.group(autohelp=True, name='guild')
@auroraset.group(autohelp=True, name='guild')
@checks.admin()
async def moderationset_guild(self, ctx: commands.Context):
async def auroraset_guild(self, ctx: commands.Context):
"""Manage default configurations for user configuration options, per guild."""
@moderationset_guild.command(name='autoevidence')
async def moderationset_guild_autoevidence(self, ctx: commands.Context, enabled: bool):
@auroraset_guild.command(name='autoevidence')
async def auroraset_guild_autoevidence(self, ctx: commands.Context, enabled: bool):
"""Toggle if the evidenceformat codeblock should be sent automatically."""
await config.guild(ctx.guild).auto_evidenceformat.set(enabled)
await ctx.send(f"Auto evidenceformat setting set to {enabled}")
@moderationset_guild.group(autohelp=True, name='history')
@auroraset_guild.group(autohelp=True, name='history')
@checks.admin()
async def moderationset_guild_history(self, ctx: commands.Context):
async def auroraset_guild_history(self, ctx: commands.Context):
"""Manage configuration for the /history command."""
@moderationset_guild_history.command(name='ephemeral', aliases=['hidden', 'hide'])
@auroraset_guild_history.command(name='ephemeral', aliases=['hidden', 'hide'])
@checks.admin()
async def moderationset_guild_history_ephemeral(self, ctx: commands.Context, enabled: bool):
async def auroraset_guild_history_ephemeral(self, ctx: commands.Context, enabled: bool):
"""Toggle if the /history command should be ephemeral."""
await config.guild(ctx.guild).history_ephemeral.set(enabled)
await ctx.send(f"Ephemeral setting set to {enabled}")
@moderationset_guild_history.command(name='pagesize')
@auroraset_guild_history.command(name='pagesize')
@checks.admin()
async def moderationset_guild_history_pagesize(self, ctx: commands.Context, pagesize: int):
async def auroraset_guild_history_pagesize(self, ctx: commands.Context, pagesize: int):
"""Set the amount of cases to display per page."""
if pagesize > 20:
await ctx.send("Pagesize cannot be greater than 20!")
@ -1120,21 +1120,21 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).history_pagesize.set(pagesize)
await ctx.send(f"Pagesize set to {await config.guild(ctx.guild).history_pagesize()}")
@moderationset_guild_history.group(name='inline')
@auroraset_guild_history.group(name='inline')
@checks.admin()
async def moderationset_guild_history_inline(self, ctx: commands.Context):
async def auroraset_guild_history_inline(self, ctx: commands.Context):
"""Manage configuration for the /history command's inline argument."""
@moderationset_guild_history_inline.command(name='toggle')
@auroraset_guild_history_inline.command(name='toggle')
@checks.admin()
async def moderationset_guild_history_inline_toggle(self, ctx: commands.Context, enabled: bool):
async def auroraset_guild_history_inline_toggle(self, ctx: commands.Context, enabled: bool):
"""Enable the /history command's inline argument by default."""
await config.guild(ctx.guild).history_inline.set(enabled)
await ctx.send(f"Inline setting set to {enabled}")
@moderationset_guild_history_inline.command(name='pagesize')
@auroraset_guild_history_inline.command(name='pagesize')
@checks.admin()
async def moderationset_guild_history_inline_pagesize(self, ctx: commands.Context, pagesize: int):
async def auroraset_guild_history_inline_pagesize(self, ctx: commands.Context, pagesize: int):
"""Set the amount of cases to display per page."""
if pagesize > 20:
await ctx.send("Pagesize cannot be greater than 20!")
@ -1145,14 +1145,14 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).history_inline_pagesize.set(pagesize)
await ctx.send(f"Inline pagesize set to {await config.guild(ctx.guild).history_inline_pagesize()}")
@moderationset.group(autohelp=True, name='immunity')
@auroraset.group(autohelp=True, name='immunity')
@checks.admin()
async def moderationset_immunity(self, ctx: commands.Context):
async def auroraset_immunity(self, ctx: commands.Context):
"""Manage configuration for immune roles."""
@moderationset_immunity.command(name='add')
@auroraset_immunity.command(name='add')
@checks.admin()
async def moderationset_immunity_add(self, ctx: commands.Context, role: discord.Role):
async def auroraset_immunity_add(self, ctx: commands.Context, role: discord.Role):
"""Add a role to the immune roles list."""
immune_roles: list = await config.guild(ctx.guild).immune_roles()
if role.id in immune_roles:
@ -1162,9 +1162,9 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).immune_roles.set(immune_roles)
await ctx.send(f"Role {role.name} added to immune roles.")
@moderationset_immunity.command(name='remove')
@auroraset_immunity.command(name='remove')
@checks.admin()
async def moderationset_immunity_remove(self, ctx: commands.Context, role: discord.Role):
async def auroraset_immunity_remove(self, ctx: commands.Context, role: discord.Role):
"""Remove a role from the immune roles list."""
immune_roles: list = await config.guild(ctx.guild).immune_roles()
if role.id not in immune_roles:
@ -1174,9 +1174,9 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).immune_roles.set(immune_roles)
await ctx.send(f"Role {role.name} removed from immune roles.")
@moderationset_immunity.command(name='list')
@auroraset_immunity.command(name='list')
@checks.admin()
async def moderationset_immunity_list(self, ctx: commands.Context):
async def auroraset_immunity_list(self, ctx: commands.Context):
"""List all immune roles."""
immune_roles: list = await config.guild(ctx.guild).immune_roles()
if not immune_roles:
@ -1191,14 +1191,14 @@ class Aurora(commands.Cog):
embed = discord.Embed(title="Immune Roles", description=role_list, color=await self.bot.get_embed_color(None))
await ctx.send(embed=embed)
@moderationset.group(autohelp=True, name='blacklist')
@auroraset.group(autohelp=True, name='blacklist')
@checks.admin()
async def moderationset_blacklist(self, ctx: commands.Context):
async def auroraset_blacklist(self, ctx: commands.Context):
"""Manage configuration for the /blacklist command."""
@moderationset_blacklist.command(name='add')
@auroraset_blacklist.command(name='add')
@checks.admin()
async def moderationset_blacklist_add(self, ctx: commands.Context, role: discord.Role, duration: str):
async def auroraset_blacklist_add(self, ctx: commands.Context, role: discord.Role, duration: str):
"""Add a role to the blacklist."""
blacklist_roles: list = await config.guild(ctx.guild).blacklist_roles()
for blacklist_role in blacklist_roles:
@ -1221,9 +1221,9 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).blacklist_roles.set(blacklist_roles)
await ctx.send(f"Role {role.mention} added as a blacklist type.", allowed_mentions=discord.AllowedMentions.none())
@moderationset_blacklist.command(name='remove')
@auroraset_blacklist.command(name='remove')
@checks.admin()
async def moderationset_blacklist_remove(self, ctx: commands.Context, role: discord.Role):
async def auroraset_blacklist_remove(self, ctx: commands.Context, role: discord.Role):
"""Remove a role's blacklist type."""
blacklist_roles: list = await config.guild(ctx.guild).blacklist_roles()
for blacklist_role in blacklist_roles:
@ -1234,9 +1234,9 @@ class Aurora(commands.Cog):
return
await ctx.send("Role does not have an associated blacklist type!")
@moderationset_blacklist.command(name='list')
@auroraset_blacklist.command(name='list')
@checks.admin()
async def moderationset_blacklist_list(self, ctx: commands.Context):
async def auroraset_blacklist_list(self, ctx: commands.Context):
"""List all blacklist types."""
blacklist_roles: list = await config.guild(ctx.guild).blacklist_roles()
if not blacklist_roles:
@ -1251,32 +1251,32 @@ class Aurora(commands.Cog):
embed = discord.Embed(title="Blacklist Types", description=blacklist_list, color=await self.bot.get_embed_color(None))
await ctx.send(embed=embed)
@moderationset.command(name="ignorebots")
@auroraset.command(name="ignorebots")
@checks.admin()
async def moderationset_ignorebots(self, ctx: commands.Context):
async def auroraset_ignorebots(self, ctx: commands.Context):
"""Toggle if the cog should ignore other bots' moderations."""
await config.guild(ctx.guild).ignore_other_bots.set(not await config.guild(ctx.guild).ignore_other_bots())
await ctx.send(f"Ignore bots setting set to {await config.guild(ctx.guild).ignore_other_bots()}")
@moderationset.command(name="dm")
@auroraset.command(name="dm")
@checks.admin()
async def moderationset_dm(self, ctx: commands.Context):
async def auroraset_dm(self, ctx: commands.Context):
"""Toggle automatically messaging moderated users.
This option can be overridden by specifying the `silent` argument in any moderation command."""
await config.guild(ctx.guild).dm_users.set(not await config.guild(ctx.guild).dm_users())
await ctx.send(f"DM users setting set to {await config.guild(ctx.guild).dm_users()}")
@moderationset.command(name="permissions")
@auroraset.command(name="permissions")
@checks.admin()
async def moderationset_permissions(self, ctx: commands.Context):
async def auroraset_permissions(self, ctx: commands.Context):
"""Toggle whether the bot will check for discord permissions."""
await config.guild(ctx.guild).use_discord_permissions.set(not await config.guild(ctx.guild).use_discord_permissions())
await ctx.send(f"Use Discord Permissions setting set to {await config.guild(ctx.guild).use_discord_permissions()}")
@moderationset.command(name="logchannel")
@auroraset.command(name="logchannel")
@checks.admin()
async def moderationset_logchannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
async def auroraset_logchannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
"""Set a channel to log infractions to."""
if channel:
await config.guild(ctx.guild).log_channel.set(channel.id)
@ -1285,14 +1285,14 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).log_channel.set(" ")
await ctx.send("Logging channel disabled.")
@moderationset.group(autohelp=True, name='import')
@auroraset.group(autohelp=True, name='import')
@checks.admin()
async def moderationset_import(self, ctx: commands.Context):
async def auroraset_import(self, ctx: commands.Context):
"""Import moderations from other bots."""
@moderationset_import.command(name="aurora")
@auroraset_import.command(name="aurora")
@checks.admin()
async def moderationset_import_aurora(self, ctx: commands.Context):
async def auroraset_import_aurora(self, ctx: commands.Context):
"""Import moderations from another bot using Aurora."""
if ctx.message.attachments and ctx.message.attachments[0].content_type == 'application/json; charset=utf-8':
message = await ctx.send("Are you sure you want to import moderations from another bot?\n**This will overwrite any moderations that already exist in this guild's moderation table.**\n*The import process will block the rest of your bot until it is complete.*")
@ -1300,9 +1300,9 @@ class Aurora(commands.Cog):
else:
await ctx.send("Please provide a valid Aurora export file.")
@moderationset_import.command(name="galacticbot")
@auroraset_import.command(name="galacticbot")
@checks.admin()
async def moderationset_import_galacticbot(self, ctx: commands.Context):
async def auroraset_import_galacticbot(self, ctx: commands.Context):
"""Import moderations from GalacticBot."""
if ctx.message.attachments and ctx.message.attachments[0].content_type == 'application/json; charset=utf-8':
message = await ctx.send("Are you sure you want to import GalacticBot moderations?\n**This will overwrite any moderations that already exist in this guild's moderation table.**\n*The import process will block the rest of your bot until it is complete.*")