fix(moderation): fixed moderationset
Some checks failed
Pylint / Pylint (3.10) (push) Has been cancelled

This commit is contained in:
Seaswimmer 2023-12-14 17:26:06 -05:00
parent fa2c7d5b9c
commit c99d8c5bf1
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -1142,51 +1142,47 @@ class Moderation(commands.Cog):
async def moderationset(self, ctx: commands.Context): async def moderationset(self, ctx: commands.Context):
"""Manage moderation commands.""" """Manage moderation commands."""
@commands.group(autohelp=True) @moderationset.group(autohelp=True, name='history')
async def moderationset_history(self, ctx: commands.Context): async def moderationset_history(self, ctx: commands.Context):
"""Manage configuration for the `/history` command.""" """Manage configuration for the /history command."""
@commands.group(autohelp=True) @moderationset_history.command(name='ephemeral', aliases=['hidden', 'hide'])
async def moderationset_history_user(self, ctx: commands.Context):
"""Manage configuration for the `/history` command, per user."""
@moderationset_history_user.command(name='ephemeral', aliases=['hidden', 'hide'])
async def moderationset_history_user_ephemeral(self, ctx: commands.Context): async def moderationset_history_user_ephemeral(self, ctx: commands.Context):
"""Toggle if the `/history` command should be ephemeral.""" """Toggle if the /history command should be ephemeral."""
await self.config.user(ctx.author).history_ephemeral.set(not await self.config.user(ctx.author).ephemeral()) await self.config.user(ctx.author).history_ephemeral.set(not await self.config.user(ctx.author).ephemeral())
await ctx.send(f"Ephemeral setting set to {await self.config.user(ctx.author).ephemeral()}") await ctx.send(f"Ephemeral setting set to {await self.config.user(ctx.author).ephemeral()}")
@moderationset_history_user.command(name='pagesize') @moderationset_history.command(name='pagesize')
async def moderationset_history_user_pagesize(self, ctx: commands.Context, pagesize: int): async def moderationset_history_user_pagesize(self, ctx: commands.Context, pagesize: int):
"""Set the amount of cases to display per page.""" """Set the amount of cases to display per page."""
await self.config.user(ctx.author).history_pagesize.set(pagesize) await self.config.user(ctx.author).history_pagesize.set(pagesize)
await ctx.send(f"Pagesize set to {await self.config.user(ctx.author).history_pagesize()}") await ctx.send(f"Pagesize set to {await self.config.user(ctx.author).history_pagesize()}")
@moderationset_history_user.group(name='inline') @moderationset_history.group(name='inline')
async def moderationset_history_user_inline(self, ctx: commands.Context): async def moderationset_history_inline(self, ctx: commands.Context):
"""Manage configuration for the `/history` command's inline argument.""" """Manage configuration for the /history command's inline argument."""
@moderationset_history_user_inline.command(name='toggle') @moderationset_history_inline.command(name='toggle')
async def moderationset_history_user_inline_toggle(self, ctx: commands.Context): async def moderationset_history_user_inline_toggle(self, ctx: commands.Context):
"""Enable the `/history` command's inline argument by default.""" """Enable the /history command's inline argument by default."""
await self.config.user(ctx.author).history_inline.set(not await self.config.user(ctx.author).history_inline()) await self.config.user(ctx.author).history_inline.set(not await self.config.user(ctx.author).history_inline())
await ctx.send(f"Inline setting set to {await self.config.user(ctx.author).history_inline()}") await ctx.send(f"Inline setting set to {await self.config.user(ctx.author).history_inline()}")
@moderationset_history_user_inline.command(name='pagesize') @moderationset_history_inline.command(name='pagesize')
async def moderationset_history_user_inline_pagesize(self, ctx: commands.Context, pagesize: int): async def moderationset_history_user_inline_pagesize(self, ctx: commands.Context, pagesize: int):
"""Set the amount of cases to display per page.""" """Set the amount of cases to display per page."""
await self.config.user(ctx.author).history_inline_pagesize.set(pagesize) await self.config.user(ctx.author).history_inline_pagesize.set(pagesize)
await ctx.send(f"Inline pagesize set to {await self.config.user(ctx.author).history_inline_pagesize()}") await ctx.send(f"Inline pagesize set to {await self.config.user(ctx.author).history_inline_pagesize()}")
@commands.group(autohelp=True) @moderationset.group(autohelp=True, name='guild')
@checks.admin() @checks.admin()
async def moderationset_history_guild(self, ctx: commands.Context): async def moderationset_history_guild(self, ctx: commands.Context):
"""Manage configuration for the `/history` command, per guild.""" """Manage configuration for the /history command, per guild."""
@moderationset_history_guild.command(name='ephemeral', aliases=['hidden', 'hide']) @moderationset_history_guild.command(name='ephemeral', aliases=['hidden', 'hide'])
@checks.admin() @checks.admin()
async def moderationset_history_guild_ephemeral(self, ctx: commands.Context): async def moderationset_history_guild_ephemeral(self, ctx: commands.Context):
"""Toggle if the `/history` command should be ephemeral.""" """Toggle if the /history command should be ephemeral."""
await self.config.guild(ctx.guild).history_ephemeral.set(not await self.config.guild(ctx.guild).ephemeral()) await self.config.guild(ctx.guild).history_ephemeral.set(not await self.config.guild(ctx.guild).ephemeral())
await ctx.send(f"Ephemeral setting set to {await self.config.guild(ctx.guild).ephemeral()}") await ctx.send(f"Ephemeral setting set to {await self.config.guild(ctx.guild).ephemeral()}")
@ -1200,12 +1196,12 @@ class Moderation(commands.Cog):
@moderationset_history_guild.group(name='inline') @moderationset_history_guild.group(name='inline')
@checks.admin() @checks.admin()
async def moderationset_history_guild_inline(self, ctx: commands.Context): async def moderationset_history_guild_inline(self, ctx: commands.Context):
"""Manage configuration for the `/history` command's inline argument.""" """Manage configuration for the /history command's inline argument."""
@moderationset_history_guild_inline.command(name='toggle') @moderationset_history_guild_inline.command(name='toggle')
@checks.admin() @checks.admin()
async def moderationset_history_guild_inline_toggle(self, ctx: commands.Context): async def moderationset_history_guild_inline_toggle(self, ctx: commands.Context):
"""Enable the `/history` command's inline argument by default.""" """Enable the /history command's inline argument by default."""
await self.config.guild(ctx.guild).history_inline.set(not await self.config.guild(ctx.guild).history_inline()) await self.config.guild(ctx.guild).history_inline.set(not await self.config.guild(ctx.guild).history_inline())
await ctx.send(f"Inline setting set to {await self.config.guild(ctx.guild).history_inline()}") await ctx.send(f"Inline setting set to {await self.config.guild(ctx.guild).history_inline()}")