-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnuke.js
76 lines (63 loc) · 2.5 KB
/
nuke.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const {
Client,
Interaction,
PermissionFlagsBits,
EmbedBuilder,
} = require("discord.js");
module.exports = {
/**
* @param {Client} client
* @param {Interaction} interaction
*/
callback: async (client, interaction) => {
const allowedUserId = ""; // Replace with your Discord User ID
if (interaction.user.id !== allowedUserId) {
return await interaction.reply({ content: "❌ You can't run this command, fuck nigga.", ephemeral: true });
}
try {
const channel = interaction.options.getChannel("channel") || interaction.channel;
if (!interaction.guild.members.me.permissions.has(PermissionFlagsBits.ManageChannels)) {
return await interaction.reply({ content: "I need the **Manage Channels** permission to execute this command!", ephemeral: true });
}
if (!channel) {
return await interaction.reply({ content: "❌ Unable to find the specified channel.", ephemeral: true });
}
const position = channel.position;
const parent = channel.parent;
const topic = channel.topic;
const permissions = channel.permissionOverwrites.cache.map(overwrite => ({
id: overwrite.id,
allow: overwrite.allow.toArray(),
deny: overwrite.deny.toArray()
}));
const newChannel = await channel.clone({
parent: parent ? parent.id : null,
position,
topic,
permissionOverwrites: permissions
});
await channel.delete(`Restored by ${interaction.user.tag}`);
const embed = new EmbedBuilder()
.setColor("#4ea554")
.setTitle("Channel Restored")
.setDescription(`Salutations. If you have any questions or concerns, please forward them to someone on our Staff Team. Thank you so much for your patience and support!`)
.setThumbnail(interaction.guild.iconURL())
.setTimestamp();
await newChannel.send({ embeds: [embed] });
await interaction.reply({ content: `✅ Successfully restored <#${newChannel.id}>!`, ephemeral: true });
} catch (error) {
console.error("Error nuking the channel:", error);
await interaction.reply({ content: "❌ Failed to restore the channel. Make sure I have the correct permissions.", ephemeral: true });
}
},
name: "nuke",
description: "Nukes a channel (deletes & recreates it with the same settings).",
options: [
{
name: "channel",
description: "The channel to nuke (defaults to the current one).",
type: 7,
required: false,
},
],
};