diff --git a/SlashCommands/admin/lock.js b/SlashCommands/admin/lock.js index 7b13fdb..c6251e0 100644 --- a/SlashCommands/admin/lock.js +++ b/SlashCommands/admin/lock.js @@ -1,15 +1,20 @@ const { Client, CommandInteraction, Permissions } = require("discord.js"); +const { SlashCommandBuilder } = require('@discordjs/builders'); +const { PermissionFlagsBits } = require('discord-api-types/v10'); module.exports = { - name: "lock", - description: "locks a channel", - type: 'CHAT_INPUT', + ...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, interaction, args) => { const permission = interaction.member.permissions.has(Permissions.FLAGS.MANAGE_CHANNELS) diff --git a/SlashCommands/admin/unlock.js b/SlashCommands/admin/unlock.js index 0a1619f..41e330f 100644 --- a/SlashCommands/admin/unlock.js +++ b/SlashCommands/admin/unlock.js @@ -1,9 +1,13 @@ const { Client, CommandInteraction, Permissions } = require("discord.js"); +const { SlashCommandBuilder } = require('@discordjs/builders'); +const { PermissionFlagsBits } = require('discord-api-types/v10'); + module.exports = { - name: "unlock", - description: "unlocks a channel", - type: 'CHAT_INPUT', + ...new SlashCommandBuilder() + .setName('unlock') + .setDescription('Unlock a channel') + .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers), /** * * @param {Client} client diff --git a/commands/admin/lock.js b/commands/admin/lock.js index c6251e0..e1cf8fc 100644 --- a/commands/admin/lock.js +++ b/commands/admin/lock.js @@ -1,26 +1,20 @@ -const { Client, CommandInteraction, Permissions } = require("discord.js"); -const { SlashCommandBuilder } = require('@discordjs/builders'); -const { PermissionFlagsBits } = require('discord-api-types/v10'); +const { Client, Message, Permissions } = require('discord.js'); module.exports = { - ...new SlashCommandBuilder() - .setName('lock') - .setDescription('Lock a channel') - .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers), - - /** - * - * @param {Client} client - * @param {CommandInteraction} interaction - * @param {String[]} args + name: 'lock', + aliases: [''], + /** + * @param {Client} client + * @param {Message} message + * @param {String[]} args */ - - run: async (client, interaction, args) => { + run: async(client, message, 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: false}); - interaction.reply("Channel has been locked.") + 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}); - }, -}; \ No newline at end of file + message.channel.send("Channel has been locked.") + } +} \ No newline at end of file diff --git a/commands/admin/unlock.js b/commands/admin/unlock.js index 41e330f..67ee0da 100644 --- a/commands/admin/unlock.js +++ b/commands/admin/unlock.js @@ -1,25 +1,18 @@ -const { Client, CommandInteraction, Permissions } = require("discord.js"); -const { SlashCommandBuilder } = require('@discordjs/builders'); -const { PermissionFlagsBits } = require('discord-api-types/v10'); - +const { Client, Message, Permissions } = require('discord.js'); module.exports = { - ...new SlashCommandBuilder() - .setName('unlock') - .setDescription('Unlock a channel') - .setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers), - /** - * - * @param {Client} client - * @param {CommandInteraction} interaction - * @param {String[]} args + name: 'unlock', + aliases: [''], + /** + * @param {Client} client + * @param {Message} message + * @param {String[]} args */ - run: async (client, interaction, args) => { + run: async(client, message, 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 + 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: true}); + message.channel.send("Channel has been unlocked.") + } +} \ No newline at end of file