diff --git a/commands/admin/lock.js b/commands/admin/lock.js index 8db2ca4..c6251e0 100644 --- a/commands/admin/lock.js +++ b/commands/admin/lock.js @@ -1,20 +1,26 @@ -const { Discord, Client, Message, MessageEmbed, Permissions } = require('discord.js'); +const { Client, CommandInteraction, Permissions } = require("discord.js"); +const { SlashCommandBuilder } = require('@discordjs/builders'); +const { PermissionFlagsBits } = require('discord-api-types/v10'); module.exports = { - name: 'lock', - aliases: [''], - /** - * @param {Client} client - * @param {Message} message - * @param {String[]} args + ...new SlashCommandBuilder() + .setName('lock') + .setDescription('Lock a channel') + .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers), + + /** + * + * @param {Client} client + * @param {CommandInteraction} interaction + * @param {String[]} args */ - run: async(client, message, args) => { + + run: async (client, interaction, args) => { - const permission = message.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS) - if (!permission)return message.reply({ contents: "You don't have permission to use this command" }); - - message.channel.permissionOverwrites.edit(message.guild.roles.everyone.id, {SEND_MESSAGES: false}); + 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: false}); + interaction.reply("Channel has been locked.") - message.channel.send("Channel has been locked.") - } -} \ No newline at end of file + }, +}; \ No newline at end of file diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 097b995..860a88e 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -6,7 +6,7 @@ client.on("interactionCreate", async (interaction) => { if (interaction.isCommand()) { const cmd = client.slashCommands.get(interaction.commandName); if (!cmd) - return interaction.reply({ content: "An error has occured " }); + return interaction.reply({ content: "An error has occurred" }); const args = [];