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

View File

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