From 39e87746fa39787a5c444997c97cb98ee3866d96 Mon Sep 17 00:00:00 2001 From: Evorp <3vorpgaming@gmail.com> Date: Sun, 29 Oct 2023 23:07:43 -0700 Subject: [PATCH] disable dms for locked commands --- src/commands/bot/botban.ts | 3 ++- src/commands/bot/embed.ts | 3 ++- src/commands/bot/logs.ts | 6 ++++-- src/commands/developer/eval.ts | 3 ++- src/commands/developer/restart.ts | 3 ++- src/commands/developer/shutdown.ts | 3 ++- src/commands/developer/status.ts | 3 ++- src/commands/fun/reply.ts | 3 ++- src/commands/fun/say.ts | 3 ++- 9 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/commands/bot/botban.ts b/src/commands/bot/botban.ts index 14d8dc33..9cf17cdf 100644 --- a/src/commands/bot/botban.ts +++ b/src/commands/bot/botban.ts @@ -49,7 +49,8 @@ export const command: SlashCommand = { .setRequired(true), ), ) - .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages), + .setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages) + .setDMPermission(false), execute: new Collection() .set("edit", async (interaction: ChatInputCommandInteraction) => { const isAdding = interaction.options.getString("action", true) == "add"; diff --git a/src/commands/bot/embed.ts b/src/commands/bot/embed.ts index d6cc983b..76c6e849 100644 --- a/src/commands/bot/embed.ts +++ b/src/commands/bot/embed.ts @@ -36,7 +36,8 @@ export const command: SlashCommand = { .setDescription("Add a thumbnail to the top right corner of the embed") .setRequired(false), ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.options.getString("title") && !interaction.options.getString("description")) { return await interaction.reply({ diff --git a/src/commands/bot/logs.ts b/src/commands/bot/logs.ts index a077b236..7bd23d5d 100644 --- a/src/commands/bot/logs.ts +++ b/src/commands/bot/logs.ts @@ -7,10 +7,12 @@ export const command: SlashCommand = { data: new SlashCommandBuilder() .setName("logs") .setDescription("Get logs of the bot.") - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return; - await interaction.reply({ files: [logConstructor(interaction.client)] }).catch(console.error); + await interaction.deferReply(); + await interaction.editReply({ files: [logConstructor(interaction.client)] }).catch(console.error); }, }; diff --git a/src/commands/developer/eval.ts b/src/commands/developer/eval.ts index 7dcc284b..11ec4154 100644 --- a/src/commands/developer/eval.ts +++ b/src/commands/developer/eval.ts @@ -10,7 +10,8 @@ export const command: SlashCommand = { .addStringOption((option) => option.setName("code").setDescription("The code to evaluate.").setRequired(true), ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return; const clean = async (text: any, client: Client): Promise => { diff --git a/src/commands/developer/restart.ts b/src/commands/developer/restart.ts index 64244853..ecf9c4cc 100644 --- a/src/commands/developer/restart.ts +++ b/src/commands/developer/restart.ts @@ -6,7 +6,8 @@ export const command: SlashCommand = { data: new SlashCommandBuilder() .setName("restart") .setDescription("Restarts the bot.") - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return; diff --git a/src/commands/developer/shutdown.ts b/src/commands/developer/shutdown.ts index 46c3871d..0ebb642d 100644 --- a/src/commands/developer/shutdown.ts +++ b/src/commands/developer/shutdown.ts @@ -6,7 +6,8 @@ export const command: SlashCommand = { data: new SlashCommandBuilder() .setName("shutdown") .setDescription("Shuts down the bot.") - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return; await interaction.reply({ diff --git a/src/commands/developer/status.ts b/src/commands/developer/status.ts index 7395e147..0d6f0380 100644 --- a/src/commands/developer/status.ts +++ b/src/commands/developer/status.ts @@ -42,7 +42,8 @@ export const command: SlashCommand = { .setDescription("Message to show after the bot activity") .setRequired(true), ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return; diff --git a/src/commands/fun/reply.ts b/src/commands/fun/reply.ts index d4285973..26627a1b 100644 --- a/src/commands/fun/reply.ts +++ b/src/commands/fun/reply.ts @@ -15,7 +15,8 @@ export const command: SlashCommand = { .addStringOption((option) => option.setName("message").setDescription("Message ID to reply to").setRequired(true), ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return; diff --git a/src/commands/fun/say.ts b/src/commands/fun/say.ts index 09cd3b6f..4d9682b6 100644 --- a/src/commands/fun/say.ts +++ b/src/commands/fun/say.ts @@ -12,7 +12,8 @@ export const command: SlashCommand = { .setDescription("The funny thing you want the bot to say.") .setRequired(true), ) - .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator) + .setDMPermission(false), async execute(interaction: ChatInputCommandInteraction) { if (!interaction.hasPermission("dev")) return;