2022-10-26 12:38:28 +02:00
|
|
|
const { EmbedBuilder } = require("discord.js");
|
2021-11-18 18:56:42 +01:00
|
|
|
module.exports = {
|
|
|
|
name: "lockdown",
|
|
|
|
description: "Lock a channel",
|
|
|
|
UserPerms: ["MANAGE_CHANNELS"],
|
|
|
|
BotPerms: ["MANAGE_CHANNELS"],
|
|
|
|
category: "Moderation",
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
type: 5,
|
|
|
|
name: "choice",
|
|
|
|
description: "Whether lock or unlock the channel",
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
run: async (client, interaction, args) => {
|
|
|
|
if (args[0]) {
|
|
|
|
interaction.channel.permissionOverwrites
|
|
|
|
.create(interaction.guild.id, { SEND_MESSAGES: false })
|
|
|
|
.then(() => {
|
2022-10-26 12:38:28 +02:00
|
|
|
const embed = new EmbedBuilder()
|
2021-11-18 18:56:42 +01:00
|
|
|
.setTitle("Channel Locked")
|
|
|
|
.addField("**Moderator**", interaction.user.tag, true)
|
|
|
|
.addField("**Channel**", `<#${interaction.channel.id}>`, true)
|
2022-10-26 12:38:28 +02:00
|
|
|
.setFooter({
|
|
|
|
text: `Made by ${client.author}`,
|
|
|
|
iconURL: client.user.displayAvatarURL(),
|
|
|
|
})
|
2021-11-18 18:56:42 +01:00
|
|
|
.setTimestamp()
|
|
|
|
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
|
|
|
|
.setColor(client.color);
|
|
|
|
interaction.followUp({ embeds: [embed] });
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
interaction.channel.permissionOverwrites
|
|
|
|
.create(interaction.guild.id, { SEND_MESSAGES: true })
|
|
|
|
.then(() => {
|
2022-10-26 12:38:28 +02:00
|
|
|
const embed = new EmbedBuilder()
|
2021-11-18 18:56:42 +01:00
|
|
|
.setTitle("Channel Unlocked")
|
|
|
|
.addField("**Moderator**", interaction.user.tag, true)
|
|
|
|
.addField("**Channel**", `<#${interaction.channel.id}>`, true)
|
2022-10-26 12:38:28 +02:00
|
|
|
.setFooter({
|
|
|
|
text: `Made by ${client.author}`,
|
|
|
|
iconURL: client.user.displayAvatarURL(),
|
|
|
|
})
|
2021-11-18 18:56:42 +01:00
|
|
|
.setTimestamp()
|
|
|
|
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
|
|
|
|
.setColor(client.color);
|
|
|
|
interaction.followUp({ embeds: [embed] });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|