From cabb60f1cb79aa443aa0fe26cef7838736f6e6ff Mon Sep 17 00:00:00 2001 From: Kieran Date: Mon, 25 Jul 2022 20:33:58 +0100 Subject: [PATCH] Added unlock.js slash commands --- SlashCommands/admin/unlock.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 SlashCommands/admin/unlock.js diff --git a/SlashCommands/admin/unlock.js b/SlashCommands/admin/unlock.js new file mode 100644 index 0000000..0a1619f --- /dev/null +++ b/SlashCommands/admin/unlock.js @@ -0,0 +1,21 @@ +const { Client, CommandInteraction, Permissions } = require("discord.js"); + +module.exports = { + name: "unlock", + description: "unlocks a channel", + type: 'CHAT_INPUT', + /** + * + * @param {Client} client + * @param {CommandInteraction} interaction + * @param {String[]} args + */ + run: async (client, interaction, args) => { + + const permission = interaction.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS) + if (!permission)return interaction.reply({ contents: "You don't have permission to use this command", ephemeral: true }); + interaction.channel.permissionOverwrites.edit(interaction.guild.roles.everyone.id, {SEND_MESSAGES: true}); + interaction.reply("Channel has been unlocked.") + + }, +}; \ No newline at end of file