mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-03 00:23:13 +00:00
feat: Fix permissions in trigger commands
This commit is contained in:
parent
3afa58f5ac
commit
e58ec1bde3
1 changed files with 13 additions and 9 deletions
|
@ -12,15 +12,24 @@ from services.reactions_service import CustomReactionsService
|
||||||
from ui.embeds import Builder
|
from ui.embeds import Builder
|
||||||
|
|
||||||
|
|
||||||
|
@app_commands.guild_only()
|
||||||
|
@app_commands.default_permissions(manage_guild=True)
|
||||||
class Triggers(commands.GroupCog, group_name="trigger"):
|
class Triggers(commands.GroupCog, group_name="trigger"):
|
||||||
def __init__(self, bot: commands.Bot):
|
def __init__(self, bot: commands.Bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
add = app_commands.Group(name="add", description="Add a trigger")
|
add = app_commands.Group(
|
||||||
|
name="add",
|
||||||
|
description="Add a trigger",
|
||||||
|
allowed_contexts=app_commands.AppCommandContext(
|
||||||
|
guild=True,
|
||||||
|
dm_channel=False,
|
||||||
|
private_channel=False,
|
||||||
|
),
|
||||||
|
default_permissions=discord.Permissions(manage_guild=True),
|
||||||
|
)
|
||||||
|
|
||||||
@add.command(name="response")
|
@add.command(name="response")
|
||||||
@app_commands.default_permissions(manage_guild=True)
|
|
||||||
@app_commands.guild_only()
|
|
||||||
async def add_text_response(
|
async def add_text_response(
|
||||||
self,
|
self,
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
|
@ -85,8 +94,6 @@ class Triggers(commands.GroupCog, group_name="trigger"):
|
||||||
await interaction.response.send_message(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
@add.command(name="emoji")
|
@add.command(name="emoji")
|
||||||
@app_commands.default_permissions(manage_guild=True)
|
|
||||||
@app_commands.guild_only()
|
|
||||||
async def add_emoji_response(
|
async def add_emoji_response(
|
||||||
self,
|
self,
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
|
@ -151,8 +158,6 @@ class Triggers(commands.GroupCog, group_name="trigger"):
|
||||||
await interaction.response.send_message(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
@app_commands.command(name="delete")
|
@app_commands.command(name="delete")
|
||||||
@app_commands.default_permissions(manage_guild=True)
|
|
||||||
@app_commands.guild_only()
|
|
||||||
async def remove_text_response(
|
async def remove_text_response(
|
||||||
self,
|
self,
|
||||||
interaction: discord.Interaction,
|
interaction: discord.Interaction,
|
||||||
|
@ -188,7 +193,6 @@ class Triggers(commands.GroupCog, group_name="trigger"):
|
||||||
await interaction.response.send_message(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
@app_commands.command(name="list")
|
@app_commands.command(name="list")
|
||||||
@app_commands.guild_only()
|
|
||||||
async def list_reactions(self, interaction: discord.Interaction) -> None:
|
async def list_reactions(self, interaction: discord.Interaction) -> None:
|
||||||
"""
|
"""
|
||||||
List all custom reactions for the current guild.
|
List all custom reactions for the current guild.
|
||||||
|
@ -215,7 +219,7 @@ class Triggers(commands.GroupCog, group_name="trigger"):
|
||||||
await interaction.response.send_message(embed=embed)
|
await interaction.response.send_message(embed=embed)
|
||||||
return
|
return
|
||||||
|
|
||||||
menu = ViewMenu(interaction, menu_type=ViewMenu.TypeEmbed, all_can_click=True, delete_on_timeout=True)
|
menu = ViewMenu(interaction, menu_type=ViewMenu.TypeEmbed, all_can_click=True, remove_items_on_timeout=True)
|
||||||
|
|
||||||
for reaction in reactions:
|
for reaction in reactions:
|
||||||
embed: discord.Embed = Builder.create_embed(
|
embed: discord.Embed = Builder.create_embed(
|
||||||
|
|
Loading…
Reference in a new issue