Compare commits

...

2 Commits

Author SHA1 Message Date
7467ed6006 Explicit permission checks on subcommands. 2025-08-28 17:17:50 +10:00
4e9e5ccb2d Remove jump button from single-page lists. 2025-08-28 17:16:53 +10:00
2 changed files with 6 additions and 3 deletions

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:

View File

@@ -250,7 +250,6 @@ class QuoteListUI(MessageUI):
# Delete
self.set_layout(
(self.new_quote_button,
self.jump_button,
self.quit_button),
(self.edit_menu,),
(self.delete_menu,),
@@ -259,7 +258,7 @@ class QuoteListUI(MessageUI):
# Add Close
self.set_layout(
(self.new_quote_button,
self.jump_button),
self.quit_button),
)
async def reload(self):