2022-08-27 21:23:02 +01:00
|
|
|
const { Client, CommandInteraction, Permissions } = require("discord.js");
|
|
|
|
const { SlashCommandBuilder } = require('@discordjs/builders');
|
|
|
|
const { PermissionFlagsBits } = require('discord-api-types/v10');
|
2022-07-04 21:33:45 +01:00
|
|
|
|
|
|
|
module.exports = {
|
2022-08-27 21:23:02 +01:00
|
|
|
...new SlashCommandBuilder()
|
|
|
|
.setName('lock')
|
|
|
|
.setDescription('Lock a channel')
|
|
|
|
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers | PermissionFlagsBits.BanMembers),
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {Client} client
|
|
|
|
* @param {CommandInteraction} interaction
|
|
|
|
* @param {String[]} args
|
2022-07-04 21:33:45 +01:00
|
|
|
*/
|
2022-08-27 21:23:02 +01:00
|
|
|
|
|
|
|
run: async (client, interaction, args) => {
|
2022-07-04 21:33:45 +01:00
|
|
|
|
2022-08-27 21:23:02 +01:00
|
|
|
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.")
|
2022-07-04 21:33:45 +01:00
|
|
|
|
2022-08-27 21:23:02 +01:00
|
|
|
},
|
|
|
|
};
|