├── .gitignore ├── Events ├── Client │ ├── disconnect.js │ ├── error.js │ ├── guildCreate.js │ ├── guildDelete.js │ ├── rateLimit.js │ ├── ready.js │ ├── reconnecting.js │ ├── shardDisconnect.js │ ├── shardError.js │ ├── shardReady.js │ ├── shardReconnected.js │ ├── shardResume.js │ └── warn.js └── Guild │ └── interactionCreate.js ├── Examples └── command.js ├── Handler ├── Antinuke.js ├── Command.js ├── Database.js ├── Database │ ├── Connect.js │ └── Premium.js ├── Events.js └── errLogger.js ├── LICENSE ├── Models ├── Antinuke.js ├── Premium.js └── Redeem.js ├── Readme.md ├── Settings ├── config.js └── emojis.js ├── bot.js ├── bun.lockb ├── commands ├── Antinuke │ ├── Disable.js │ ├── Enable.js │ ├── LogChannel.js │ ├── Settings.js │ ├── Whitelist Add.js │ ├── Whitelist Owner.js │ ├── Whitelist Remove.js │ └── Whitelist show.js ├── Premium │ ├── generate.js │ ├── redeem.js │ └── remove.js └── Utility │ ├── help.js │ └── ping.js ├── deploySlash.js ├── example.env ├── index.js ├── package.json └── shards.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /Events/Client/disconnect.js: -------------------------------------------------------------------------------- 1 | const { white, yellow } = require('chalk'); 2 | 3 | module.exports = async (client) => { 4 | console.log(white('[') + yellow('WARN') + white('] ') + yellow('Disconnected ') + white(`${client.user.tag} (${client.user.id})`) + yellow(' ')); 5 | }; 6 | -------------------------------------------------------------------------------- /Events/Client/error.js: -------------------------------------------------------------------------------- 1 | const { white, red } = require('chalk'); 2 | 3 | module.exports = async (client, error) => { 4 | console.log(white('[') + red('WARN') + white('] ') + red('Errored ') + white(`${client.user.tag} (${client.user.id}) ${error}`) + red(' ')); 5 | }; 6 | -------------------------------------------------------------------------------- /Events/Client/guildCreate.js: -------------------------------------------------------------------------------- 1 | const { WebhookClient, EmbedBuilder } = require("discord.js") 2 | const config = require("../../Settings/config") 3 | module.exports = async (client, guild) => { 4 | 5 | const logchannel = new WebhookClient({ 6 | url: `${config.webhook.join}` 7 | }) 8 | let guilds = client.guilds.cache.size; 9 | 10 | let owner = await guild.fetchOwner(); 11 | const embed = new EmbedBuilder() 12 | .setAuthor({ iconURL: guild.iconURL(), name: guild.name}) 13 | .setTitle("💚 Addded To New Guild") 14 | .setDescription(`Guild Name: ${guild.name} (${guild.id})\nGuild Owner: <@!${owner.id}> (${owner.id})\n Guild Members: ${guild.memberCount}\nTotal Guilds: ${guilds}`) 15 | .setColor(client.color) 16 | 17 | logchannel.send({ embeds: [embed], username: "Join Logger"}) 18 | 19 | } -------------------------------------------------------------------------------- /Events/Client/guildDelete.js: -------------------------------------------------------------------------------- 1 | const { WebhookClient, EmbedBuilder } = require("discord.js") 2 | const config = require("../../Settings/config") 3 | 4 | module.exports = async (client, guild) => { 5 | const logchannel = new WebhookClient({ 6 | url: `${config.webhook.leave}` 7 | }) 8 | let guilds = client.guilds.cache.size; 9 | 10 | let owner = await guild.fetchOwner(); 11 | const embed = new EmbedBuilder() 12 | .setAuthor({ iconURL: guild.iconURL(), name: guild.name}) 13 | .setTitle("💔 Removed From The Guild") 14 | .setDescription(`Guild Name: ${guild.name} (${guild.id})\nGuild Owner: <@!${owner.id}> (${owner.id})\n Guild Members: ${guild.memberCount}\nTotal Guilds: ${guilds}`) 15 | .setColor(client.color) 16 | 17 | logchannel.send({ embeds: [embed], username: "Leave Logger"}) 18 | 19 | 20 | 21 | } -------------------------------------------------------------------------------- /Events/Client/rateLimit.js: -------------------------------------------------------------------------------- 1 | const { white, red } = require('chalk'); 2 | 3 | module.exports = async (client, info) => { 4 | console.log(white(' [') + red('ERROR') + white('] ') + red('Rate Limited, Sleeping for ') + white(0) + red(' seconds')); 5 | } -------------------------------------------------------------------------------- /Events/Client/ready.js: -------------------------------------------------------------------------------- 1 | const { green, white } = require('chalk'); 2 | const Premium = require('../../Models/Premium'); 3 | 4 | module.exports = async (client) => { 5 | console.log(white('[') + green('INFO') + white('] ') + green(`${client.user.tag} (${client.user.id})`) + white(` is Ready!`)); 6 | 7 | const users = await Premium.find(); 8 | for (let user of users) { 9 | client.premiums.set(user.Id, user); 10 | } 11 | 12 | let guilds = client.guilds.cache.size; 13 | let members = client.guilds.cache.reduce((a, b) => a + b.memberCount, 0); 14 | let channels = client.channels.cache.size; 15 | 16 | const activities = [ 17 | `Roaming In ${guilds} servers`, 18 | `${members} users`, 19 | `Working in ${channels} channels`, 20 | ] 21 | 22 | setInterval(() => { 23 | client.user.setPresence({ 24 | activities: [{ name: `${activities[Math.floor(Math.random() * activities.length)]}`, type: 2 }], 25 | status: 'online', 26 | }); 27 | }, 15000) 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /Events/Client/reconnecting.js: -------------------------------------------------------------------------------- 1 | const { white, yellow } = require('chalk'); 2 | 3 | module.exports = async (client) => { 4 | console.log(white('[') + yellow('WARN') + white('] ') + yellow('Reconnected ') + white(`${client.user.tag} (${client.user.id})`) + yellow(' ')); 5 | }; 6 | -------------------------------------------------------------------------------- /Events/Client/shardDisconnect.js: -------------------------------------------------------------------------------- 1 | const { yellow, white } = require("chalk"); 2 | 3 | module.exports = async (client, error, id) => { 4 | console.log(white('[') + yellow('WARN') + white('] ') + yellow('Shard ') + white(id) + yellow(' Shard Disconnected!')); 5 | } -------------------------------------------------------------------------------- /Events/Client/shardError.js: -------------------------------------------------------------------------------- 1 | const { red, white } = require("chalk"); 2 | 3 | module.exports = async (client, error, id) => { 4 | console.log(white('[') + red('ERROR') + white('] ') + red('Shard ') + white(id) + red(' Shard Errored!')); 5 | } -------------------------------------------------------------------------------- /Events/Client/shardReady.js: -------------------------------------------------------------------------------- 1 | const { white, green } = require("chalk"); 2 | 3 | module.exports = async (client, id) => { 4 | console.log(white('[') + green('INFO') + white('] ') + green('Shard ') + white(id) + green(' Shard Ready!')); 5 | } -------------------------------------------------------------------------------- /Events/Client/shardReconnected.js: -------------------------------------------------------------------------------- 1 | const { white, yellow } = require("chalk"); 2 | 3 | module.exports = async (client, id) => { 4 | console.log(white('[') + yellow('WARN') + white('] ') + yellow('Shard ') + white(id) + yellow(' Shard Reconnected!')); 5 | } -------------------------------------------------------------------------------- /Events/Client/shardResume.js: -------------------------------------------------------------------------------- 1 | const { white, yellow } = require("chalk"); 2 | 3 | module.exports = async (client, id) => { 4 | console.log(white('[') + yellow('WARN') + white('] ') + yellow('Shard ') + white(id) + yellow(' Shard Resumed!')); 5 | } -------------------------------------------------------------------------------- /Events/Client/warn.js: -------------------------------------------------------------------------------- 1 | const { white, yellow } = require('chalk'); 2 | 3 | module.exports = async (client) => { 4 | console.log(white('[') + yellow('WARN') + white('] ') + yellow('Warned ') + white(`${client.user.tag} (${client.user.id})`) + yellow(' ')); 5 | }; 6 | -------------------------------------------------------------------------------- /Events/Guild/interactionCreate.js: -------------------------------------------------------------------------------- 1 | const { 2 | PermissionsBitField 3 | } = require("discord.js"); 4 | const chalk = require("chalk"); 5 | module.exports = async (client, interaction) => { 6 | //=================================== Command Interaction =====================================\\ 7 | if ( 8 | interaction.isCommand || 9 | interaction.isContextMenuCommand || 10 | interaction.isChatInputCommand 11 | ) { 12 | if (!interaction.guild || interaction.user.bot) return; 13 | 14 | const user = client.premiums.get(interaction.user.id); 15 | 16 | let subCommandName = ""; 17 | try { 18 | subCommandName = interaction.options.getSubcommand(); 19 | } catch {} 20 | let subCommandGroupName = ""; 21 | try { 22 | subCommandGroupName = interaction.options.getSubcommandGroup(); 23 | } catch {} 24 | 25 | const command = client.slash.find((command) => { 26 | switch (command.name.length) { 27 | case 1: 28 | return command.name[0] == interaction.commandName; 29 | case 2: 30 | return ( 31 | command.name[0] == interaction.commandName && 32 | command.name[1] == subCommandName 33 | ); 34 | case 3: 35 | return ( 36 | command.name[0] == interaction.commandName && 37 | command.name[1] == subCommandGroupName && 38 | command.name[2] == subCommandName 39 | ); 40 | } 41 | }); 42 | if (!command) return; 43 | 44 | console.log( 45 | chalk.bgRed( 46 | `[COMMAND] ${interaction.user.tag} Used ${command.name.at(-1)} in ${ 47 | interaction.guild.name 48 | } (${interaction.guild.id})` 49 | ) 50 | ); 51 | //check default permission (must need) 52 | if ( 53 | !interaction.guild.members.me.permissions.has( 54 | PermissionsBitField.Flags.SendMessages 55 | ) 56 | ) 57 | return interaction.user.dmChannel.send( 58 | `I don't have permissions To \`SendMessages\`` 59 | ); 60 | if ( 61 | !interaction.guild.members.me.permissions.has( 62 | PermissionsBitField.Flags.ViewChannel 63 | ) 64 | ) 65 | return; 66 | if ( 67 | !interaction.guild.members.me.permissions.has( 68 | PermissionsBitField.Flags.EmbedLinks 69 | ) 70 | ) 71 | return interaction.reply({ 72 | content: `I don't have permissions To \`EmbedLinks\``, 73 | ephemeral: true, 74 | }); 75 | 76 | 77 | const { channel } = interaction.member.voice; 78 | //check in voice channel 79 | if (command.settings.inVoice) { 80 | if (!channel) 81 | return interaction.reply({ 82 | content: `Command Is Set To Be In Voice Please Get In A Voice Channel`, 83 | ephemeral: true, 84 | }); 85 | // check bot perms in voice channel 86 | if ( 87 | !interaction.guild.members.cache 88 | .get(client.user.id) 89 | .permissionsIn(channel) 90 | .has(command.permissions.channel || []) 91 | ) { 92 | return interaction.reply({ 93 | content: `I Don't have permission \`${command.permissions.bot.join(", ")}\``, 94 | ephemeral: true, 95 | }); 96 | } 97 | } 98 | 99 | //check user premium 100 | if (command.settings.isPremium && !user.isPremium) { 101 | return interaction.reply({ 102 | content: `This Command Is Set To Be Premium. So Buy Premium To Use This Command`, 103 | ephemeral: true, 104 | }); 105 | } 106 | //check owner 107 | if (command.settings.isOwner && interaction.user.id !== client.owner) { 108 | return interaction.reply({ 109 | content: `This Command Is For Owner Only`, 110 | ephemeral: true, 111 | }); 112 | } 113 | //check nsfw 114 | if(command.settings.isNSFW && !interaction.channel.nsfw) { 115 | return interaction.reply({ 116 | content: `This Command Can Be Use In Only NSFW channels`, 117 | ephemeral: true, 118 | }); 119 | } 120 | //check bot permissions in guild 121 | if ( 122 | !interaction.guild.members.me.permissions.has( 123 | command.permissions.bot || [] 124 | ) 125 | ) { 126 | return interaction.reply({ 127 | content: `I Need ${command.permissions.bot.join(", ")} To Use This Command`, 128 | ephemeral: true, 129 | }); 130 | } 131 | //check user permissions 132 | if (!interaction.member.permissions.has(command.permissions.user || [])) { 133 | return interaction.reply({ 134 | content: `You Need \`${command.permissions.user.join(", ")}\``, 135 | ephemeral: true, 136 | }); 137 | } 138 | 139 | if (command) { 140 | try { 141 | command.run(interaction, client); 142 | } catch (error) { 143 | await interaction.reply({ 144 | content: `This Slash Command Is Not Registered And Hence Not Supported`, 145 | ephmeral: true, 146 | }); 147 | } 148 | } 149 | } 150 | //=================================== Button Interaction =====================================\\ 151 | // if(interaction.isButton()) {} 152 | }; 153 | -------------------------------------------------------------------------------- /Examples/command.js: -------------------------------------------------------------------------------- 1 | const { 2 | ApplicationCommandOptionType, 3 | ChannelType, 4 | EmbedBuilder, 5 | PermissionFlagsBits, 6 | } = require("discord.js"); 7 | module.exports = { 8 | name: [], 9 | description: "", 10 | category: "", 11 | options: [], 12 | permissions: { 13 | channel: [], 14 | bot: [], 15 | user: [], 16 | }, 17 | settings: { 18 | isPremium: false, 19 | isOwner: false, 20 | inVoice: false, 21 | isNSFW: false, 22 | }, 23 | run: async (interaction, client) => {}, 24 | }; 25 | -------------------------------------------------------------------------------- /Handler/Antinuke.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, AuditLogEvent, PermissionFlagsBits } = require("discord.js"); 2 | const GuildSettings = require("../../Models/Antinuke"); 3 | 4 | module.exports = (client) => { 5 | //=================================== Anti Channel Events ===================================// 6 | client.on("channelCreate", async (channel) => { 7 | if(!channel.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 8 | const auditlogs = await channel.guild.fetchAuditLogs({ 9 | type: AuditLogEvent.ChannelCreate, 10 | limit: 1, 11 | }); 12 | const logs = auditlogs.entries.first(); 13 | if(!logs) return; 14 | const { executor } = logs; 15 | 16 | await GuildSettings.findOne( 17 | { guildId: channel.guild.id }, 18 | async (err, data) => { 19 | if(!data) return; 20 | const antinuke = data.enabled.channels; 21 | const trusted = data.whitelist.channels.includes(executor.id); 22 | const owner = data.ownerLevel.includes(executor.id); 23 | 24 | if (executor.id === channel.guild.ownerId) return; 25 | if (executor.id === client.user.id) return; 26 | if (antinuke === false) return; 27 | if (trusted === true) return; 28 | if (owner === true) return; 29 | 30 | channel.delete(); 31 | const member = await channel.guild.members.fetch(executor.id); 32 | member.ban({ reason: "© Nityam Anti Channel Create" }); 33 | 34 | const logChannel = channel.guild.channels.cache.get(data.logChannel); 35 | if (logChannel) { 36 | logChannel.send({ 37 | embeds: [ 38 | new EmbedBuilder() 39 | .setColor(client.color) 40 | .setAuthor({ 41 | name: client.user.username, 42 | iconURL: client.user.displayAvatarURL(), 43 | }) 44 | .addFields( 45 | { 46 | name: "Category", 47 | value: `> Anti Channel Create`, 48 | }, 49 | { 50 | name: "Log Type", 51 | value: "> User Banned", 52 | }, 53 | { 54 | name: "User", 55 | value: `> ${executor} ${executor.id}`, 56 | }, 57 | { 58 | name: "Reason", 59 | value: `> Creating Channels`, 60 | } 61 | ) 62 | .setFooter({ text: `© Nityam Antinuke Logs` }) 63 | .setTimestamp(), 64 | ], 65 | }); 66 | } 67 | } 68 | ); 69 | }); 70 | 71 | client.on("channelDelete", async (channel) => { 72 | if(!channel.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 73 | const auditlogs = await channel.guild.fetchAuditLogs({ 74 | type: AuditLogEvent.ChannelDelete, 75 | limit: 1, 76 | }); 77 | const logs = auditlogs.entries.first(); 78 | if(!logs) return; 79 | const { executor } = logs; 80 | 81 | await GuildSettings.findOne( 82 | { guildId: channel.guild.id }, 83 | async (err, data) => { 84 | if(!data) return; 85 | const antinuke = data.enabled.channels; 86 | const trusted = data.whitelist.channels.includes(executor.id); 87 | const owner = data.ownerLevel.includes(executor.id); 88 | 89 | if (executor.id === channel.guild.ownerId) return; 90 | if (executor.id === client.user.id) return; 91 | if (antinuke === false) return; 92 | if (trusted === true) return; 93 | if (owner === true) return; 94 | 95 | channel.clone(); 96 | 97 | const member = await channel.guild.members.fetch(executor.id); 98 | member.ban({ reason: "© Nityam Anti Channel Delete" }); 99 | 100 | const logChannel = channel.guild.channels.cache.get(data.logChannel); 101 | if (logChannel) { 102 | logChannel.send({ 103 | embeds: [ 104 | new EmbedBuilder() 105 | .setColor(client.color) 106 | .setAuthor({ 107 | name: client.user.username, 108 | iconURL: client.user.displayAvatarURL(), 109 | }) 110 | .addFields( 111 | { 112 | name: "Category", 113 | value: `> Anti Channel Delete`, 114 | }, 115 | { 116 | name: "Log Type", 117 | value: "> User Banned", 118 | }, 119 | { 120 | name: "User", 121 | value: `> ${executor} ${executor.id}`, 122 | }, 123 | { 124 | name: "Reason", 125 | value: `> Deleting Channels`, 126 | } 127 | ) 128 | .setFooter({ text: `© Nityam Antinuke Logs` }) 129 | .setTimestamp(), 130 | ], 131 | }); 132 | } 133 | } 134 | ); 135 | }); 136 | 137 | client.on("channelUpdate", async (o, n) => { 138 | if(!n.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 139 | const auditlogs = await n.guild.fetchAuditLogs({ 140 | type: AuditLogEvent.ChannelUpdate, 141 | limit: 1, 142 | }); 143 | const logs = auditlogs.entries.first(); 144 | if(!logs) return; 145 | const { executor } = logs; 146 | 147 | await GuildSettings.findOne({ guildId: o.guild.id }, async (err, data) => { 148 | if(!data) return; 149 | const antinuke = data.enabled.channels; 150 | const trusted = data.whitelist.channels.includes(executor.id); 151 | const owner = data.ownerLevel.includes(executor.id); 152 | 153 | if (executor.id === o.guild.ownerId) return; 154 | if (executor.id === client.user.id) return; 155 | if (antinuke === false) return; 156 | if (trusted === true) return; 157 | if (owner === true) return; 158 | 159 | const oldName = o.name; 160 | const newName = n.name; 161 | 162 | const member = await n.guild.members.fetch(executor.id); 163 | member.ban({ reason: "© Nityam Anti Channel Update" }); 164 | 165 | const logChannel = channel.guild.channels.cache.get(data.logChannel); 166 | if (logChannel) { 167 | logChannel.send({ 168 | embeds: [ 169 | new EmbedBuilder() 170 | .setColor(client.color) 171 | .setAuthor({ 172 | name: client.user.username, 173 | iconURL: client.user.displayAvatarURL(), 174 | }) 175 | .addFields( 176 | { 177 | name: "Category", 178 | value: `> Anti Channel Update`, 179 | }, 180 | { 181 | name: "Log Type", 182 | value: "> User Banned", 183 | }, 184 | { 185 | name: "User", 186 | value: `> ${executor} ${executor.id}`, 187 | }, 188 | { 189 | name: "Reason", 190 | value: `> Updating Channels`, 191 | } 192 | ) 193 | .setFooter({ text: `© Nityam Antinuke Logs` }) 194 | .setTimestamp(), 195 | ], 196 | }); 197 | } 198 | 199 | if (oldName !== newName) { 200 | await n.edit({ 201 | name: oldName, 202 | }); 203 | } 204 | if (n.isText()) { 205 | const oldTopic = o.topic; 206 | const newTopic = n.topic; 207 | if (oldTopic !== newTopic) { 208 | await n.setTopic(oldTopic); 209 | } 210 | } 211 | }); 212 | }); 213 | 214 | //=================================== Anti Role Events ===================================// 215 | 216 | client.on("roleCreate", async (role) => { 217 | if(!role.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 218 | const auditlogs = await role.guild.fetchAuditLogs({ 219 | type: AuditLogEvent.RoleCreate, 220 | limit: 1, 221 | }); 222 | const logs = auditlogs.entries.first(); 223 | if(!logs) return; 224 | const { executor } = logs; 225 | 226 | await GuildSettings.findOne( 227 | { guildId: role.guild.id }, 228 | async (err, data) => { 229 | if(!data) return; 230 | const antinuke = data.enabled.roles; 231 | const trusted = data.whitelist.roles.includes(executor.id); 232 | const owner = data.ownerLevel.includes(executor.id); 233 | 234 | if (executor.id === role.guild.ownerId) return; 235 | if (executor.id === client.user.id) return; 236 | if (antinuke === false) return; 237 | if (trusted === true) return; 238 | if (owner === true) return; 239 | 240 | role.delete(); 241 | const member = await role.guild.members.fetch(executor.id); 242 | member.ban({ reason: "© Nityam Anti Role Create" }); 243 | 244 | const logChannel = role.guild.channels.cache.get(data.logChannel); 245 | if (logChannel) { 246 | logChannel.send({ 247 | embeds: [ 248 | new EmbedBuilder() 249 | .setColor(client.color) 250 | .setAuthor({ 251 | name: client.user.username, 252 | iconURL: client.user.displayAvatarURL(), 253 | }) 254 | .addFields( 255 | { 256 | name: "Category", 257 | value: `> Anti Role Create`, 258 | }, 259 | { 260 | name: "Log Type", 261 | value: "> User Banned", 262 | }, 263 | { 264 | name: "User", 265 | value: `> ${executor} ${executor.id}`, 266 | }, 267 | { 268 | name: "Reason", 269 | value: `> Creating Roles`, 270 | } 271 | ) 272 | .setFooter({ text: `© Nityam Antinuke Logs` }) 273 | .setTimestamp(), 274 | ], 275 | }); 276 | } 277 | } 278 | ); 279 | }); 280 | 281 | client.on("roleUpdate", async (o, n) => { 282 | if(!n.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 283 | const auditlogs = await n.guild.fetchAuditLogs({ 284 | type: AuditLogEvent.RoleUpdate, 285 | limit: 1, 286 | }); 287 | const logs = auditlogs.entries.first(); 288 | if(!logs) return; 289 | const { executor } = logs; 290 | 291 | await GuildSettings.findOne({ guildId: o.guild.id }, async (err, data) => { 292 | if(!data) return; 293 | const antinuke = data.enabled.roles; 294 | const trusted = data.whitelist.roles.includes(executor.id); 295 | const owner = data.ownerLevel.includes(executor.id); 296 | 297 | if (executor.id === n.guild.ownerId) return; 298 | if (executor.id === client.user.id) return; 299 | if (antinuke === false) return; 300 | if (trusted === true) return; 301 | if (owner === true) return; 302 | 303 | n.setPermissions(o.permissions); 304 | const member = await n.guild.members.fetch(executor.id); 305 | member.ban({ reason: "© Nityam Anti Role Update" }); 306 | 307 | const logChannel = role.guild.channels.cache.get(data.logChannel); 308 | if (logChannel) { 309 | logChannel.send({ 310 | embeds: [ 311 | new EmbedBuilder() 312 | .setColor(client.color) 313 | .setAuthor({ 314 | name: client.user.username, 315 | iconURL: client.user.displayAvatarURL(), 316 | }) 317 | .addFields( 318 | { 319 | name: "Category", 320 | value: `> Anti Role Update`, 321 | }, 322 | { 323 | name: "Log Type", 324 | value: "> User Banned", 325 | }, 326 | { 327 | name: "User", 328 | value: `> ${executor} ${executor.id}`, 329 | }, 330 | { 331 | name: "Reason", 332 | value: `> Updating Roles`, 333 | } 334 | ) 335 | .setFooter({ text: `© Nityam Antinuke Logs` }) 336 | .setTimestamp(), 337 | ], 338 | }); 339 | } 340 | }); 341 | }); 342 | 343 | client.on("roleDelete", async (role) => { 344 | if(!role.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 345 | const auditlogs = await role.guild.fetchAuditLogs({ 346 | type: AuditLogEvent.RoleDelete, 347 | limit: 1, 348 | }); 349 | const logs = auditlogs.entries.first(); 350 | if(!logs) return; 351 | const { executor } = logs; 352 | 353 | await GuildSettings.findOne( 354 | { guildId: role.guild.id }, 355 | async (err, data) => { 356 | if(!data) return; 357 | const antinuke = data.enabled.roles; 358 | const trusted = data.whitelist.roles.includes(executor.id); 359 | const owner = data.ownerLevel.includes(executor.id); 360 | 361 | if (executor.id === role.guild.ownerId) return; 362 | if (executor.id === client.user.id) return; 363 | if (antinuke === false) return; 364 | if (trusted === true) return; 365 | if (owner === true) return; 366 | if (role.managed) return; 367 | 368 | role.guild.roles.create({ name: role.name, color: role.color }); 369 | const member = await role.guild.members.fetch(executor.id); 370 | member.ban({ reason: "© Nityam Anti Role Delete" }); 371 | 372 | const logChannel = role.guild.channels.cache.get(data.logChannel); 373 | if (logChannel) { 374 | logChannel.send({ 375 | embeds: [ 376 | new EmbedBuilder() 377 | .setColor(client.color) 378 | .setAuthor({ 379 | name: client.user.username, 380 | iconURL: client.user.displayAvatarURL(), 381 | }) 382 | .addFields( 383 | { 384 | name: "Category", 385 | value: `> Anti Role Delete`, 386 | }, 387 | { 388 | name: "Log Type", 389 | value: "> User Banned", 390 | }, 391 | { 392 | name: "User", 393 | value: `> ${executor} ${executor.id}`, 394 | }, 395 | { 396 | name: "Reason", 397 | value: `> Deleting Roles`, 398 | } 399 | ) 400 | .setFooter({ text: `© Nityam Antinuke Logs` }) 401 | .setTimestamp(), 402 | ], 403 | }); 404 | } 405 | } 406 | ); 407 | }); 408 | 409 | //=================================== Anti Member Events ===================================// 410 | client.on("guildMemberUpdate", async (o, n) => { 411 | if(!n.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 412 | const auditLogs = await n.guild.fetchAuditLogs({ 413 | limit: 1, 414 | type: AuditLogEvent.MemberRoleUpdate, 415 | }); 416 | const logs = auditLogs.entries.first(); 417 | if(!logs) return; 418 | const { executor, target } = logs; 419 | 420 | await GuildSettings.findOne({ guildId: o.guild.id }, async (err, data) => { 421 | 422 | if(!data) return; 423 | const antinuke = data.enabled.roles; 424 | const trusted = data.whitelist.roles.includes(executor.id); 425 | const owner = data.ownerLevel.includes(executor.id); 426 | 427 | if (antinuke === false) return; 428 | if (trusted === true) return; 429 | if (owner === true) return; 430 | if (executor.id === client.user.id) return; 431 | if (executor.id === n.guild.ownerId) return; 432 | 433 | const oldRoles = o.roles; 434 | const newRoles = n.roles; 435 | 436 | if (oldRoles !== newRoles) { 437 | n.roles.set(o.roles.cache); 438 | } 439 | 440 | const member = await n.guild.members.fetch(executor.id); 441 | member.ban({ reason: "© Nityam Anti Member Role Update" }); 442 | 443 | const logChannel = role.guild.channels.cache.get(data.logChannel); 444 | if (logChannel) { 445 | logChannel.send({ 446 | embeds: [ 447 | new EmbedBuilder() 448 | .setColor(client.color) 449 | .setAuthor({ 450 | name: client.user.username, 451 | iconURL: client.user.displayAvatarURL(), 452 | }) 453 | .addFields( 454 | { 455 | name: "Category", 456 | value: `> Anti Member Role Update`, 457 | }, 458 | { 459 | name: "Log Type", 460 | value: "> User Banned", 461 | }, 462 | { 463 | name: "User", 464 | value: `> ${executor} ${executor.id}`, 465 | }, 466 | { 467 | name: "Reason", 468 | value: `> Updating Member Roles`, 469 | } 470 | ) 471 | .setFooter({ text: `© Nityam Antinuke Logs` }) 472 | .setTimestamp(), 473 | ], 474 | }); 475 | } 476 | }); 477 | }); 478 | 479 | //=================================== Anti Ban Events ===================================// 480 | client.on("guildBanAdd", async (member) => { 481 | if(!member.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 482 | const auditLogs = await member.guild.fetchAuditLogs({ 483 | type: AuditLogEvent.MemberBanAdd, 484 | limit: 1, 485 | }); 486 | const logs = auditLogs.entries.first(); 487 | if(!logs) return; 488 | const { executor, target } = logs; 489 | 490 | await GuildSettings.findOne( 491 | { guildId: member.guild.id }, 492 | async (err, data) => { 493 | if(!data) return; 494 | const antinuke = data.enabled.bans; 495 | const trusted = data.whitelist.bans.includes(executor.id); 496 | const owner = data.ownerLevel.includes(executor.id); 497 | 498 | if (antinuke === false) return; 499 | if (trusted === true) return; 500 | if (member.id !== target.id) return; 501 | if (owner === true) return; 502 | if (executor.id === client.user.id) return; 503 | if (executor.id === member.guild.ownerId) return; 504 | 505 | const member2 = member.guild.members.fetch(executor.id); 506 | member2.ban({ reason: "© Nityam Anti Member Ban " }); 507 | 508 | const logChannel = member.guild.channels.cache.get(data.logChannel); 509 | if (logChannel) { 510 | logChannel.send({ 511 | embeds: [ 512 | new EmbedBuilder() 513 | .setColor(client.color) 514 | .setAuthor({ 515 | name: client.user.username, 516 | iconURL: client.user.displayAvatarURL(), 517 | }) 518 | .addFields( 519 | { 520 | name: "Category", 521 | value: `> Anti Member Ban`, 522 | }, 523 | { 524 | name: "Log Type", 525 | value: "> User Banned", 526 | }, 527 | { 528 | name: "User", 529 | value: `> ${executor} ${executor.id}`, 530 | }, 531 | { 532 | name: "Reason", 533 | value: "> Baning Members", 534 | }, 535 | { 536 | name: "Target", 537 | value: `> ${target} ${target.id}`, 538 | } 539 | ) 540 | .setFooter({ text: `© Nityam Antinuke Logs` }) 541 | .setTimestamp(), 542 | ], 543 | }); 544 | } 545 | } 546 | ); 547 | }); 548 | 549 | //=================================== Anti Kick Events ===================================// 550 | client.on("guildMemberRemove", async (member) => { 551 | if(!member.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 552 | const auditLogs = await member.guild.fetchAuditLogs({ 553 | type: AuditLogEvent.MemberKick, 554 | limit: 1, 555 | }); 556 | const logs = auditLogs.entries.first(); 557 | if(!logs) return; 558 | const { executor, target } = logs; 559 | 560 | await GuildSettings.findOne( 561 | { guildId: member.guild.id }, 562 | async (err, data) => { 563 | if(!data) return; 564 | const antinuke = data.enabled.kicks; 565 | const trusted = data.whitelist.kicks.includes(executor.id); 566 | const owner = data.ownerLevel.includes(executor.id); 567 | 568 | if (executor.id === client.user.id) return; 569 | if (executor.id === member.guild.ownerId) return; 570 | if (antinuke === false) return; 571 | if (member.id !== target.id) return; 572 | if (trusted === true) return; 573 | if (owner === true) return; 574 | 575 | const member2 = member.guild.members.fetch(executor.id); 576 | member2.ban({ reason: "© Nityam Anti Member Kick " }); 577 | 578 | const logChannel = member.guild.channels.cache.get(data.logChannel); 579 | if (logChannel) { 580 | logChannel.send({ 581 | embeds: [ 582 | new EmbedBuilder() 583 | .setColor(client.color) 584 | .setAuthor({ 585 | name: client.user.username, 586 | iconURL: client.user.displayAvatarURL(), 587 | }) 588 | .addFields( 589 | { 590 | name: "Category", 591 | value: `> Anti Member Kick`, 592 | }, 593 | { 594 | name: "Log Type", 595 | value: "> User Banned", 596 | }, 597 | { 598 | name: "User", 599 | value: `> ${executor} ${executor.id}`, 600 | }, 601 | { 602 | name: "Reason", 603 | value: "> Kicking Members", 604 | }, 605 | { 606 | name: "Target", 607 | value: `> ${target} ${target.id}`, 608 | } 609 | ) 610 | .setFooter({ text: `© Nityam Antinuke Logs` }) 611 | .setTimestamp(), 612 | ], 613 | }); 614 | } 615 | } 616 | ); 617 | }); 618 | 619 | //=================================== Anti Bot Events ===================================// 620 | client.on("guildMemberAdd", async (member) => { 621 | if(!member.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 622 | const auditLogs = await member.guild.fetchAuditLogs({ 623 | type: AuditLogEvent.BotAdd, 624 | limit: 1, 625 | }); 626 | const logs = auditLogs.entries.first(); 627 | if(!logs) return; 628 | const { executor, target } = logs; 629 | 630 | await GuildSettings.findOne( 631 | { guildId: member.guild.id }, 632 | async (err, data) => { 633 | if(!data) return; 634 | const antinuke = data.enabled.antibot; 635 | const trusted = data.whitelist.antibot.includes(executor.id); 636 | const owner = data.ownerLevel.includes(executor.id); 637 | 638 | if (executor.id === client.user.id) return; 639 | if (executor.id === member.guild.ownerId) return; 640 | if (antinuke === false) return; 641 | if (trusted === true) return; 642 | if (!target.bot) return; 643 | if (owner === true) return; 644 | if (target.id !== member.id) return; 645 | 646 | const member3 = member.guild.members.fetch(executor.id); 647 | member3.ban({ reason: "© Nityam Anti Bot Add " }); 648 | const member2 = member.guild.members.fetch(target.id); 649 | member2.ban({ reason: "© Nityam Anti Bot Add " }); 650 | 651 | const logChannel = member.guild.channels.cache.get(data.logChannel); 652 | if (logChannel) { 653 | logChannel.send({ 654 | embeds: [ 655 | new EmbedBuilder() 656 | .setColor(client.color) 657 | .setAuthor({ 658 | name: client.user.username, 659 | iconURL: client.user.displayAvatarURL(), 660 | }) 661 | .addFields( 662 | { 663 | name: "Category", 664 | value: `> Anti Bot Add`, 665 | }, 666 | { 667 | name: "Log Type", 668 | value: "> User Banned", 669 | }, 670 | { 671 | name: "User", 672 | value: `> ${executor} ${executor.id}`, 673 | }, 674 | { 675 | name: "Reason", 676 | value: "> Illegal Bot Add", 677 | }, 678 | { 679 | name: "Bot", 680 | value: `> ${target} ${target.id}`, 681 | } 682 | ) 683 | .setFooter({ text: `© Nityam Antinuke Logs` }) 684 | .setTimestamp(), 685 | ], 686 | }); 687 | } 688 | } 689 | ); 690 | }); 691 | 692 | //=================================== Anti Webhook Events ===================================// 693 | 694 | client.on("webhookUpdate", async (webhook) => { 695 | if(!webhook.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 696 | const auditLog = await webhook.guild.fetchAuditLogs({ 697 | limit: 1, 698 | type: AuditLogEvent.WebhookUpdate, 699 | }); 700 | const logs = auditLog.entries.first(); 701 | if(!logs) return; 702 | const { executor } = logs; 703 | 704 | await GuildSettings.findOne( 705 | { guildId: webhook.guild.id }, 706 | async (err, data) => { 707 | if(!data) return; 708 | const antinuke = data.enabled.webhooks; 709 | const trusted = data.whitelist.webhooks.includes(executor.id); 710 | const owner = data.ownerLevel.includes(executor.id); 711 | 712 | if (antinuke === false) return; 713 | if (trusted === true) return; 714 | if (owner === true) return; 715 | if (executor.id === client.user.id) return; 716 | if (executor.id === webhook.guild.ownerId) return; 717 | 718 | const member = webhook.guild.members.fetch(executor.id); 719 | member.ban({ reason: "© Nityam Anti Webhook Update" }); 720 | 721 | const logChannel = webhook.guild.channels.cache.get(data.logChannel); 722 | if (logChannel) { 723 | logChannel.send({ 724 | embeds: [ 725 | new EmbedBuilder() 726 | .setColor(client.color) 727 | .setAuthor({ 728 | name: client.user.username, 729 | iconURL: client.user.displayAvatarURL(), 730 | }) 731 | .addFields( 732 | { 733 | name: "Category", 734 | value: `> Anti Webhook Update`, 735 | }, 736 | { 737 | name: "Log Type", 738 | value: "> User Banned", 739 | }, 740 | { 741 | name: "User", 742 | value: `> ${executor} ${executor.id}`, 743 | }, 744 | { 745 | name: "Reason", 746 | value: "> Updating Webhook", 747 | } 748 | ) 749 | .setFooter({ text: `© Nityam Antinuke Logs` }) 750 | .setTimestamp(), 751 | ], 752 | }); 753 | } 754 | } 755 | ); 756 | }); 757 | 758 | client.on("webhookUpdate", async (webhook) => { 759 | if(!webhook.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 760 | const auditLog = await webhook.guild.fetchAuditLogs({ 761 | limit: 1, 762 | type: AuditLogEvent.WebhookCreate, 763 | }); 764 | const logs = auditLog.entries.first(); 765 | if(!logs) return; 766 | const { executor } = logs; 767 | 768 | await GuildSettings.findOne( 769 | { guildId: webhook.guild.id }, 770 | async (err, data) => { 771 | if(!data) return; 772 | const antinuke = data.enabled.webhooks; 773 | const trusted = data.whitelist.webhooks.includes(executor.id); 774 | const owner = data.ownerLevel.includes(executor.id); 775 | 776 | if (antinuke === false) return; 777 | if (trusted === true) return; 778 | if (owner === true) return; 779 | if (executor.id === client.user.id) return; 780 | if (executor.id === webhook.guild.ownerId) return; 781 | 782 | const member = webhook.guild.members.fetch(executor.id); 783 | member.ban({ reason: "© Nityam Anti Webhook Create" }); 784 | 785 | const logChannel = webhook.guild.channels.cache.get(data.logChannel); 786 | if (logChannel) { 787 | logChannel.send({ 788 | embeds: [ 789 | new EmbedBuilder() 790 | .setColor(client.color) 791 | .setAuthor({ 792 | name: client.user.username, 793 | iconURL: client.user.displayAvatarURL(), 794 | }) 795 | .addFields( 796 | { 797 | name: "Category", 798 | value: `> Anti Webhook Create`, 799 | }, 800 | { 801 | name: "Log Type", 802 | value: "> User Banned", 803 | }, 804 | { 805 | name: "User", 806 | value: `> ${executor} ${executor.id}`, 807 | }, 808 | { 809 | name: "Reason", 810 | value: "> Creating Webhooks", 811 | } 812 | ) 813 | .setFooter({ text: `© Nityam Antinuke Logs` }) 814 | .setTimestamp(), 815 | ], 816 | }); 817 | } 818 | } 819 | ); 820 | }); 821 | 822 | client.on("webhookUpdate", async (webhook) => { 823 | if(!webhook.guild.members.me.permissions.has(PermissionFlagsBits.ViewAuditLog)) return; 824 | const auditLog = await webhook.guild.fetchAuditLogs({ 825 | limit: 1, 826 | type: AuditLogEvent.WebhookDelete, 827 | }); 828 | const logs = auditLog.entries.first(); 829 | if(!logs) return; 830 | const { executor } = logs; 831 | 832 | await GuildSettings.findOne( 833 | { guildId: webhook.guild.id }, 834 | async (err, data) => { 835 | if(!data) return; 836 | const antinuke = data.enabled.webhooks; 837 | const trusted = data.whitelist.webhooks.includes(executor.id); 838 | const owner = data.ownerLevel.includes(executor.id); 839 | 840 | if (antinuke === false) return; 841 | if (trusted === true) return; 842 | if (owner === true) return; 843 | if (executor.id === client.user.id) return; 844 | if (executor.id === webhook.guild.ownerId) return; 845 | 846 | const member = webhook.guild.members.fetch(executor.id); 847 | member.ban({ reason: "© Nityam Anti Webhook Delete" }); 848 | 849 | const logChannel = webhook.guild.channels.cache.get(data.logChannel); 850 | if (logChannel) { 851 | logChannel.send({ 852 | embeds: [ 853 | new EmbedBuilder() 854 | .setColor(client.color) 855 | .setAuthor({ 856 | name: client.user.username, 857 | iconURL: client.user.displayAvatarURL(), 858 | }) 859 | .addFields( 860 | { 861 | name: "Category", 862 | value: `> Anti Webhook Delete`, 863 | }, 864 | { 865 | name: "Log Type", 866 | value: "> User Banned", 867 | }, 868 | { 869 | name: "User", 870 | value: `> ${executor} ${executor.id}`, 871 | }, 872 | { 873 | name: "Reason", 874 | value: "> © Nityam Anti Webhook Delete", 875 | } 876 | ) 877 | .setFooter({ text: `© Nityam Antinuke Logs` }) 878 | .setTimestamp(), 879 | ], 880 | }); 881 | } 882 | } 883 | ); 884 | }); 885 | 886 | //=================================== Anti Guild Update ===================================// 887 | client.on('guildUpdate', async (o, n) => { 888 | 889 | const auditLog = await o.fetchAuditLogs({ 890 | limit: 1, 891 | type: AuditLogEvent.GuildUpdate, 892 | }); 893 | 894 | const logs = auditLog.entries.first(); 895 | 896 | if (!logs) return; 897 | const { executor } = logs; 898 | 899 | await GuildSettings.findOne( 900 | { guildId: n.id }, 901 | async (err, data) => { 902 | if (!data) return; 903 | const antinuke = data.guildId; 904 | const trusted = data.whitelist.guildUpdate.includes(executor.id); 905 | const owner = data.ownerLevel.includes(executor.id); 906 | 907 | if (antinuke === false) return; 908 | if (trusted === true) return; 909 | if (owner === true) return; 910 | if (executor.id === client.user.id) return; 911 | 912 | const oldIcon = o.iconURL(); 913 | 914 | const oldName = o.name; 915 | 916 | const newIcon = n.iconURL(); 917 | const newName = n.name; 918 | 919 | if (oldName !== newName) { 920 | await n.setName(oldName); 921 | } 922 | 923 | if (oldIcon !== newIcon) { 924 | await o.setIcon(oldIcon); 925 | } 926 | 927 | const member = await n.guild.members.fetch(executor.id); 928 | member.ban({ reason: "© Nityam Anti Guild Update" }); 929 | const logChannel = webhook.guild.channels.cache.get(data.logChannel); 930 | if (logChannel) { 931 | logChannel.send({ 932 | embeds: [ 933 | new EmbedBuilder() 934 | .setColor(client.color) 935 | .setAuthor({ 936 | name: client.user.username, 937 | iconURL: client.user.displayAvatarURL(), 938 | }) 939 | .addFields( 940 | { 941 | name: "Category", 942 | value: `> Anti Guild Update`, 943 | }, 944 | { 945 | name: "Log Type", 946 | value: "> User Banned", 947 | }, 948 | { 949 | name: "User", 950 | value: `> ${executor} ${executor.id}`, 951 | }, 952 | { 953 | name: "Reason", 954 | value: "> © Nityam Anti Guild Update", 955 | } 956 | ) 957 | .setFooter({ text: `© Nityam Antinuke Logs` }) 958 | .setTimestamp(), 959 | ], 960 | }); 961 | } 962 | 963 | 964 | }) 965 | }); 966 | }; 967 | -------------------------------------------------------------------------------- /Handler/Command.js: -------------------------------------------------------------------------------- 1 | const chillout = require("chillout"); 2 | const readdirRecursive = require("recursive-readdir"); 3 | const { resolve, relative } = require("path"); 4 | const { green, white } = require('chalk'); 5 | 6 | module.exports = async (client) => { 7 | let interactionsPath = resolve("./commands"); 8 | let interactionFiles = await readdirRecursive(interactionsPath); 9 | 10 | await chillout.forEach(interactionFiles, (interactionFile) => { 11 | const start = Date.now(); 12 | const rltPath = relative(__dirname, interactionFile); 13 | // console.log(`[INFO] Loading interaction at.. "${interactionFile}"`) 14 | const command = require(interactionFile); 15 | 16 | if (command.name.length > 3) { 17 | console.log(`[WARN] "${rltPath}" The name list of the interaction file is too long. (>3) Skipping..`); 18 | return; 19 | } 20 | 21 | if (!command.name?.length) { 22 | console.log(`[WARN] "${rltPath}" The interaction file does not have a name. Skipping..`); 23 | return; 24 | } 25 | 26 | if (client.slash.has(command.name)) { 27 | console.log(`[WARN] "${command.name[1]}" interaction has already been installed. It's skipping.`) 28 | return; 29 | } 30 | 31 | client.slash.set(command.name, command); 32 | // console.log(`[INFO] "${command.type == "CHAT_INPUT" ? `/${command.name.join(" ")}` : `${command.name[0]}`}" ${command.name[1] || ""} ${command.name[2] || ""} The interaction has been uploaded. (it took ${Date.now() - start}ms)`); 33 | }); 34 | 35 | if (client.slash.size) { 36 | console.log(white('[') + green('INFO') + white('] ') + green(`${client.slash.size} `) + white('Interactions') + green(' Loaded!')); 37 | } else { 38 | console.log(`[WARN] No interactions loaded, is everything ok?`); 39 | } 40 | } -------------------------------------------------------------------------------- /Handler/Database.js: -------------------------------------------------------------------------------- 1 | const { white, green } = require("chalk"); 2 | 3 | module.exports = (client) => { 4 | require("./Database/Connect.js")(client); 5 | require("./Database/Premium.js")(client); 6 | console.log(white('[') + green('INFO') + white('] ') + green('Database ') + white('Events') + green(' Loaded!')); 7 | }; -------------------------------------------------------------------------------- /Handler/Database/Connect.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { MONGO_URI } = require("../../Settings/config") 3 | module.exports = async () => { 4 | try { 5 | await mongoose.connect(MONGO_URI, { 6 | useNewUrlParser: true, 7 | useUnifiedTopology: true, 8 | useFindAndModify: false, 9 | useCreateIndex: true, 10 | }) 11 | } catch (error) { 12 | console.log(error); 13 | } 14 | } -------------------------------------------------------------------------------- /Handler/Database/Premium.js: -------------------------------------------------------------------------------- 1 | const cron = require('node-cron') 2 | const Premium = require("../../Models/Premium"); 3 | 4 | module.exports = async (client) => { 5 | cron.schedule('*/60 * * * * *', async () => { 6 | await Premium.find({ isPremium: true }, async (err, users) => { 7 | if (users && users.length) { 8 | 9 | for (let user of users) { 10 | if (Date.now() >= user.premium.expiresAt) { 11 | 12 | user.isPremium = false 13 | user.premium.redeemedBy = [] 14 | user.premium.redeemedAt = null 15 | user.premium.expiresAt = null 16 | user.premium.plan = null 17 | 18 | const newUser = await user.save({ new: true }).catch(() => {}) 19 | client.premiums.set(newUser.Id, newUser) 20 | } 21 | } 22 | } 23 | }) 24 | }) 25 | } -------------------------------------------------------------------------------- /Handler/Events.js: -------------------------------------------------------------------------------- 1 | const { white, green } = require("chalk"); 2 | const { readdirSync } = require('fs'); 3 | 4 | module.exports = async (client) => { 5 | const loadcommand = dirs =>{ 6 | const events = readdirSync(`./Events/${dirs}/`).filter(d => d.endsWith('.js')); 7 | for (let file of events) { 8 | const evt = require(`../Events/${dirs}/${file}`); 9 | const eName = file.split('.')[0]; 10 | client.on(eName, evt.bind(null, client)); 11 | } 12 | }; 13 | ["Client", "Guild"].forEach((x) => loadcommand(x)); 14 | console.log(white('[') + green('INFO') + white('] ') + green('Event ') + white('Events') + green(' Loaded!')); 15 | }; -------------------------------------------------------------------------------- /Handler/errLogger.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, WebhookClient } = require("discord.js"); 2 | const { inspect } = require("util"); 3 | const config = require("../Settings/config") 4 | const webhook = new WebhookClient({ 5 | url: `${config.webhook.error}` 6 | }); 7 | 8 | module.exports = (client) => { 9 | const embed = new EmbedBuilder().setColor("Red"); 10 | 11 | client.on("error", (err) => { 12 | console.log(err); 13 | 14 | embed 15 | .setTitle("Discord API Error") 16 | .setURL("https://discordjs.guide/popular-topics/errors.html#api-errors") 17 | .setDescription( 18 | `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\`` 19 | ) 20 | .setTimestamp(); 21 | 22 | return webhook.send({ embeds: [embed] }); 23 | }); 24 | 25 | process.on("unhandledRejection", (reason, promise) => { 26 | console.log(reason, "\n", promise); 27 | 28 | embed 29 | .setTitle("Unhandled Rejection/Catch") 30 | .setURL("https://nodejs.org/api/process.html#event-unhandledrejection") 31 | .addFields( 32 | { 33 | name: "Reason", 34 | value: `\`\`\`${inspect(reason, { depth: 0 }).slice(0, 1000)}\`\`\``, 35 | }, 36 | { 37 | name: "Promise", 38 | value: `\`\`\`${inspect(promise, { depth: 0 }).slice(0, 1000)}\`\`\``, 39 | } 40 | ) 41 | .setTimestamp(); 42 | 43 | return webhook.send({ embeds: [embed] }); 44 | }); 45 | 46 | process.on("uncaughtException", (err, origin) => { 47 | console.log(err, "\n", origin); 48 | 49 | embed 50 | .setTitle("Uncaught Exception/Catch") 51 | .setURL("https://nodejs.org/api/process.html#event-uncaughtexception") 52 | .addFields( 53 | { 54 | name: "Error", 55 | value: `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, 56 | }, 57 | { 58 | name: "Origin", 59 | value: `\`\`\`${inspect(origin, { depth: 0 }).slice(0, 1000)}\`\`\``, 60 | } 61 | ) 62 | .setTimestamp(); 63 | 64 | return webhook.send({ embeds: [embed] }); 65 | }); 66 | 67 | process.on("uncaughtExceptionMonitor", (err, origin) => { 68 | console.log(err, "\n", origin); 69 | 70 | embed 71 | .setTitle("Uncaught Exception Monitor") 72 | .setURL( 73 | "https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor" 74 | ) 75 | .addFields( 76 | { 77 | name: "Error", 78 | value: `\`\`\`${inspect(err, { depth: 0 }).slice(0, 1000)}\`\`\``, 79 | }, 80 | { 81 | name: "Origin", 82 | value: `\`\`\`${inspect(origin, { depth: 0 }).slice(0, 1000)}\`\`\``, 83 | } 84 | ) 85 | .setTimestamp(); 86 | 87 | return webhook.send({ embeds: [embed] }); 88 | }); 89 | 90 | process.on("warning", (warn) => { 91 | console.log(warn); 92 | 93 | embed 94 | .setTitle("Uncaught Exception Monitor Warning") 95 | .setURL("https://nodejs.org/api/process.html#event-warning") 96 | .addFields({ 97 | name: "Warning", 98 | value: `\`\`\`${inspect(warn, { depth: 0 }).slice(0, 1000)}\`\`\``, 99 | }) 100 | .setTimestamp(); 101 | 102 | return webhook.send({ embeds: [embed] }); 103 | }); 104 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 - 2024 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Models/Antinuke.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const guildSettingsSchema = new mongoose.Schema({ 4 | guildId: { type: String, required: true, unique: true }, 5 | whitelist: { 6 | roles: [{ type: String }], 7 | channels: [{ type: String }], 8 | webhooks: [{ type: String }], 9 | kicks: [{ type: String }], 10 | bans: [{ type: String }], 11 | antibot: [{ type: String }], 12 | guildUpdate: [{ type: String }] 13 | }, 14 | actions: [{ 15 | userId: { type: String, required: true }, 16 | category: { type: String, enum: ['roles', 'channels', 'webhooks', 'kicks', 'bans', 'antibot', 'guildUpdate'], required: true }, 17 | timestamp: { type: Date, default: Date.now }, 18 | }], 19 | logChannel: { type: String, default: null }, 20 | enabled: { 21 | roles: { type: Boolean, default: false }, 22 | channels: { type: Boolean, default: false }, 23 | webhooks: { type: Boolean, default: false }, 24 | kicks: { type: Boolean, default: false }, 25 | bans: { type: Boolean, default: false }, 26 | antibot: { type: Boolean, default: false }, 27 | guildUpdate: { type: Boolean, default: false } 28 | }, 29 | ownerLevel: [{ type: String, default: null }], 30 | }); 31 | 32 | module.exports = mongoose.model('GuildSettings4', guildSettingsSchema); 33 | -------------------------------------------------------------------------------- /Models/Premium.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | 3 | const CreatePremium = mongoose.Schema({ 4 | Id: { 5 | type: String, 6 | required: true, 7 | unique: true 8 | }, 9 | isPremium: { 10 | type: Boolean, 11 | default: false 12 | }, 13 | premium: { 14 | redeemedBy: { 15 | type: Array, 16 | default: null 17 | }, 18 | redeemedAt: { 19 | type: Number, 20 | default: null 21 | }, 22 | expiresAt: { 23 | type: Number, 24 | default: null 25 | }, 26 | plan: { 27 | type: String, 28 | default: null 29 | } 30 | } 31 | }) 32 | module.exports = mongoose.model('Premium', CreatePremium) -------------------------------------------------------------------------------- /Models/Redeem.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose') 2 | 3 | const CreateRedeem = mongoose.Schema({ 4 | code: { 5 | type: String, 6 | default: null 7 | }, 8 | expiresAt: { 9 | type: Number, 10 | default: null 11 | }, 12 | plan: { 13 | type: String, 14 | default: null 15 | } 16 | }) 17 | 18 | module.exports = mongoose.model('Redeem', CreateRedeem) -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 |

5 | 6 |

7 | 8 | 9 | 10 |

11 | 12 | # Ayush Dev's AntiNuke Discord Bot 13 | 14 | ![GitHub stars](https://img.shields.io/github/stars/grdAyush/Antinuke-bot?style=for-the-badge) 15 | ![GitHub license](https://img.shields.io/github/license/grdAyush/Antinuke-bot?style=for-the-badge) 16 | ![GitHub issues](https://img.shields.io/github/issues-raw/grdAyush/Antinuke-bot?style=for-the-badge) 17 | 18 | ## Features 19 | 20 | - [x] MongoDB Connection 21 | - [x] Anti Role Create/Delete/Update 22 | - [x] Anti Bot Add 23 | - [x] Anti Channel Create/Delete/Update 24 | - [x] Anti Webhook Create/Delete/Update 25 | - [x] Anti Kick 26 | - [x] Anti Ban 27 | - [x] Anti Guild Update (Stickers and Emojis) 28 | - [x] Recovery of Channels And Roles 29 | - [x] Slash Command (Base, Group, Sub) 30 | - [x] Whitelist With Categories 31 | - [x] Owner Level Whitelist 32 | - [x] Log Channel 33 | 34 |
Requirements 35 | 36 | ### Requirements 37 | 38 | - [x] Node.js v16+ [Download Node.js](https://nodejs.org/en/download/) 39 | - [x] Discord Bot Token [Get Bot Token](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot) 40 | - [x] MongoDB URI [Get MongoDB URI](https://www.mongodb.com/docs/manual/reference/connection-string/) 41 | 42 |
43 | 44 | ## Installation 45 | 46 | ```bash 47 | git clone https://github.com/grdAyush/Antinuke-bot 48 | cd Antinuke-bot 49 | npm install or bun install 50 | ``` 51 | 52 |
Configuration 53 | 54 | ### Configuration 55 | 56 | Copy or Rename `.env.example` to `.env` and fill out the values: 57 | 58 | ```env 59 | # Bot 60 | TOKEN=REPLACE_HERE 61 | EMBED_COLOR=#000001 62 | 63 | # Dev 64 | OWNER_ID=REPLACE_HERE 65 | 66 | # Database 67 | MONGO_URI= 68 | 69 | # Webhook Logs Link 70 | error= 71 | join= 72 | leave= 73 | ``` 74 | 75 | After installation, run the bot using: 76 | 77 | ```bash 78 | npm run start or bun run start 79 | ``` 80 | 81 |
82 | 83 |
Commands 84 | 85 | ### Commands 86 | 87 | > Note: The default prefix is '/' 88 | 89 | 👮‍♂️ **Antinuke** 90 | - Enable (/antinuke enable [category]) 91 | - Disable (/antinuke disable [category]) 92 | - LogChannel (/antinuke channel [channel]) 93 | - Settings (/antinuke settings) 94 | - Whitelist Add (/antinuke whitelist add [user] [category]) 95 | - Whitelist Remove (/antinuke whitelist remove [user] [category]) 96 | - Whitelist Owner (/antinuke whitelist owner [user] [choice(add/remove)]) 97 | - Whitelist Show (/antinuke whitelist show [category]) 98 | 99 | 💬 **Utility** 100 | - Ping (/ping) 101 | - Help (/help) 102 | 103 | 💎 **Premium Commands!** 104 | - Generate (/premium generate [plan] [amount]) // (OWNER ONLY) 105 | - Redeem (/redeem [code]) 106 | - Remove (/premium remove [mention]) // (OWNER ONLY) 107 | 108 |
109 | 110 | ## Credits 111 | 112 | Created By [Ayush](https://github.com/grdAyush) 113 | 114 | 115 | -------------------------------------------------------------------------------- /Settings/config.js: -------------------------------------------------------------------------------- 1 | require("dotenv").config(); 2 | module.exports = { 3 | webhook: { 4 | error: "" || process.env.error, //webhook link where error logs are sent 5 | join: "" || process.env.join, //webhook link where join logs are sent 6 | leave: "" || process.env.leave, //webhook link where leave logs are sent 7 | }, 8 | 9 | TOKEN: "" || process.env.TOKEN, //Your Bot Token 10 | MONGO_URI: "" || process.env.MONGO_URI, //Mongo Uri 11 | EMBED_COLOR: "" || process.env.EMBED_COLOR, //Embed Color 12 | DEV_ID: "" || process.env.DEV_ID, //Developer ID 13 | OWNER_ID: "" || process.env.OWNER_ID, //Owner ID 14 | 15 | } -------------------------------------------------------------------------------- /Settings/emojis.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Announce: "", 3 | Anti: "", 4 | Ban: "", 5 | Bell: "", 6 | Bot: "", 7 | Clear: "", 8 | Cross: "", 9 | Disable: "", 10 | Dislike: "", 11 | Enable: "", 12 | Event: "", 13 | TopGG: "", 14 | Github: "", 15 | Giveaway: "", 16 | Info: "", 17 | Invite: "", 18 | Kick: "", 19 | Light: "", 20 | Like: "", 21 | List: "", 22 | Lock: "", 23 | Loop: "", 24 | LowVol: "", 25 | Members: "", 26 | Moderater: "", 27 | Music: "", 28 | Next: "", 29 | Owner: "", 30 | Pause: "", 31 | Ping: "", 32 | Playlist: "", 33 | Previous: "", 34 | Query: "", 35 | wrench: "", 36 | Search: "", 37 | Settings: "", 38 | Shuffle: "", 39 | Star: "", 40 | Stop: "", 41 | Tick: "", 42 | TimeOut: "", 43 | Upvol: "", 44 | Unlock: "", 45 | Warn: "", 46 | ticket: "" 47 | } -------------------------------------------------------------------------------- /bot.js: -------------------------------------------------------------------------------- 1 | const { Client, GatewayIntentBits, Collection } = require("discord.js"); 2 | 3 | class MainClient extends Client { 4 | constructor() { 5 | super({ 6 | shards: "auto", 7 | allowedMentions: { parse: ["users", "roles"] }, 8 | intents: 32767, 9 | }); 10 | 11 | this.config = require("./Settings/config.js"); 12 | this.owner = this.config.OWNER_ID; 13 | this.dev = this.config.DEV_ID; 14 | this.color = this.config.EMBED_COLOR; 15 | if(!this.token) this.token = this.config.TOKEN; 16 | 17 | process.on('unhandledRejection', error => console.log(error)); 18 | process.on('uncaughtException', error => console.log(error)); 19 | 20 | const client = this; 21 | 22 | ["slash", "premiums"].forEach(x => client[x] = new Collection()); 23 | ["Command", "Antinuke", "errLogger","Events", "Database",].forEach(x => require(`./Handler/${x}`)(client)); 24 | 25 | } 26 | connect() { 27 | return super.login(this.token); 28 | }; 29 | }; 30 | 31 | module.exports = MainClient; -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/grdAyush/Antinuke-bot/16a1a055933ded35bcba867381a82c64dff22966/bun.lockb -------------------------------------------------------------------------------- /commands/Antinuke/Disable.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType } = require("discord.js"); 2 | const GuildSettings = require("../../Models/Antinuke"); 3 | 4 | module.exports = { 5 | name: ["antinuke", "disable"], 6 | description: "Disable a specific antinuke category for the guild.", 7 | category: "Antinuke", 8 | options: [ 9 | { 10 | name: "category", 11 | type: ApplicationCommandOptionType.String, 12 | required: true, 13 | description: "The antinuke category to disable.", 14 | choices: [ 15 | { 16 | name: "Anti All", 17 | value: "all", 18 | }, 19 | { 20 | name: "AntiRole", 21 | value: "roles", 22 | }, 23 | { 24 | name: "AntiChannel", 25 | value: "channels", 26 | }, 27 | { 28 | name: "AntiWebhook", 29 | value: "webhooks", 30 | }, 31 | { 32 | name: "AntiBot Add", 33 | value: "antibot", 34 | }, 35 | { 36 | name: "AntiKick", 37 | value: "kicks", 38 | }, 39 | { 40 | name: "AntiBan", 41 | value: "bans", 42 | }, 43 | { 44 | name: "AntiGuild Update", 45 | value: "guildUpdate", 46 | } 47 | ], 48 | }, 49 | ], 50 | permissions: { 51 | channel: [], 52 | bot: [], 53 | user: [], 54 | }, 55 | settings: { 56 | isPremium: false, 57 | isPlayer: false, 58 | isOwner: false, 59 | inVoice: false, 60 | sameVoice: false, 61 | }, 62 | run: async (interaction, client, user, language) => { 63 | await interaction.deferReply(); 64 | 65 | if(interaction.user.id !== interaction.guild.ownerId){ 66 | interaction.editReply({ content: `You Are Not Owner Of This Guild`, ephemeral: true }); 67 | } 68 | 69 | const category = interaction.options.getString("category"); 70 | 71 | 72 | 73 | 74 | let settings = await GuildSettings.findOne({ guildId: interaction.guild.id }); 75 | if (!settings) return interaction.editReply({ content: "Antinuke Is Not Enabled In This Guild"}) 76 | 77 | if (category === "all") { 78 | settings.enabled.roles = false; 79 | settings.enabled.channels = false; 80 | settings.enabled.webhooks = false; 81 | settings.enabled.kicks = false; 82 | settings.enabled.bans = false; 83 | settings.enabled.antibot = false; 84 | settings.enabled.guildUpdate = false; 85 | 86 | await settings.save(); 87 | 88 | interaction.editReply({ 89 | embeds: [ 90 | new EmbedBuilder() 91 | .setTitle("🚩 Antinuke Settings") 92 | .setDescription( 93 | ` 94 | AntiRole Create/Delete: ❌,\n 95 | AntiChannel Create/Delete: ❌,\n 96 | AntiWebhook Create/Delete: ❌\n 97 | AntiKick: ❌\n 98 | AntiBot Add: ❌\n 99 | AntiBan: ❌ 100 | ` 101 | ) 102 | .setColor(client.color) 103 | .setFooter({ 104 | text: "Tip: You Have Disabled All Antinuke Category. If Any Suspicious Activity Is Done The Bot Will Do Nothing", 105 | }), 106 | ], 107 | }); 108 | } else { 109 | 110 | if(settings.enabled[category] === false) { 111 | 112 | interaction.editReply({ 113 | embeds: [ 114 | new EmbedBuilder() 115 | .setDescription(`That Category Is not enabled`) 116 | .setColor("Red") 117 | .setTimestamp(), 118 | ], 119 | ephemeral: true 120 | }) 121 | 122 | } else { 123 | 124 | settings.enabled[category] = true; 125 | await settings.save(); 126 | 127 | const Anti = { 128 | roles: "AntiRole Create/Delete", 129 | channels: "AntiChannel Create/Delete", 130 | webhooks: "AntiWebhook Create/Delete/Update", 131 | kicks: "AntiKick", 132 | bans: "AntiBan", 133 | antibot: "AntiBots Add", 134 | guildUpdate: "AntiGuild Update" 135 | }; 136 | 137 | interaction.editReply({ 138 | embeds: [ 139 | new EmbedBuilder() 140 | .setDescription(`${Anti[category]} ❌`) 141 | .setColor(client.color), 142 | ], 143 | }); 144 | 145 | } 146 | } 147 | }, 148 | }; 149 | -------------------------------------------------------------------------------- /commands/Antinuke/Enable.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType, PermissionFlagsBits } = require("discord.js"); 2 | const GuildSettings = require("../../Models/Antinuke"); 3 | 4 | module.exports = { 5 | name: ["antinuke", "enable"], 6 | description: "Enables a specific antinuke category for the guild.", 7 | category: "Antinuke", 8 | options: [ 9 | { 10 | name: "category", 11 | type: ApplicationCommandOptionType.String, 12 | required: true, 13 | description: "The antinuke category to enable.", 14 | choices: [ 15 | { 16 | name: "Anti All", 17 | value: "all", 18 | }, 19 | { 20 | name: "AntiRole", 21 | value: "roles", 22 | }, 23 | { 24 | name: "AntiChannel", 25 | value: "channels", 26 | }, 27 | { 28 | name: "AntiWebhook", 29 | value: "webhooks", 30 | }, 31 | { 32 | name: "AntiBot Add", 33 | value: "antibot", 34 | }, 35 | { 36 | name: "AntiKick", 37 | value: "kicks", 38 | }, 39 | { 40 | name: "AntiBan", 41 | value: "bans", 42 | }, 43 | { 44 | name: "AntiGuild Update", 45 | value: "guildUpdate", 46 | } 47 | ], 48 | }, 49 | ], 50 | permissions: { 51 | channel: [], 52 | bot: [], 53 | user: [], 54 | }, 55 | settings: { 56 | isPremium: false, 57 | isPlayer: false, 58 | isOwner: false, 59 | inVoice: false, 60 | sameVoice: false, 61 | }, 62 | run: async (interaction, client) => { 63 | await interaction.deferReply(); 64 | if(!interaction.guild.members.me.permissions.has(PermissionFlagsBits.Administrator)) interaction .channel.send({ 65 | content: "**Warning**: I Don't Have Administrator Permission, Please Gimme Perms Of Administrator" 66 | }) 67 | 68 | if(interaction.user.id !== interaction.guild.ownerId){ 69 | interaction.editReply({ content: `You Are Not Owner Of This Guild`, ephemeral: true }); 70 | } 71 | 72 | const category = interaction.options.getString("category"); 73 | 74 | let settings = await GuildSettings.findOne({ 75 | guildId: interaction.guild.id, 76 | }); 77 | if (!settings) { 78 | settings = new GuildSettings({ guildId: interaction.guild.id }); 79 | } 80 | 81 | if (category === "all") { 82 | settings.enabled.roles = true; 83 | settings.enabled.channels = true; 84 | settings.enabled.webhooks = true; 85 | settings.enabled.kicks = true; 86 | settings.enabled.bans = true; 87 | settings.enabled.antibot = true; 88 | settings.enabled.guildUpdate = true; 89 | 90 | await settings.save(); 91 | 92 | interaction.editReply({ 93 | embeds: [ 94 | new EmbedBuilder() 95 | .setTitle("🚩 Antinuke Settings") 96 | .setDescription( 97 | ` 98 | AntiRole Create/Delete: ✔️\n 99 | AntiChannel Create/Delete: ✔️\n 100 | AntiWebhook Create/Delete: ✔️\n 101 | AntiKick: ✔️\n 102 | AntiBot Add: ✔️\n 103 | AntiBan: ✔️ 104 | ` 105 | ) 106 | .setColor(client.color) 107 | .setFooter({ 108 | text: "Tip: Use `/antinuke channel` To Setup Antinuke Log Channel", 109 | }), 110 | ], 111 | }); 112 | } else { 113 | if (settings.enabled[category] === true) { 114 | interaction.editReply({ 115 | embeds: [ 116 | new EmbedBuilder() 117 | .setColor(client.color) 118 | .setDescription(`Don't Worry That Category Is Already Enabled 😉`) 119 | .setTimestamp(), 120 | ], 121 | ephemeral: true, 122 | }); 123 | } else { 124 | settings.enabled[category] = true; 125 | await settings.save(); 126 | 127 | const Anti = { 128 | roles: "AntiRole", 129 | channels: "AntiChannel ", 130 | webhooks: "AntiWebhook", 131 | kicks: "AntiKick", 132 | bans: "AntiBan", 133 | antibot: "AntiBots Add", 134 | guildUpdate: "AntiGuild Update" 135 | }; 136 | 137 | interaction.editReply({ 138 | embeds: [ 139 | new EmbedBuilder() 140 | .setDescription(`${Anti[category]} ✔️`) 141 | .setColor(client.color) 142 | .setTimestamp(), 143 | ], 144 | }); 145 | } 146 | } 147 | }, 148 | }; 149 | -------------------------------------------------------------------------------- /commands/Antinuke/LogChannel.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType, ChannelType} = require('discord.js'); 2 | const GuildSettings = require("../../Models/Antinuke") 3 | 4 | module.exports = { 5 | name: ["antinuke", "channel"], 6 | description: "Set the log channel for all antinuke categories.", 7 | category: "Antinuke", 8 | options: [ 9 | { 10 | name: "channel", 11 | type: ApplicationCommandOptionType.Channel, 12 | channel_types: [ChannelType.GuildText], 13 | description: "The channel to set as the log channel.", 14 | required: true 15 | } 16 | ], 17 | permissions: { 18 | channel: [], 19 | bot: [], 20 | user: [] 21 | }, 22 | settings: { 23 | isPremium: false, 24 | isPlayer: false, 25 | isOwner: false, 26 | inVoice: false, 27 | sameVoice: false, 28 | }, 29 | run: async (interaction, client, user, language) => { 30 | await interaction.deferReply(); 31 | 32 | 33 | const ow = await GuildSettings.findOne({ guildId: interaction.guild.id }); 34 | 35 | const isOwner = interaction.user.id === interaction.guild.ownerId; 36 | const isOwnerLevel = ow.ownerLevel.includes(interaction.user.id); 37 | 38 | if (!isOwner && !isOwnerLevel) { 39 | return interaction.editReply({ 40 | embeds: [ 41 | new EmbedBuilder() 42 | .setDescription("‼ This Command Is Only For Guild Owner And The Users That Have Access To ownerLevel") 43 | .setColor(client.color), 44 | ], 45 | }); 46 | 47 | } 48 | const guildId = interaction.guildId; 49 | const logChannel = interaction.options.getChannel('channel'); 50 | 51 | 52 | const guildSettings = await GuildSettings.findOne({ guildId: guildId }); 53 | if (!guildSettings) { 54 | return interaction.editReply({ 55 | content: 'Antinuke is not enabled in this guild. Please enable it first.', 56 | ephemeral: true, 57 | }); 58 | } 59 | 60 | guildSettings.logChannel = logChannel.id; 61 | await guildSettings.save(); 62 | 63 | interaction.editReply({ content: `Log Channel Has Been Set To <#${logChannel.id}>` }); 64 | 65 | 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /commands/Antinuke/Settings.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType } = require('discord.js'); 2 | const GuildSettings = require("../../Models/Antinuke") 3 | module.exports = { 4 | name: ["antinuke", "settings"], 5 | description: "check antinuke settings of the guild", 6 | category: "Antinuke", 7 | options: [], 8 | permissions: { 9 | channel: [], 10 | bot: [], 11 | user: ["Administrator"] 12 | }, 13 | settings: { 14 | isPremium: false, 15 | isPlayer: false, 16 | isOwner: false, 17 | inVoice: false, 18 | sameVoice: false, 19 | }, 20 | run: async (interaction, client, user, language) => { 21 | 22 | await interaction.deferReply(); 23 | 24 | const data = await GuildSettings.findOne({ guildId: interaction.guild.id }); 25 | if(!data) { interaction.editReply({ content: `No Data Found`, ephemeral: true});} else { 26 | const emoji = { true: "✔️", false: "❌"} 27 | 28 | 29 | interaction.editReply({ embeds: [ 30 | new EmbedBuilder() 31 | .setTitle(`Antinuke Settings`) 32 | .setDescription(` 33 | Anti Role: ${emoji[data.enabled.roles]}\n 34 | Anti Webhook: ${emoji[data.enabled.webhooks]}\n 35 | Anti Ban : ${emoji[data.enabled.bans]}\n 36 | Anti Kick: ${emoji[data.enabled.kicks]}\n 37 | Anti Bot Add: ${emoji[data.enabled.antibot]}\n 38 | Anti Guild Update: ${emoji[data.enabled.guildUpdate]}\n 39 | `) 40 | .setColor(client.color) 41 | ]}) 42 | 43 | } 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /commands/Antinuke/Whitelist Add.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType } = require("discord.js"); 2 | const GuildSettings = require("../../Models/Antinuke"); 3 | 4 | module.exports = { 5 | name: ["antinuke", "whitelist", "add"], 6 | description: "Add user to the whitelist for a specific category", 7 | category: "Antinuke", 8 | options: [ 9 | { 10 | name: "user", 11 | description: "The user to add to the whitelist", 12 | required: true, 13 | type: ApplicationCommandOptionType.User, 14 | }, 15 | { 16 | name: "category", 17 | description: "The category to whitelist the user for", 18 | required: true, 19 | type: ApplicationCommandOptionType.String, 20 | choices: [ 21 | { 22 | name: "AntiRole", 23 | value: "roles", 24 | }, 25 | { 26 | name: "AntiChannel", 27 | value: "channels", 28 | }, 29 | { 30 | name: "AntiWebhook", 31 | value: "webhooks", 32 | }, 33 | { 34 | name: "AntiBot Add", 35 | value: "antibot", 36 | }, 37 | { 38 | name: "AntiKick", 39 | value: "kicks", 40 | }, 41 | { 42 | name: "AntiBan", 43 | value: "bans", 44 | }, 45 | { 46 | name: "AntiGuild Update", 47 | value: "guildUpdate", 48 | }, 49 | ], 50 | }, 51 | ], 52 | permissions: { 53 | channel: [], 54 | bot: [], 55 | user: [], 56 | }, 57 | settings: { 58 | isPremium: false, 59 | isPlayer: false, 60 | isOwner: false, 61 | inVoice: false, 62 | sameVoice: false, 63 | }, 64 | run: async (interaction, client, user, language) => { 65 | await interaction.deferReply({ ephemeral: true }); 66 | const ow = await GuildSettings.findOne({ guildId: interaction.guild.id }); 67 | const isOwner = interaction.user.id === interaction.guild.ownerId; 68 | const isOwnerLevel = ow.ownerLevel.includes(interaction.user.id); 69 | 70 | if (!isOwner && !isOwnerLevel) { 71 | return interaction.editReply({ 72 | embeds: [ 73 | new EmbedBuilder() 74 | .setDescription( 75 | " This Command Is Only For Guild Owner And The Users That Have Access To ownerLevel" 76 | ) 77 | .setColor(client.color), 78 | ], 79 | }); 80 | } 81 | 82 | const user1 = interaction.options.getUser("user"); 83 | const category = interaction.options.getString("category"); 84 | 85 | const settings = await GuildSettings.findOne({ 86 | guildId: interaction.guild.id, 87 | }); 88 | if (!settings) { 89 | return interaction.editReply({ 90 | content: 91 | "There was an error fetching the guild settings from the database. I Think You Never Used Antinuke Enable Command", 92 | ephemeral: true, 93 | }); 94 | } 95 | 96 | if (!settings.enabled[category]) { 97 | return interaction.editReply({ 98 | content: "Antinuke is disabled for that category.", 99 | ephemeral: true, 100 | }); 101 | } 102 | 103 | if (!settings.logChannel) { 104 | return interaction.editReply({ 105 | content: "Set the log channel first by using `/antinuke channel`.", 106 | ephemeral: true, 107 | }); 108 | } 109 | 110 | if (settings.whitelist[category].includes(user1.id)) { 111 | return interaction.editReply({ 112 | content: "The user is already whitelisted for that category.", 113 | ephemeral: true, 114 | }); 115 | } else { 116 | settings.whitelist[category].push(user1.id); 117 | await settings.save(); 118 | 119 | const logChannel = interaction.guild.channels.cache.get( 120 | settings.logChannel 121 | ); 122 | 123 | if (logChannel) { 124 | const Anti = { 125 | roles: "AntiRole", 126 | channels: "AntiChannel ", 127 | webhooks: "AntiWebhook", 128 | kicks: "AntiKick", 129 | bans: "AntiBan", 130 | antibot: "AntiBots Add", 131 | guildUpdate: "AntiGuild Update", 132 | }; 133 | 134 | logChannel.send({ 135 | embeds: [ 136 | new EmbedBuilder() 137 | .setColor(client.color) 138 | .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL()}) 139 | .addFields( 140 | { 141 | name: "Category", 142 | value: `> ${Anti[category]}`, 143 | }, 144 | { 145 | name: "Log Type", 146 | value: "> Whitelist Add" 147 | }, 148 | { 149 | name: "Added By", 150 | value: `> <@${interaction.user.id}>` 151 | }, 152 | { 153 | name: "User Added", 154 | value: `> ${user1}` 155 | } 156 | ) 157 | .setFooter({ text: `© Aksh Antinuke Logs`}) 158 | .setTimestamp(), 159 | ] 160 | }); 161 | } 162 | 163 | interaction.editReply({ 164 | content: "The user has been added to the whitelist for that category.", 165 | ephemeral: true, 166 | }); 167 | } 168 | }, 169 | }; 170 | -------------------------------------------------------------------------------- /commands/Antinuke/Whitelist Owner.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType } = require("discord.js"); 2 | const GuildSettings = require("../../Models/Antinuke"); 3 | 4 | 5 | module.exports = { 6 | name: ["antinuke", "whitelist", "owner"], 7 | description: "Add or remove a user to/from the owner level for this guild.", 8 | category: "Antinuke", 9 | options: [ 10 | { 11 | name: "user", 12 | description: "The user to add/remove from the owner level.", 13 | required: true, 14 | type: ApplicationCommandOptionType.User, 15 | }, 16 | { 17 | name: "choice", 18 | description: "Whether to add or remove the user from the owner level.", 19 | required: true, 20 | type: ApplicationCommandOptionType.String, 21 | choices: [ 22 | { 23 | name: "Add", value: "add" 24 | }, 25 | { 26 | name: "Remove", value: "remove" 27 | } 28 | ] 29 | }, 30 | ], 31 | permissions: { 32 | channel: [], 33 | bot: [], 34 | user: [], 35 | }, 36 | settings: { 37 | isPremium: false, 38 | isPlayer: false, 39 | isOwner: false, 40 | inVoice: false, 41 | sameVoice: false, 42 | }, 43 | run: async (interaction, client, user, language) => { 44 | 45 | await interaction.deferReply(); 46 | if(interaction.user.id !== interaction.guild.ownerId){ 47 | interaction.editReply({ content: `You Are Not Owner Of This Guild`, ephemeral: true }); 48 | } 49 | 50 | 51 | 52 | const guildSettings = await GuildSettings.findOne({ guildId: interaction.guild.id }); 53 | if (!guildSettings) { 54 | return interaction.editReply({ content: 'Something went wrong. Could not find guild settings.', ephemeral: true }); 55 | }; 56 | const userOption = interaction.options.getUser('user'); 57 | if (guildSettings.ownerLevel.includes(userOption.id) && interaction.options.getString('choice') === 'add') { 58 | return interaction.editReply({ content: 'This user is already in the owner level list.', ephemeral: true }); 59 | } 60 | 61 | if (!guildSettings.ownerLevel.includes(userOption.id) && interaction.options.getString('choice') === 'remove') { 62 | return interaction.editReply({ content: 'This user is not in the owner level list.', ephemeral: true }); 63 | } 64 | 65 | if (interaction.options.getString('choice') === 'add') { 66 | guildSettings.ownerLevel.push(userOption.id); 67 | await guildSettings.save(); 68 | return interaction.editReply({ content: `${userOption} has been added to the owner level list.`, ephemeral: true }); 69 | } else { 70 | guildSettings.ownerLevel = guildSettings.ownerLevel.filter(userId => userId !== userOption.id); 71 | await guildSettings.save(); 72 | return interaction.editReply({ content: `${userOption} has been removed from the owner level list.`, ephemeral: true }); 73 | } 74 | 75 | 76 | 77 | }, 78 | }; 79 | -------------------------------------------------------------------------------- /commands/Antinuke/Whitelist Remove.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType } = require('discord.js'); 2 | const GuildSettings = require("../../Models/Antinuke"); 3 | 4 | module.exports = { 5 | name: ["antinuke", "whitelist", "remove"], 6 | description: "Remove a user from the whitelist for a specific antinuke category", 7 | category: "Antinuke", 8 | options: [ 9 | { 10 | name: "user", 11 | description: "The user to add to the whitelist", 12 | required: true, 13 | type: ApplicationCommandOptionType.User, 14 | }, 15 | { 16 | name: "category", 17 | description: "The category to whitelist the user for", 18 | required: true, 19 | type: ApplicationCommandOptionType.String, 20 | choices: [ 21 | { 22 | name: "AntiRole", 23 | value: "roles", 24 | }, 25 | { 26 | name: "AntiChannel", 27 | value: "channels", 28 | }, 29 | { 30 | name: "AntiWebhook", 31 | value: "webhooks", 32 | }, 33 | { 34 | name: "AntiBot Add", 35 | value: "antibot", 36 | }, 37 | { 38 | name: "AntiKick", 39 | value: "kicks", 40 | }, 41 | { 42 | name: "AntiBan", 43 | value: "bans", 44 | }, 45 | { 46 | name: "AntiGuild Update", 47 | value: "guildUpdate", 48 | } 49 | ], 50 | }, 51 | ], 52 | permissions: { 53 | channel: [], 54 | bot: [], 55 | user: [] 56 | }, 57 | settings: { 58 | isPremium: false, 59 | isPlayer: false, 60 | isOwner: false, 61 | inVoice: false, 62 | sameVoice: false, 63 | }, 64 | run: async (interaction, client, user, language) => { 65 | 66 | const user1 = interaction.options.getUser('user'); 67 | const category = interaction.options.getString('category'); 68 | await interaction.deferReply(); 69 | const ow = await GuildSettings.findOne({ guildId: interaction.guild.id }); 70 | const isOwner = interaction.user.id === interaction.guild.ownerId; 71 | const isOwnerLevel = ow.ownerLevel.includes(interaction.user.id); 72 | 73 | if (!isOwner && !isOwnerLevel) { 74 | return interaction.editReply({ 75 | embeds: [ 76 | new EmbedBuilder() 77 | .setDescription( 78 | "‼ This Command Is Only For Guild Owner And The Users That Have Access To ownerLevel" 79 | ) 80 | .setColor(client.color), 81 | ], 82 | }); 83 | } 84 | 85 | const guildSettings = await GuildSettings.findOne({ guildId: interaction.guild.id }); 86 | if (!guildSettings) { 87 | return interaction.editReply({ content: 'Antinuke System Not Found', ephemeral: true }); 88 | } 89 | 90 | const enabled = guildSettings.enabled[category]; 91 | if (!enabled) { 92 | return interaction.editReply({ content: 'Antinuke is disabled for that category.', ephemeral: true }); 93 | } 94 | 95 | const whitelist = guildSettings.whitelist[category]; 96 | if (!whitelist.includes(user1.id)) { 97 | return interaction.editReply({ content: 'User is not in whitelist for that category.', ephemeral: true }); 98 | } else { 99 | 100 | const index = whitelist.indexOf(user1.id); 101 | if (index > -1) { 102 | whitelist.splice(index, 1); 103 | } 104 | 105 | await guildSettings.save(); 106 | 107 | const logChannel = interaction.guild.channels.cache.get(guildSettings.logChannel); 108 | 109 | if (logChannel) { 110 | const Anti = { 111 | roles: "AntiRole Create/Delete", 112 | channels: "AntiChannel Create/Delete", 113 | webhooks: "AntiWebhook Create/Delete/Update", 114 | kicks: "AntiKick", 115 | bans: "AntiBan", 116 | antibot: "AntiBots Add", 117 | }; 118 | 119 | logChannel.send({ 120 | embeds: [ 121 | new EmbedBuilder() 122 | .setColor(client.color) 123 | .setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL()}) 124 | .addFields( 125 | { 126 | name: "Category", 127 | value: `> ${Anti[category]}`, 128 | }, 129 | { 130 | name: "Log Type", 131 | value: "> Whitelist Remove" 132 | }, 133 | { 134 | name: "Removed By", 135 | value: `> <@${interaction.user.id}>` 136 | }, 137 | { 138 | name: "User Remobed", 139 | value: `> ${user1}` 140 | } 141 | ) 142 | .setFooter({ text: `© Aksh Antinuke Logs`}) 143 | .setTimestamp(), 144 | ] 145 | }); 146 | } 147 | 148 | interaction.editReply({ 149 | content: "The user has been Removed From whitelist for that category.", 150 | ephemeral: true, 151 | }); 152 | 153 | 154 | 155 | 156 | 157 | } 158 | } 159 | } -------------------------------------------------------------------------------- /commands/Antinuke/Whitelist show.js: -------------------------------------------------------------------------------- 1 | const { EmbedBuilder, ApplicationCommandOptionType } = require('discord.js'); 2 | const AntinukeGuildSettings = require("../../Models/Antinuke") 3 | module.exports = { 4 | name: ["antinuke", "whitelist", "show"], 5 | description: "Shows the whitelist of users for a selected antinuke category", 6 | category: "Antinuke", 7 | options: [ 8 | { 9 | name: "category", 10 | description: "The category to whitelist the user for", 11 | required: true, 12 | type: ApplicationCommandOptionType.String, 13 | choices: [ 14 | { 15 | name: "Owner Level", 16 | value: "owner", 17 | }, 18 | { 19 | name: "AntiRole", 20 | value: "roles", 21 | }, 22 | { 23 | name: "AntiChannel", 24 | value: "channels", 25 | }, 26 | { 27 | name: "AntiWebhook", 28 | value: "webhooks", 29 | }, 30 | { 31 | name: "AntiBot Add", 32 | value: "antibot", 33 | }, 34 | { 35 | name: "AntiKick", 36 | value: "kicks", 37 | }, 38 | { 39 | name: "AntiBan", 40 | value: "bans", 41 | }, 42 | { 43 | name: "AntiGuild Update", 44 | value: "guildUpdate", 45 | } 46 | ], 47 | }, 48 | ], 49 | permissions: { 50 | channel: [], 51 | bot: [], 52 | user: ["Administrator"] 53 | }, 54 | settings: { 55 | isPremium: false, 56 | isPlayer: false, 57 | isOwner: false, 58 | inVoice: false, 59 | sameVoice: false, 60 | }, 61 | run: async (interaction, client, user, language) => { 62 | 63 | await interaction.deferReply(); 64 | 65 | const guildSettings = await AntinukeGuildSettings.findOne({ guildId: interaction.guild.id }); 66 | if (!guildSettings) { 67 | return interaction.editReply({ content: 'Antinuke is not enabled for this guild!', ephemeral: true }); 68 | } 69 | 70 | 71 | 72 | const category = interaction.options.getString('category'); 73 | 74 | 75 | if(category === "owner") { 76 | const whitelist = guildSettings.ownerLevel 77 | 78 | const users = await Promise.all( 79 | whitelist.map(async (userId) => { 80 | return `<@${userId}> - \`${userId}\``; 81 | }) 82 | ); 83 | 84 | 85 | if (!whitelist || whitelist.length === 0) return interaction.editReply({ content: 'No users are in owner whitelist', ephemeral: true }); 86 | const embed = new EmbedBuilder() 87 | .setColor(client.color) 88 | .setTitle(`Whitelisted users for Owner Level`) 89 | .setDescription(users.join('\n')); 90 | 91 | return interaction.editReply({ embeds: [embed] }); 92 | 93 | } else { 94 | const whitelist = guildSettings.whitelist[category]; 95 | 96 | 97 | if (!whitelist || whitelist.length === 0) { 98 | return interaction.editReply({ content: 'No users are whitelisted for this antinuke category!', ephemeral: true }); 99 | } 100 | 101 | const users = await Promise.all( 102 | whitelist.map(async (userId) => { 103 | return `<@${userId}> - \`${userId}\``; 104 | }) 105 | ); 106 | 107 | const Anti = { 108 | roles: "AntiRole", 109 | channels: "AntiChannel ", 110 | webhooks: "AntiWebhook", 111 | kicks: "AntiKick", 112 | bans: "AntiBan", 113 | antibot: "AntiBots Add", 114 | }; 115 | 116 | 117 | 118 | const embed = new EmbedBuilder() 119 | .setColor(client.color) 120 | .setTitle(`Whitelisted users for ${Anti[category]}`) 121 | .setDescription(users.join('\n')); 122 | 123 | return interaction.editReply({ embeds: [embed] }); 124 | } 125 | } 126 | 127 | } -------------------------------------------------------------------------------- /commands/Premium/generate.js: -------------------------------------------------------------------------------- 1 | const { 2 | ApplicationCommandOptionType, 3 | ChannelType, 4 | EmbedBuilder, 5 | PermissionFlagsBits, 6 | } = require("discord.js"); 7 | const moment = require('moment'); 8 | const voucher_codes = require('voucher-code-generator'); 9 | const Redeem = require("../../Models/Redeem"); 10 | module.exports = { 11 | name: ["premium", "generate"], 12 | description: "generate a preniun code", 13 | category: "Premium", 14 | options: [ { 15 | name: "plan", 16 | description: "The plan you want to generate a voucher code for", 17 | required: true, 18 | type: ApplicationCommandOptionType.String, 19 | choices: [ 20 | { 21 | name: "Daily", 22 | value: "daily", 23 | } 24 | ,{ 25 | name: "Weekly", 26 | value: "weekly" 27 | }, 28 | { 29 | name: "Monthly", 30 | value: "monthly" 31 | }, 32 | { 33 | name: "Yearly", 34 | value: "yearly" 35 | }, 36 | { 37 | name: "Lifetime", 38 | value: "lifetime" 39 | } 40 | ] 41 | }, 42 | { 43 | name: "amount", 44 | description: "The amount of codes you want to generate", 45 | required: false, 46 | type: ApplicationCommandOptionType.String, 47 | }], 48 | permissions: { 49 | channel: [], 50 | bot: [], 51 | user: [], 52 | }, 53 | settings: { 54 | isPremium: false, 55 | isOwner: true, 56 | inVoice: false, 57 | isNSFW: false, 58 | }, 59 | run: async (interaction, client) => { 60 | 61 | await interaction.deferReply({ ephemeral: false }); 62 | 63 | const name = interaction.options.getString("plan"); 64 | const camount = interaction.options.getString("amount"); 65 | 66 | let codes = []; 67 | 68 | const plan = name; 69 | 70 | let time; 71 | if (plan === 'daily') time = Date.now() + 86400000; 72 | if (plan === 'weekly') time = Date.now() + 86400000 * 7; 73 | if (plan === 'monthly') time = Date.now() + 86400000 * 30; 74 | if (plan === 'yearly') time = Date.now() + 86400000 * 365; 75 | if (plan === 'lifetime') time = Date.now() + 86400000 * 365 * 100; 76 | 77 | let amount = camount; 78 | if (!amount) amount = 1; 79 | 80 | for (var i = 0; i < amount; i++) { 81 | const codePremium = voucher_codes.generate({ 82 | pattern: '####-####-####' 83 | }) 84 | 85 | const code = codePremium.toString().toUpperCase() 86 | const find = await Redeem.findOne({ code: code }) 87 | 88 | if (!find) { 89 | Redeem.create({ 90 | code: code, 91 | plan: plan, 92 | expiresAt: time 93 | }), 94 | codes.push(`${i + 1} - ${code}`) 95 | } 96 | } 97 | 98 | const embed = new EmbedBuilder() 99 | .setColor(client.color) 100 | .setAuthor({ name: `Generate Code`, iconURL: client.user.avatarURL() }) //${lang.description.replace("{codes_length}", codes.length).replace("{codes}", codes.join('\n')).replace("{plan}", plan).replace("{expires}", moment(time).format('dddd, MMMM Do YYYY'))} 101 | .setDescription(`• *Generated* [\`${codes.length}\`]\n\`${codes.join("\n")}\`\n • *Plan*: \`${plan}\`\n • *Expires at*: \`${moment(time).format('dddd, MMMM Do YYYY')}\``) 102 | .setTimestamp() 103 | .setFooter({ text: `Type: /redeem to redeem!`, iconURL: interaction.user.displayAvatarURL() }) 104 | 105 | interaction.editReply({ embeds: [embed] }) 106 | }, 107 | }; 108 | -------------------------------------------------------------------------------- /commands/Premium/redeem.js: -------------------------------------------------------------------------------- 1 | const { 2 | ApplicationCommandOptionType, 3 | ChannelType, 4 | EmbedBuilder, 5 | PermissionFlagsBits, 6 | } = require("discord.js"); 7 | const moment = require('moment'); 8 | const Premium = require("../../Models/Premium"); 9 | const Redeem = require("../../Models/Redeem"); 10 | 11 | module.exports = { 12 | name: ["redeem"], 13 | description: "redeem a premium by the code", 14 | category: "Premium", 15 | options: [ 16 | { 17 | name: "code", 18 | description: "the code generated by owner", 19 | type: ApplicationCommandOptionType.String, 20 | required: true 21 | } 22 | ], 23 | permissions: { 24 | channel: [], 25 | bot: [], 26 | user: [], 27 | }, 28 | settings: { 29 | isPremium: false, 30 | isOwner: false, 31 | inVoice: false, 32 | isNSFW: false, 33 | }, 34 | run: async (interaction, client) => { 35 | 36 | await interaction.deferReply({ ephemeral: false }); 37 | 38 | const input = interaction.options.getString("code"); 39 | 40 | let member = await Premium.findOne({ Id: interaction.user.id }) 41 | 42 | if (member && member.isPremium) { 43 | const embed = new EmbedBuilder() 44 | .setColor(client.color) 45 | .setDescription(`You Already Have Premium Enjoy That`) 46 | return interaction.editReply({ embeds: [embed] }); 47 | } else { 48 | 49 | const premium = await Redeem.findOne({ code: input.toUpperCase() }); 50 | if (premium) { 51 | const expires = moment(premium.expiresAt).format('do/MMMM/YYYY (HH:mm:ss)') 52 | 53 | const member2 = new Premium({ Id: interaction.user.id}) 54 | member2.isPremium = true 55 | member2.premium.redeemedBy.push(interaction.user) 56 | member2.premium.redeemedAt = Date.now() 57 | member2.premium.expiresAt = premium.expiresAt 58 | member2.premium.plan = premium.plan 59 | 60 | member = await member2.save({ new: true }); 61 | client.premiums.set(interaction.user.id, member); 62 | await premium.deleteOne(); 63 | 64 | const embed = new EmbedBuilder() 65 | .setAuthor({ name: `Redeemed Code`, iconURL: client.user.displayAvatarURL() }) 66 | .setDescription(`**Plan**: \`${premium.plan}\`\n**Expires At**: \`${expires}\``) 67 | .setColor(client.color) 68 | .setTimestamp() 69 | 70 | return interaction.editReply({ embeds: [embed] }); 71 | } else { 72 | const embed = new EmbedBuilder() 73 | .setColor(client.color) 74 | .setDescription(`That Redeem code is invalid`) 75 | return interaction.editReply({ embeds: [embed] }) 76 | } 77 | } 78 | }, 79 | }; -------------------------------------------------------------------------------- /commands/Premium/remove.js: -------------------------------------------------------------------------------- 1 | const { 2 | ApplicationCommandOptionType, 3 | ChannelType, 4 | EmbedBuilder, 5 | PermissionFlagsBits, 6 | } = require("discord.js"); 7 | const Premium = require("../../Models/Premium") 8 | module.exports = { 9 | name: ["premium", "remove"], 10 | description: "Remove Premium From A User", 11 | category: "Premium", 12 | options: [ 13 | { 14 | name: "target", 15 | description: "Mention a user want to remove!", 16 | required: true, 17 | type: ApplicationCommandOptionType.User, 18 | } 19 | ], 20 | permissions: { 21 | channel: [], 22 | bot: [], 23 | user: [], 24 | }, 25 | settings: { 26 | isPremium: false, 27 | isOwner: false, 28 | inVoice: false, 29 | isNSFW: false, 30 | }, 31 | run: async (interaction, client) => { 32 | 33 | await interaction.deferReply({ ephemeral: false }); 34 | 35 | const mentions = interaction.options.getUser("target"); 36 | 37 | const db = await Premium.findOne({ Id: mentions.id }); 38 | 39 | if (db.isPremium) { 40 | db.isPremium = false 41 | db.premium.redeemedBy = [] 42 | db.premium.redeemedAt = null 43 | db.premium.expiresAt = null 44 | db.premium.plan = null 45 | 46 | const newUser = await db.save({ new: true }).catch(() => {}) 47 | client.premiums.set(newUser.Id, newUser); 48 | 49 | const embed = new EmbedBuilder() 50 | .setDescription(`Successfully Removed The Premium From ${mentions}`) 51 | .setColor(client.color) 52 | 53 | interaction.editReply({ embeds: [embed] }); 54 | 55 | } else { 56 | const embed = new EmbedBuilder() 57 | .setDescription(`That User Not Have Premium`) 58 | .setColor(client.color) 59 | 60 | interaction.editReply({ embeds: [embed] }); 61 | } 62 | 63 | }, 64 | }; 65 | -------------------------------------------------------------------------------- /commands/Utility/help.js: -------------------------------------------------------------------------------- 1 | const {StringSelectMenuBuilder, StringSelectMenuOptionBuilder, EmbedBuilder, ActionRowBuilder, } = require("discord.js"); 2 | const { readdirSync } = require("fs"); 3 | module.exports = { 4 | name: ["help"], 5 | description: "get info about the all commands available", 6 | category: "Utility", 7 | options: [], 8 | permissions: { 9 | channel: [], 10 | bot: [], 11 | user: [], 12 | }, 13 | settings: { 14 | isPremium: false, 15 | isOwner: false, 16 | inVoice: false, 17 | isNSFW: false, 18 | }, 19 | run: async (interaction, client) => { 20 | await interaction.deferReply({ ephemeral: false }); 21 | 22 | const categories = readdirSync("./commands/") 23 | 24 | const embed = new EmbedBuilder() 25 | .setColor(client.color) 26 | .setDescription(`Please Select Category Menu!`) 27 | 28 | const row = new ActionRowBuilder() 29 | .addComponents([ 30 | new StringSelectMenuBuilder() 31 | .setCustomId("help-category") 32 | .setPlaceholder(`Please Select Category Menu!`) 33 | .setMaxValues(1) 34 | .setMinValues(1) 35 | /// Map the categories to the select menu 36 | .setOptions(categories.map(category => { 37 | return new StringSelectMenuOptionBuilder() 38 | .setLabel(category) 39 | .setValue(category) 40 | } 41 | )) 42 | ]) 43 | 44 | interaction.editReply({ embeds: [embed], components: [row] }).then(async (msg) => { 45 | let filter = (i) => (i.isStringSelectMenu()) && i.user && i.message.author.id == client.user.id; 46 | let collector = await msg.createMessageComponentCollector({ 47 | filter, 48 | time: 90000 49 | }); 50 | collector.on('collect', async (m) => { 51 | if(m.isStringSelectMenu()) { 52 | if(m.customId === "help-category") { 53 | await m.deferUpdate(); 54 | let [directory] = m.values; 55 | 56 | const embed = new EmbedBuilder() 57 | .setAuthor({ name: `${interaction.guild.members.me.displayName} Help Command!`, iconURL: interaction.guild.iconURL({ dynamic: true })}) 58 | .setDescription(`The bot prefix is: \`/\``) 59 | .setThumbnail(client.user.displayAvatarURL({ dynamic: true, size: 2048 })) 60 | .setColor(client.color) 61 | .addFields({ name: `❯ ${directory.toUpperCase()} [${client.slash.filter(c => c.category === directory).size}]`, value: `${client.slash.filter(c => c.category === directory).map(c => `\`${c.name.at(-1)}\``).join(", ")}`, inline: false }) 62 | .setFooter({ text: `© ${interaction.guild.members.me.displayName} | Total Commands: ${client.slash.size}`, iconURL: client.user.displayAvatarURL({ dynamic: true })}) 63 | 64 | msg.edit({ embeds: [embed] }); 65 | } 66 | } 67 | }); 68 | 69 | collector.on('end', async (collected, reason) => { 70 | if(reason === 'time') { 71 | const timed = new EmbedBuilder() 72 | .setDescription(`Help Menu timed out try using /help again.`) 73 | .setColor(client.color) 74 | 75 | msg.edit({ embeds: [timed], components: [] }); 76 | } 77 | }); 78 | }) 79 | }, 80 | }; 81 | -------------------------------------------------------------------------------- /commands/Utility/ping.js: -------------------------------------------------------------------------------- 1 | const { 2 | ApplicationCommandOptionType, 3 | ChannelType, 4 | EmbedBuilder, 5 | PermissionFlagsBits, 6 | } = require("discord.js"); 7 | module.exports = { 8 | name: ["ping"], 9 | description: "check the ping of the bot", 10 | category: "Utility", 11 | options: [], 12 | permissions: { 13 | channel: [], 14 | bot: [], 15 | user: [], 16 | }, 17 | settings: { 18 | isPremium: false, 19 | isOwner: false, 20 | inVoice: false, 21 | isNSFW: false, 22 | }, 23 | run: async (interaction, client) => { 24 | interaction.reply({ content: `Ping: \`${client.ws.ping}\``}) 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /deploySlash.js: -------------------------------------------------------------------------------- 1 | const { plsParseArgs } = require('plsargs'); 2 | const args = plsParseArgs(process.argv.slice(2)); 3 | const chillout = require("chillout"); 4 | const { makeSureFolderExists } = require("stuffs"); 5 | const path = require("path"); 6 | const readdirRecursive = require("recursive-readdir"); 7 | const { TOKEN } = require("./Settings/config.js"); 8 | const { ApplicationCommandOptionType, REST, Routes, ApplicationCommandManager } = require('discord.js'); 9 | 10 | (async () => { 11 | 12 | let command = []; 13 | 14 | let cleared = args.get(0) == "guild" ? args.get(2) == "clear" : (args.get(0) == "global" ? args.get(1) == "clear" : false); 15 | let deployed = args.get(0) == "guild" ? "guild" : args.get(0) == "global" ? "global" : null; 16 | 17 | if (!deployed) { 18 | console.error(`Invalid sharing mode! Valid modes: guild, global`); 19 | console.error(`Usage example: node deploySlash.js guild [clear]`); 20 | console.error(`Usage example: node deploySlash.js global [clear]`); 21 | return process.exit(1); 22 | } 23 | 24 | if (!cleared) { 25 | let interactionsFolder = path.resolve("./commands"); 26 | 27 | await makeSureFolderExists(interactionsFolder); 28 | 29 | let store = []; 30 | 31 | console.log("Reading interaction files..") 32 | 33 | let interactionFilePaths = await readdirRecursive(interactionsFolder); 34 | interactionFilePaths = interactionFilePaths.filter(i => { 35 | let state = path.basename(i).startsWith("-"); 36 | return !state; 37 | }); 38 | 39 | await chillout.forEach(interactionFilePaths, (interactionFilePath) => { 40 | const cmd = require(interactionFilePath); 41 | console.log(`Interaction "${cmd.type == "CHAT_INPUT" ? `/${cmd.name.join(" ")}` : `${cmd.name[0]}`}" ${cmd.name[1] || ""} ${cmd.name[2] || ""} added to the transform list!`); 42 | store.push(cmd); 43 | }); 44 | 45 | store = store.sort((a, b) => a.name.length - b.name.length) 46 | 47 | command = store.reduce((all, current) => { 48 | switch (current.name.length) { 49 | case 1: { 50 | all.push({ 51 | type: current.type, 52 | name: current.name[0], 53 | description: current.description, 54 | defaultPermission: current.defaultPermission, 55 | options: current.options 56 | }); 57 | break; 58 | } 59 | case 2: { 60 | let baseItem = all.find((i) => { 61 | return i.name == current.name[0] && i.type == current.type 62 | }); 63 | if (!baseItem) { 64 | all.push({ 65 | type: current.type, 66 | name: current.name[0], 67 | description: `${current.name[0]} commands.`, 68 | defaultPermission: current.defaultPermission, 69 | options: [ 70 | { 71 | type: ApplicationCommandOptionType.Subcommand, 72 | description: current.description, 73 | name: current.name[1], 74 | options: current.options 75 | } 76 | ] 77 | }); 78 | } else { 79 | baseItem.options.push({ 80 | type: ApplicationCommandOptionType.Subcommand, 81 | description: current.description, 82 | name: current.name[1], 83 | options: current.options 84 | }) 85 | } 86 | break; 87 | } 88 | case 3: { 89 | let SubItem = all.find((i) => { 90 | return i.name == current.name[0] && i.type == current.type 91 | }); 92 | if (!SubItem) { 93 | all.push({ 94 | type: current.type, 95 | name: current.name[0], 96 | description: `${current.name[0]} commands.`, 97 | defaultPermission: current.defaultPermission, 98 | options: [ 99 | { 100 | type: ApplicationCommandOptionType.SubcommandGroup, 101 | description: `${current.name[1]} commands.`, 102 | name: current.name[1], 103 | options: [ 104 | { 105 | type: ApplicationCommandOptionType.Subcommand, 106 | description: current.description, 107 | name: current.name[2], 108 | options: current.options 109 | } 110 | ] 111 | } 112 | ] 113 | }); 114 | } else { 115 | let GroupItem = SubItem.options.find(i => { 116 | return i.name == current.name[1] && i.type == ApplicationCommandOptionType.SubcommandGroup 117 | }); 118 | if (!GroupItem) { 119 | SubItem.options.push({ 120 | type: ApplicationCommandOptionType.SubcommandGroup, 121 | description: `${current.name[1]} commands.`, 122 | name: current.name[1], 123 | options: [ 124 | { 125 | type: ApplicationCommandOptionType.Subcommand, 126 | description: current.description, 127 | name: current.name[2], 128 | options: current.options 129 | } 130 | ] 131 | }) 132 | } else { 133 | GroupItem.options.push({ 134 | type: ApplicationCommandOptionType.Subcommand, 135 | description: current.description, 136 | name: current.name[2], 137 | options: current.options 138 | }) 139 | } 140 | } 141 | } 142 | break; 143 | } 144 | 145 | return all; 146 | }, []); 147 | 148 | command = command.map(i => ApplicationCommandManager.transformCommand(i)); 149 | } else { 150 | console.info("No interactions read, all existing ones will be cleared..."); 151 | } 152 | 153 | const rest = new REST({ version: "9" }).setToken(TOKEN); 154 | const client = await rest.get(Routes.user()); 155 | console.info(`Account information received! ${client.username}#${client.discriminator} (${client.id})`); 156 | 157 | console.info(`Interactions are posted on discord!`); 158 | switch (deployed) { 159 | case "guild": { 160 | let guildId = args.get(1); 161 | console.info(`Deploy mode: guild (${guildId})`); 162 | 163 | await rest.put(Routes.applicationGuildCommands(client.id, guildId), { body: command }); 164 | 165 | console.info(`Shared commands may take 3-5 seconds to arrive.`); 166 | break; 167 | } 168 | case "global": { 169 | console.info(`Deploy mode: global`); 170 | 171 | await rest.put(Routes.applicationCommands(client.id), { body: command }); 172 | 173 | console.info(`Shared commands can take up to 1 hour to arrive. If you want it to come immediately, you can throw your bot from your server and get it back.`); 174 | break; 175 | } 176 | } 177 | 178 | console.info(`Interactions shared!`); 179 | })(); 180 | 181 | /// Credit https://github.com/akanora/Youtube-Together (Handler) || Edit by: https://github.com/Adivise -------------------------------------------------------------------------------- /example.env: -------------------------------------------------------------------------------- 1 | error= 2 | join= 3 | leave= 4 | 5 | TOKEN= 6 | MONGO_URI= 7 | EMBED_COLOR= 8 | DEV_ID= 9 | OWNER_ID= -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const MainClient = require("./bot.js"); 2 | const client = new MainClient(); 3 | 4 | client.connect() 5 | 6 | module.exports = client; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "antinuke", 3 | "version": "1.3.0", 4 | "description": "Best Discord Antinuke Bot With MongoDB Join Discord: https://link6090.ml/yashoda", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "node --no-warnings .", 8 | "start": "node --no-warnings index.js" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "git+https://github.com/grdAyush/Antinuke-bot.git" 13 | }, 14 | "keywords": [ 15 | "discord.js", 16 | "discord.jsv14", 17 | "v14", 18 | "discord", 19 | "discord.js@14", 20 | "best antinuke", 21 | "discord bot antinuke", 22 | "security bot", 23 | "antinuke security", 24 | "anti wizz bot" 25 | ], 26 | "author": "grdAyush", 27 | "license": "ISC", 28 | "bugs": { 29 | "url": "https://github.com/grdAyush/Antinuke-bot/issues" 30 | }, 31 | "homepage": "https://github.com/grdAyush/Antinuke-bot#readme", 32 | "dependencies": { 33 | "chalk": "^4.1.0", 34 | "chillout": "^5.0.0", 35 | "discord.js": "^14.9.0", 36 | "dotenv": "^16.0.3", 37 | "fs": "^0.0.1-security", 38 | "moment": "^2.29.4", 39 | "moment-duration-format": "^2.3.2", 40 | "mongoose": "^5.9.19", 41 | "node-cron": "^3.0.2", 42 | "path": "^0.12.7", 43 | "plsargs": "^0.1.6", 44 | "recursive-readdir": "^2.2.3", 45 | "stuffs": "^0.1.27", 46 | "voucher-code-generator": "^1.3.0" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /shards.js: -------------------------------------------------------------------------------- 1 | const { ShardingManager } = require('discord.js'); //imports the sharding manager 2 | require("dotenv").config(); 3 | 4 | const manager = new ShardingManager('./index.js', { 5 | token: process.env.TOKEN || "", //paste your token here 6 | respawn: true, 7 | autoSpawn: true, 8 | totalShards: 1, //amount of shards 9 | shardList: "auto", //edit it only if you know what are you doing 10 | }); 11 | 12 | manager.spawn({ amount: manager.totalShards, delay: null, timeout: -1 }).then((shards) => { 13 | console.log(`[CLIENT] ${shards.size} shard(s) spawned.`); 14 | }).catch((err) => { 15 | console.log("[CLIENT] An error has occurred :", err); 16 | }); 17 | 18 | manager.on("shardCreate", (shard) => { 19 | shard.on("ready", () => { 20 | console.log(`[CLIENT] Shard ${shard.id} connected`); 21 | }); 22 | }); --------------------------------------------------------------------------------