Skip to content

Commit

Permalink
Hidden DM Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoz committed Sep 30, 2024
1 parent ea0f50d commit 68f808b
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 16 deletions.
4 changes: 2 additions & 2 deletions cogs/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def autocomplete_server(self, interaction: nextcord.Interaction, current:
choices = [server for server in self.servers if current.lower() in server.lower()]
await interaction.response.send_autocomplete(choices)

@nextcord.slash_command(name="eventlogs", description=t("ConnectCog", "eventlogs.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(name="eventlogs", description=t("ConnectCog", "eventlogs.description"), default_member_permissions=nextcord.Permissions(administrator=True), dm_permission=False)
@restrict_command()
async def eventlogs(self, interaction: nextcord.Interaction, channel: nextcord.TextChannel, server: str = nextcord.SlashOption(description=t("ConnectCog", "eventlogs.server_description"), autocomplete=True)):
await interaction.response.defer(ephemeral=True)
Expand All @@ -151,7 +151,7 @@ async def eventlogs(self, interaction: nextcord.Interaction, channel: nextcord.T
async def on_autocomplete_rcon(self, interaction: nextcord.Interaction, current: str):
await self.autocomplete_server(interaction, current)

@nextcord.slash_command(name="removelogs", description=t("ConnectCog", "removelogs.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(name="removelogs", description=t("ConnectCog", "removelogs.description"), default_member_permissions=nextcord.Permissions(administrator=True), dm_permission=False)
@restrict_command()
async def removeeventlogs(self, interaction: nextcord.Interaction, server: str = nextcord.SlashOption(description=t("ConnectCog", "removelogs.server_description"), autocomplete=True)):
await interaction.response.defer(ephemeral=True)
Expand Down
2 changes: 1 addition & 1 deletion cogs/economy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ async def economyhelp(self, interaction: nextcord.Interaction):
except Exception as e:
await interaction.response.send_message(f"Unexpected error: {e}")

@nextcord.slash_command(name="setsteam", description=t("EconomyCog", "setsteam.description"))
@nextcord.slash_command(name="setsteam", description=t("EconomyCog", "setsteam.description"), dm_permission=False)
@restrict_command()
async def set_steam(self, interaction: nextcord.Interaction, steam_id: str):
try:
Expand Down
1 change: 1 addition & 0 deletions cogs/economy/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ async def load_config(self):
name="economyset",
description=t("EconomyManageCog", "economyset.description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
async def economyset(self, _interaction: nextcord.Interaction):
pass
Expand Down
2 changes: 1 addition & 1 deletion cogs/economy/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ async def get_server_info(self, server_name: str):
}
return None

@nextcord.slash_command(description=t("ShopCog", "shop.description"))
@nextcord.slash_command(description=t("ShopCog", "shop.description"), dm_permission=False)
async def shop(self, _interaction: nextcord.Interaction):
pass

Expand Down
35 changes: 30 additions & 5 deletions cogs/kits.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ async def get_server_info(self, server_name: str):
}
return None

@nextcord.slash_command(name="kit", description=t("KitsCog", "givekit.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(
name="kit",
description=t("KitsCog", "givekit.description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
@restrict_command()
async def givekit(self, interaction: nextcord.Interaction, steamid: str, kit_name: str, server: str):
await interaction.response.defer(ephemeral=True)
Expand Down Expand Up @@ -91,7 +96,12 @@ async def on_autocomplete_kits(self, interaction: nextcord.Interaction, current:
choices = await autocomplete_kits(current)
await interaction.response.send_autocomplete(choices[:10])

@nextcord.slash_command(name="managekits", description=t("KitsCog", "manage_kits.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(
name="managekits",
description=t("KitsCog", "manage_kits.description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
@restrict_command()
async def manage_kits(self, interaction: nextcord.Interaction, kit_name: str = ""):
try:
Expand All @@ -114,7 +124,12 @@ async def on_autocomplete_kits(self, interaction: nextcord.Interaction, current:
choices = await autocomplete_kits(current)
await interaction.response.send_autocomplete(choices[:10])

@nextcord.slash_command(name="deletekit", description=t("KitsCog", "delete_kit.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(
name="deletekit",
description=t("KitsCog", "delete_kit.description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
@restrict_command()
async def delete_kit(self, interaction: nextcord.Interaction, kit_name: str):
await interaction.response.defer(ephemeral=True)
Expand All @@ -130,7 +145,12 @@ async def on_autocomplete_kits(self, interaction: nextcord.Interaction, current:
choices = await autocomplete_kits(current)
await interaction.response.send_autocomplete(choices[:10])

@nextcord.slash_command(name="uploadkits", description=t("KitsCog", "uploadkits.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(
name="uploadkits",
description=t("KitsCog", "uploadkits.description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
@restrict_command()
async def uploadkits(self, interaction: nextcord.Interaction, json_file: nextcord.Attachment):
await interaction.response.defer(ephemeral=True)
Expand All @@ -154,7 +174,12 @@ async def uploadkits(self, interaction: nextcord.Interaction, json_file: nextcor
except Exception as e:
await interaction.followup.send(t("KitsCog", "uploadkits.error").format(error=e), ephemeral=True)

@nextcord.slash_command(name="exportkits", description="Export all kits as a JSON file.", default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(
name="exportkits",
description="Export all kits as a JSON file.",
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
@restrict_command()
async def exportkits(self, interaction: nextcord.Interaction):
await interaction.response.defer(ephemeral=True)
Expand Down
3 changes: 2 additions & 1 deletion cogs/palcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ async def get_server_info(self, server_name: str):
return None

@nextcord.slash_command(
default_member_permissions=nextcord.Permissions(administrator=True)
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
async def palcon(self, interaction: nextcord.Interaction):
await self.load_servers()
Expand Down
6 changes: 4 additions & 2 deletions cogs/palguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ async def get_server_info(self, server_name: str):
return None

@nextcord.slash_command(
default_member_permissions=nextcord.Permissions(administrator=True)
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
async def palguard(self, _interaction: nextcord.Interaction):
await self.load_servers()
Expand Down Expand Up @@ -399,7 +400,8 @@ async def on_autocomplete_rcon(
@nextcord.slash_command(
name="whitelist",
description=t("PalguardCog", "whitelist.description"),
default_member_permissions=nextcord.Permissions(administrator=True)
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
async def whitelist(self, interaction: nextcord.Interaction):
pass
Expand Down
7 changes: 6 additions & 1 deletion cogs/playerlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ async def get_server_info(self, server_name: str):
}
return None

@nextcord.slash_command(name="players", description=t("PlayerListCog", "playerslist.command_description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(
name="players",
description=t("PlayerListCog", "playerslist.command_description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
@restrict_command()
async def playerslist(
self,
Expand Down
1 change: 1 addition & 0 deletions cogs/playerlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def is_valid_steamid(self, steamid):
@nextcord.slash_command(
description=t("PlayerInfoCog", "userdb.description"),
default_member_permissions=nextcord.Permissions(administrator=True),
dm_permission=False
)
async def userdb(self, interaction: nextcord.Interaction):
pass
Expand Down
2 changes: 1 addition & 1 deletion cogs/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def autocomplete_server(self, interaction: nextcord.Interaction, current:
choices = [server for server in self.servers if current.lower() in server.lower()]
await interaction.response.send_autocomplete(choices)

@nextcord.slash_command(description=t("QueryCog", "query.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(description=t("QueryCog", "query.description"), default_member_permissions=nextcord.Permissions(administrator=True), dm_permission=False)
async def query(self, interaction: nextcord.Interaction):
pass

Expand Down
4 changes: 2 additions & 2 deletions cogs/servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ class ServerConfigCog(commands.Cog):
def __init__(self, bot):
self.bot = bot

@nextcord.slash_command(name="addserver", description=t("ServerConfig", "addserver.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(name="addserver", description=t("ServerConfig", "addserver.description"), default_member_permissions=nextcord.Permissions(administrator=True), dm_permission=False)
@restrict_command()
async def addserver(self, interaction: nextcord.Interaction):
modal = AddServerModal()
await interaction.response.send_modal(modal)

@nextcord.slash_command(name="removeserver", description=t("ServerConfig", "removeserver.description"), default_member_permissions=nextcord.Permissions(administrator=True))
@nextcord.slash_command(name="removeserver", description=t("ServerConfig", "removeserver.description"), default_member_permissions=nextcord.Permissions(administrator=True), dm_permission=False)
@restrict_command()
async def removeserver(self, interaction: nextcord.Interaction, server_name: str):
result = await remove_server(server_name)
Expand Down

0 comments on commit 68f808b

Please sign in to comment.