fix: made all commands only work in guilds

This commit is contained in:
Seaswimmer 2023-07-16 13:19:39 -04:00
parent b81615e6b6
commit dbd16175a6
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -51,6 +51,7 @@ class Pterodactyl(commands.Cog):
return response return response
@app_commands.command(description="Updates the server.") @app_commands.command(description="Updates the server.")
@app_commands.guild_only()
async def update(self, interaction: discord.Interaction): async def update(self, interaction: discord.Interaction):
"""Updates the server using the arguments provided in the server's configuration.""" """Updates the server using the arguments provided in the server's configuration."""
await interaction.response.defer(ephemeral=True, thinking=True) await interaction.response.defer(ephemeral=True, thinking=True)
@ -182,6 +183,7 @@ class Pterodactyl(commands.Cog):
get_group = app_commands.Group(name='get', description="Retrieves information from the Pterodactyl API.") get_group = app_commands.Group(name='get', description="Retrieves information from the Pterodactyl API.")
@get_group.command(name='url', description="Retrieves the URL for the specified endpoint.") @get_group.command(name='url', description="Retrieves the URL for the specified endpoint.")
@app_commands.guild_only()
async def retrieve_url(self, interaction: discord.Interaction, endpoint: str = None): async def retrieve_url(self, interaction: discord.Interaction, endpoint: str = None):
"""Retrieves the URL for the specified endpoint.""" """Retrieves the URL for the specified endpoint."""
try: try:
@ -197,11 +199,13 @@ class Pterodactyl(commands.Cog):
configure = app_commands.Group(name="config", description="Configures the Pterodactyl cog.") configure = app_commands.Group(name="config", description="Configures the Pterodactyl cog.")
@configure.command() @configure.command()
@app_commands.guild_only()
async def api(self, interaction: discord.Interaction): async def api(self, interaction: discord.Interaction):
"""Sets the information used to access the Pterdoactyl API.""" """Sets the information used to access the Pterdoactyl API."""
await interaction.response.send_modal(self.APIConfigModal(self.config)) await interaction.response.send_modal(self.APIConfigModal(self.config))
@configure.command() @configure.command()
@app_commands.guild_only()
async def update(self, interaction: discord.Interaction): async def update(self, interaction: discord.Interaction):
"""Sets the startup arguments for the update command.""" """Sets the startup arguments for the update command."""
await interaction.response.send_modal(self.StartupConfigModal(self.config)) await interaction.response.send_modal(self.StartupConfigModal(self.config))