Explicit permission checks on subcommands.

This commit is contained in:
2025-08-28 17:17:50 +10:00
parent 4e9e5ccb2d
commit 7467ed6006

View File

@@ -128,6 +128,7 @@ class QuoteCog(LionCog):
@appcmds.describe(
content="Content of the quote to add"
)
@cmds.has_permissions(manage_guild=True)
async def addquote_cmd(self, ctx: LionContext, *, content: Optional[str] = None):
await self.quotes_add_cmd(ctx, content=content)
@@ -138,6 +139,7 @@ class QuoteCog(LionCog):
@appcmds.describe(
content="Content of the quote to add"
)
@cmds.has_permissions(manage_guild=True)
async def quotes_add_cmd(self, ctx: LionContext, *, content: Optional[str] = None):
if content is not None:
interaction = ctx.interaction
@@ -186,9 +188,9 @@ class QuoteCog(LionCog):
@appcmds.describe(
quotestr="Select the quote to delete, or write the number."
)
@cmds.has_permissions(manage_guild=True)
@appcmds.rename(quotestr='quote')
async def quotes_del_cmd(self, ctx: LionContext, quotestr: str):
# TODO: Double check group permission inheritance
quote = await self.resolve_quote(ctx, quotestr)
label = quote.quotelabel
await self.quotes.delete_quote(quote.quoteid)
@@ -200,6 +202,7 @@ class QuoteCog(LionCog):
name='list',
description="Display the community quotes. Quotes may also be added/edited/deleted here."
)
@cmds.has_permissions(manage_guild=True)
async def quotes_list_cmd(self, ctx: LionContext):
view = QuoteListUI(self.bot, self.quotes, ctx.community.communityid, ctx.profile.profileid, ctx.author.id)
if ctx.interaction is None:
@@ -217,6 +220,7 @@ class QuoteCog(LionCog):
new_content="New content for the quote. Leave unselected to edit in multiline modal."
)
@appcmds.rename(quotestr='quote')
@cmds.has_permissions(manage_guild=True)
async def quotes_edit_cmd(self, ctx: LionContext, quotestr: str, *, new_content: Optional[str] = None):
quote = await self.resolve_quote(ctx, quotestr)
if new_content is not None: