forked from cswimr/SeaCogs
fix(moderation): limited pagesize to 20
This commit is contained in:
parent
f12f4b5406
commit
59f0375ad5
1 changed files with 25 additions and 1 deletions
|
@ -911,7 +911,7 @@ class Moderation(commands.Cog):
|
|||
await self.log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="history")
|
||||
async def history(self, interaction: discord.Interaction, target: discord.User = None, moderator: discord.User = None, pagesize: app_commands.Range[int, 1, 25] = None, page: int = 1, ephemeral: bool = None, inline: bool = None, export: bool = False):
|
||||
async def history(self, interaction: discord.Interaction, target: discord.User = None, moderator: discord.User = None, pagesize: app_commands.Range[int, 1, 20] = None, page: int = 1, ephemeral: bool = None, inline: bool = None, export: bool = False):
|
||||
"""List previous infractions.
|
||||
|
||||
Parameters
|
||||
|
@ -1382,6 +1382,12 @@ class Moderation(commands.Cog):
|
|||
@moderationset_history.command(name='pagesize')
|
||||
async def moderationset_history_user_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!")
|
||||
return
|
||||
if pagesize < 1:
|
||||
await ctx.send("Pagesize cannot be less than 1!")
|
||||
return
|
||||
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()}")
|
||||
|
||||
|
@ -1398,6 +1404,12 @@ class Moderation(commands.Cog):
|
|||
@moderationset_history_inline.command(name='pagesize')
|
||||
async def moderationset_history_user_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!")
|
||||
return
|
||||
if pagesize < 1:
|
||||
await ctx.send("Pagesize cannot be less than 1!")
|
||||
return
|
||||
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()}")
|
||||
|
||||
|
@ -1417,6 +1429,12 @@ class Moderation(commands.Cog):
|
|||
@checks.admin()
|
||||
async def moderationset_history_guild_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!")
|
||||
return
|
||||
if pagesize < 1:
|
||||
await ctx.send("Pagesize cannot be less than 1!")
|
||||
return
|
||||
await self.config.guild(ctx.guild).history_pagesize.set(pagesize)
|
||||
await ctx.send(f"Pagesize set to {await self.config.guild(ctx.guild).history_pagesize()}")
|
||||
|
||||
|
@ -1436,6 +1454,12 @@ class Moderation(commands.Cog):
|
|||
@checks.admin()
|
||||
async def moderationset_history_guild_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!")
|
||||
return
|
||||
if pagesize < 1:
|
||||
await ctx.send("Pagesize cannot be less than 1!")
|
||||
return
|
||||
await self.config.guild(ctx.guild).history_inline_pagesize.set(pagesize)
|
||||
await ctx.send(f"Inline pagesize set to {await self.config.guild(ctx.guild).history_inline_pagesize()}")
|
||||
|
||||
|
|
Loading…
Reference in a new issue