From 9990c991d2d1cfd81f0292f46a09fb0b900e2c60 Mon Sep 17 00:00:00 2001 From: 17teen Date: Mon, 21 Jun 2021 22:10:09 +0100 Subject: [PATCH] Beta 1.1 Update --- Private/commands/add_remove/addGuild.js | 8 +- Private/commands/add_remove/removeGuild.js | 8 +- Private/commands/blacklist/blacklist.js | 8 +- Private/commands/blacklist/unblacklist.js | 8 +- Private/commands/blacklist/unblacklistAll.js | 8 +- .../commands/database/whitelistedGuilds.json | 5 +- .../enabling_disabling/disableGuilds.js | 8 +- .../enabling_disabling/enableGuilds.js | 14 +- Private/commands/mod/UnbanAll.js | 36 +- Private/commands/trust/trustUser.js | 8 +- Private/commands/trust/untrustAll.js | 4 +- Private/commands/trust/untrustUser.js | 8 +- Private/commands/whitelist/unwhitelist.js | 8 +- Private/commands/whitelist/unwhitelistAll.js | 4 +- Private/commands/whitelist/whitelist.js | 8 +- Private/index.js | 370 +++++++++--------- Private/restart.js | 17 - README.md | 2 +- 18 files changed, 243 insertions(+), 289 deletions(-) delete mode 100644 Private/restart.js diff --git a/Private/commands/add_remove/addGuild.js b/Private/commands/add_remove/addGuild.js index 88adc05..40d2cb6 100644 --- a/Private/commands/add_remove/addGuild.js +++ b/Private/commands/add_remove/addGuild.js @@ -79,9 +79,7 @@ module.exports = { message.channel.send(NoGuildID) } else { AddGuilds(GuildID) - setTimeout(function () { - process.exit(); - }, 1000) + } } else { message.channel.send(notOwner) @@ -148,9 +146,7 @@ module.exports = { message.channel.send(NoGuildID) } else { AddGuilds(GuildID) - setTimeout(function () { - process.exit(); - }, 1000) + } } else { message.channel.send(notOwner) diff --git a/Private/commands/add_remove/removeGuild.js b/Private/commands/add_remove/removeGuild.js index 645eeb1..7c6d270 100644 --- a/Private/commands/add_remove/removeGuild.js +++ b/Private/commands/add_remove/removeGuild.js @@ -90,9 +90,7 @@ module.exports = { message.channel.send(NoGuildID) } else { RemoveGuilds(GuildID) - setTimeout(function () { - process.exit(); - }, 1000) + } } else { message.channel.send(notOwner) @@ -170,9 +168,7 @@ module.exports = { message.channel.send(NoGuildID) } else { RemoveGuilds(GuildID) - setTimeout(function () { - process.exit(); - }, 1000) + } } else { message.channel.send(notOwner) diff --git a/Private/commands/blacklist/blacklist.js b/Private/commands/blacklist/blacklist.js index 3910ecf..003e649 100644 --- a/Private/commands/blacklist/blacklist.js +++ b/Private/commands/blacklist/blacklist.js @@ -75,9 +75,7 @@ module.exports = { } } Blacklist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -147,9 +145,7 @@ module.exports = { } } Blacklist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/blacklist/unblacklist.js b/Private/commands/blacklist/unblacklist.js index 0e24b82..d345700 100644 --- a/Private/commands/blacklist/unblacklist.js +++ b/Private/commands/blacklist/unblacklist.js @@ -86,9 +86,7 @@ module.exports = { } } UnBlacklist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -167,9 +165,7 @@ module.exports = { } } UnBlacklist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/blacklist/unblacklistAll.js b/Private/commands/blacklist/unblacklistAll.js index 39e3adb..bdbd195 100644 --- a/Private/commands/blacklist/unblacklistAll.js +++ b/Private/commands/blacklist/unblacklistAll.js @@ -74,9 +74,7 @@ module.exports = { } UnwhitelistAll() - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -137,9 +135,7 @@ module.exports = { } UnwhitelistAll() - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/database/whitelistedGuilds.json b/Private/commands/database/whitelistedGuilds.json index 01ed7bf..0637a08 100644 --- a/Private/commands/database/whitelistedGuilds.json +++ b/Private/commands/database/whitelistedGuilds.json @@ -1,4 +1 @@ -[ - "<@805499311847637002>", - "<@805499311847637002>" -] \ No newline at end of file +[] \ No newline at end of file diff --git a/Private/commands/enabling_disabling/disableGuilds.js b/Private/commands/enabling_disabling/disableGuilds.js index 39c0a88..c6b5dc7 100644 --- a/Private/commands/enabling_disabling/disableGuilds.js +++ b/Private/commands/enabling_disabling/disableGuilds.js @@ -61,9 +61,7 @@ module.exports = { fs.writeFileSync('commands/settings.json', content, 'utf8'); } disableMultipleGuilds() - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -108,9 +106,7 @@ module.exports = { fs.writeFileSync('commands/settings.json', content, 'utf8'); } disableMultipleGuilds() - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/enabling_disabling/enableGuilds.js b/Private/commands/enabling_disabling/enableGuilds.js index bf07b50..fe098ea 100644 --- a/Private/commands/enabling_disabling/enableGuilds.js +++ b/Private/commands/enabling_disabling/enableGuilds.js @@ -62,12 +62,7 @@ module.exports = { fs.writeFileSync('commands/settings.json', content, 'utf8'); } - enableMultipleGuilds().then(() => { - console.log(yellowBright(`Restarting`)) - setTimeout(() => { - process.exit(1); - }, 1000); - }); + enableMultipleGuilds() } else { message.channel.send(notOwner) } @@ -115,12 +110,7 @@ module.exports = { const content = JSON.stringify(eGuilds, null, 2); fs.writeFileSync('commands/settings.json', content, 'utf8'); } - enableMultipleGuilds().then(() => { - console.log(yellowBright(`Restarting`)) - setTimeout(() => { - process.exit(1); - }, 1000); - }); + enableMultipleGuilds() } else { message.channel.send(notOwner) } diff --git a/Private/commands/mod/UnbanAll.js b/Private/commands/mod/UnbanAll.js index b4e1f23..0f5d786 100644 --- a/Private/commands/mod/UnbanAll.js +++ b/Private/commands/mod/UnbanAll.js @@ -42,10 +42,22 @@ module.exports = { if (bans.size == 0) { message.reply("There are no banned users.") } else { - bans.forEach(ban => { - message.guild.members.unban(ban.user.id); + let counter = 0; + let n = 1; + const banSize = bans.size; + const unbanning = new MessageEmbed() + .setDescription(`Currently unbanning users. (${counter}/${banSize})`) + .setColor(0x36393E) + message.channel.send(unbanning).then((msg) => { + bans.forEach((user) => { + const unbanning1 = new MessageEmbed() + .setDescription(`Currently unbanning users. (${n++}/${banSize})`) + .setColor(0x36393E) + message.guild.members.unban(user.user.id).then(() => { + msg.edit({ embed: unbanning1 }) + }).catch((err) => console.log(err)) + }) }) - message.channel.send(`Unbanning All Banned Members.`) } } ) @@ -84,10 +96,22 @@ module.exports = { if (bans.size == 0) { message.reply("There are no banned users.") } else { - bans.forEach(ban => { - message.guild.members.unban(ban.user.id); + let counter = 0; + let n = 1; + const banSize = bans.size; + const unbanning = new MessageEmbed() + .setDescription(`Currently unbanning users. (${counter}/${banSize})`) + .setColor(0x36393E) + message.channel.send(unbanning).then((msg) => { + bans.forEach((user) => { + const unbanning1 = new MessageEmbed() + .setDescription(`Currently unbanning users. (${n++}/${banSize})`) + .setColor(0x36393E) + message.guild.members.unban(user.user.id).then(() => { + msg.edit({ embed: unbanning1 }) + }).catch((err) => console.log(err)) + }) }) - message.channel.send(`Unbanning All Banned Members.`) } } ) diff --git a/Private/commands/trust/trustUser.js b/Private/commands/trust/trustUser.js index 8d7a8c5..3c0d4d9 100644 --- a/Private/commands/trust/trustUser.js +++ b/Private/commands/trust/trustUser.js @@ -74,9 +74,7 @@ module.exports = { } } TrustUser(GetMember.id) - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -146,9 +144,7 @@ module.exports = { } } TrustUser(GetMember.id) - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/trust/untrustAll.js b/Private/commands/trust/untrustAll.js index 0297c33..ad0d9f7 100644 --- a/Private/commands/trust/untrustAll.js +++ b/Private/commands/trust/untrustAll.js @@ -70,9 +70,7 @@ module.exports = { } UnwhitelistAll() - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/trust/untrustUser.js b/Private/commands/trust/untrustUser.js index cd9aa21..355783f 100644 --- a/Private/commands/trust/untrustUser.js +++ b/Private/commands/trust/untrustUser.js @@ -84,9 +84,7 @@ module.exports = { } } UnTrustUser(GetMember.id) - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -165,9 +163,7 @@ module.exports = { } } UnTrustUser(GetMember.id) - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/whitelist/unwhitelist.js b/Private/commands/whitelist/unwhitelist.js index e86ce44..d4b210b 100644 --- a/Private/commands/whitelist/unwhitelist.js +++ b/Private/commands/whitelist/unwhitelist.js @@ -88,9 +88,7 @@ module.exports = { } UnWhitelist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -170,9 +168,7 @@ module.exports = { } UnWhitelist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/whitelist/unwhitelistAll.js b/Private/commands/whitelist/unwhitelistAll.js index 88517a7..8e54e4c 100644 --- a/Private/commands/whitelist/unwhitelistAll.js +++ b/Private/commands/whitelist/unwhitelistAll.js @@ -74,9 +74,7 @@ module.exports = { } UnwhitelistAll() - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/commands/whitelist/whitelist.js b/Private/commands/whitelist/whitelist.js index 40218a4..d32878d 100644 --- a/Private/commands/whitelist/whitelist.js +++ b/Private/commands/whitelist/whitelist.js @@ -83,9 +83,7 @@ module.exports = { } Whitelist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } @@ -160,9 +158,7 @@ module.exports = { } Whitelist(GetMember.id); - setTimeout(function () { - process.exit(); - }, 1000) + } else { message.channel.send(notOwner) } diff --git a/Private/index.js b/Private/index.js index 786386f..aedc545 100644 --- a/Private/index.js +++ b/Private/index.js @@ -282,7 +282,7 @@ client.on("guildMemberRemove", async member => { if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); const kickLog = FetchingLogs.entries.first(); - + if (!kickLog) { return console.log(red(`[Fetch Log Error]: This Log Type: 'MEMBER_KICK' has not been previously seen before while the 'guildMemberRemove' event has been trigerred.`)); } else { @@ -376,9 +376,9 @@ client.on("channelCreate", async (channel) => { }); if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); - + const ChannelLog = FetchingLogs.entries.first(); - + if (!ChannelLog) { return console.log(red(`[Fetch Log Error]: This Log Type: 'CHANNEL_CREATE' has not been previously seen before while the 'channelCreate' event has been trigerred.`)); } else { @@ -427,11 +427,12 @@ client.on("channelCreate", async (channel) => { /** * Checks Whitelisted & Trusted Users Before banning */ - const Acess = require('./commands/Database/whitelist.json'); + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const Acess = require('./commands/Database/whitelist.json'); + + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); - const LogTimeString = createdTimestamp.toString(); const EventExecution = eventsTimestamp; @@ -619,7 +620,7 @@ client.on("channelDelete", async (channel) => { if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); const ChannelLog = FetchingLogs.entries.first(); - + if (!ChannelLog) { return console.log(red(`[Fetch Log Error]: This Log Type: 'CHANNEL_DELETE' has not been previously seen before while the 'channelDelete' event has been trigerred.`)); } else { @@ -669,10 +670,10 @@ client.on("channelDelete", async (channel) => { /** * Checks Whitelisted & Trusted Users Before banning */ - const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); - const Acess = require('./commands/Database/whitelist.json'); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const Acess = require('./commands/Database/whitelist.json'); + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); const LogTimeString = createdTimestamp.toString(); const EventExecution = eventsTimestamp; @@ -858,9 +859,9 @@ client.on("guildMemberAdd", async (member) => { }); if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); - + const botAddLog = FetchingLogs.entries.first(); - + if (!botAddLog) { return console.log(`${red(`[Fetch Log Error]: This Log Type: 'BOT_ADD' has not been previously seen before while the 'guildMemberAdd' event has been trigerred.`)}`); } else { @@ -876,11 +877,11 @@ client.on("guildMemberAdd", async (member) => { /** * Checks Whitelisted & Trusted Users Before banning */ - const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); - const Acess = require('./commands/Database/whitelist.json'); + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const Acess = require('./commands/Database/whitelist.json'); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); const successfulBan = new MessageEmbed() .setDescription(`**Unauthorised Bot Added By:** ${executor.tag} \n**Bot:** ${target.tag} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Ban.`) @@ -959,9 +960,9 @@ client.on("roleCreate", async (role) => { }); if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); - + const roleCreateLogs = FetchingLogs.entries.first(); - + if (!roleCreateLogs) { return console.log(`${red(`[Fetch Log Error]: This Log Type: 'ROLE_CREATE' has not been previously seen before while the 'roleCreate' event has been trigerred.`)}`); } else { @@ -987,8 +988,11 @@ client.on("roleCreate", async (role) => { .setColor("RED") .setTimestamp(Date.now()); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const Acess = require('./commands/Database/whitelist.json'); + + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); const LogTimeString = createdTimestamp.toString(); const EventExecution = eventsTimestamp; @@ -1052,7 +1056,7 @@ client.on("roleUpdate", async (oldRole, newRole) => { if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); const RoleUpdate = FetchingLogs.entries.first(); - + if (!RoleUpdate) { return console.log(`${red(`[Fetch Log Error]: This Log Type: 'ROLE_UPDATE' has not been previously seen before while the 'roleUpdate' event has been trigerred.`)}`); } else { @@ -1132,11 +1136,11 @@ client.on("roleUpdate", async (oldRole, newRole) => { .setColor("RED") .setTimestamp(Date.now()); - const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); - const Acess = require('./commands/Database/whitelist.json'); + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const Acess = require('./commands/Database/whitelist.json'); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); const LogTimeString = createdTimestamp.toString(); const EventExecution = eventsTimestamp; @@ -1330,7 +1334,7 @@ client.on("guildMemberUpdate", async (oldMember, newMember) => { if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); const MRU = FetchingLogs.entries.first(); - + if (!MRU) { return console.log(`${red(`[Fetch Log Error]: This Log Type: 'MEMBER_ROLE_UPDATE' has not been previously seen before while the 'guildMemberUpdate' event has been trigerred.`)}`); } else { @@ -1347,11 +1351,11 @@ client.on("guildMemberUpdate", async (oldMember, newMember) => { /** * Checks Whitelisted & Trusted Users Before banning */ - const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); - const Acess = require('./commands/Database/whitelist.json'); + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const Acess = require('./commands/Database/whitelist.json'); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); const successfulAdminPermBan = new MessageEmbed() .setDescription(`**Unauthorised Member Role Update By:** ${executor.tag}\n\n**Victim** ${target.tag} \n**Permission Update:** \`ADMINISTRATOR\` \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Ban | Executor & Victim.`) @@ -1606,84 +1610,84 @@ client.on("webhookUpdate", async channel => { }).catch((err) => { return console.log(`${red("[Log Type]: 'WEBHOOK_DELETE'\n[Log Error]: True")}\n${red("[Log Error Desc.]: " + err)}`) }); - + if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); - const WBU = FetchingLogs.entries.first(); - - if (!WBU) { - return console.log(`${red(`[Fetch Log Error]: This Log Type: 'WEBHOOK_CREATE' has not been previously seen before while the 'webhookUpdate' event has been trigerred.`)}`); - } else { - const { executor, target, createdAt, createdTimestamp } = WBU; - - console.log(`\n\n${grey("======================================")}\n${yellow("[!] An Event has been fired.")}\n${yellowBright("[Server]: " + channel.guild.name)}\n${green("[Event]: 'webhookUpdate'")}\n${greenBright("[Log Type]: 'WEBHOOK_CREATE'")}`) - console.log(`${greenBright(`[Event Desc.]: [Webhook]: ${target.name} Was created`)}`); - - console.log(`${blue(`[Log Timestamp]: ${createdTimestamp}`)}\n${blueBright(`[Event Timestamp]: ${eventsTimestamp}`)}`); - - /** - * Checks Whitelisted & Trusted Users Before banning - */ - const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + const WBU = FetchingLogs.entries.first(); + + if (!WBU) { + return console.log(`${red(`[Fetch Log Error]: This Log Type: 'WEBHOOK_CREATE' has not been previously seen before while the 'webhookUpdate' event has been trigerred.`)}`); + } else { + const { executor, target, createdAt, createdTimestamp } = WBU; + + console.log(`\n\n${grey("======================================")}\n${yellow("[!] An Event has been fired.")}\n${yellowBright("[Server]: " + channel.guild.name)}\n${green("[Event]: 'webhookUpdate'")}\n${greenBright("[Log Type]: 'WEBHOOK_CREATE'")}`) + console.log(`${greenBright(`[Event Desc.]: [Webhook]: ${target.name} Was created`)}`); + + console.log(`${blue(`[Log Timestamp]: ${createdTimestamp}`)}\n${blueBright(`[Event Timestamp]: ${eventsTimestamp}`)}`); + + /** + * Checks Whitelisted & Trusted Users Before banning + */ + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); const Acess = require('./commands/Database/whitelist.json'); - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); - - // Unsuccessful Ban Executor - - const WebhookBan = new MessageEmbed() - .setDescription(`**Unauthorised Webhook Created By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Ban.`) - .setColor(0x36393E) - .setTimestamp(Date.now()); - - const WebhookBanError = new MessageEmbed() - .setDescription(`**Unauthorised Webhook Created By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Not given.\n**Reason:** Missing Permissions.`) - .setColor("RED") - .setTimestamp(Date.now()); - - // Unsuccessful Ban Victim - - const LogTimeString = createdTimestamp.toString(); - const EventExecution = eventsTimestamp; - - const logtime = LogTimeString.slice(0, -3); - const eventtime = EventExecution.slice(0, -3); - - const logtime2 = LogTimeString.slice(0, -4); - const eventtime2 = EventExecution.slice(0, -4); - - if (logtime === eventtime) { - console.log(`${grey(`[Event Validity #1]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) - if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Creation" }).catch((err) => { - return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { - return console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }).then(() => { - return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { - console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }) - } else if (logtime2 === eventtime2) { - console.log(`${grey(`[Event Validity #2]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) - if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Creation" }).catch((err) => { - return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { - console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }).then(() => { - return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { - console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }) - } else { - return console.log(`${grey(`[Event Validity]: False`)}\n${magenta("[Reason]: Event was triggered but the timestamps didn't match.")}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.tag + " (Bot)")}\n${grey("======================================")}\n`) - } - } + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + + // Unsuccessful Ban Executor + + const WebhookBan = new MessageEmbed() + .setDescription(`**Unauthorised Webhook Created By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Ban.`) + .setColor(0x36393E) + .setTimestamp(Date.now()); + + const WebhookBanError = new MessageEmbed() + .setDescription(`**Unauthorised Webhook Created By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Not given.\n**Reason:** Missing Permissions.`) + .setColor("RED") + .setTimestamp(Date.now()); + + // Unsuccessful Ban Victim + + const LogTimeString = createdTimestamp.toString(); + const EventExecution = eventsTimestamp; + + const logtime = LogTimeString.slice(0, -3); + const eventtime = EventExecution.slice(0, -3); + + const logtime2 = LogTimeString.slice(0, -4); + const eventtime2 = EventExecution.slice(0, -4); + + if (logtime === eventtime) { + console.log(`${grey(`[Event Validity #1]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) + if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Creation" }).catch((err) => { + return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { + return console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }).then(() => { + return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { + console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }) + } else if (logtime2 === eventtime2) { + console.log(`${grey(`[Event Validity #2]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) + if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Creation" }).catch((err) => { + return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { + console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }).then(() => { + return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { + console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }) + } else { + return console.log(`${grey(`[Event Validity]: False`)}\n${magenta("[Reason]: Event was triggered but the timestamps didn't match.")}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.tag + " (Bot)")}\n${grey("======================================")}\n`) + } + } }); @@ -1699,83 +1703,83 @@ client.on("webhookUpdate", async channel => { }); if (!FetchingLogs) return console.log(red("[Entries Error] Unable to fetch Entries.")); - - const WBD = FetchingLogs.entries.first(); - - if (!WBD) { - return console.log(`${red(`[Fetch Log Error]: This Log Type: 'WEBHOOK_DELETE' has not been previously seen before while the 'webhookUpdate' event has been trigerred.`)}`); - } else { - const { executor, target, createdAt, createdTimestamp } = WBD; - - console.log(`\n\n${grey("======================================")}\n${yellow("[!] An Event has been fired.")}\n${yellowBright("[Server]: " + channel.guild.name)}\n${green("[Event]: 'webhookUpdate'")}\n${greenBright("[Log Type]: 'WEBHOOK_DELETE'")}`) - console.log(`${greenBright(`[Event Desc.]: [Webhook]: ${target.name} Was deleted.`)}`); - - console.log(`${blue(`[Log Timestamp]: ${createdTimestamp}`)}\n${blueBright(`[Event Timestamp]: ${eventsTimestamp}`)}`); - - /** - * Checks Whitelisted & Trusted Users Before banning - */ - const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); + + const WBD = FetchingLogs.entries.first(); + + if (!WBD) { + return console.log(`${red(`[Fetch Log Error]: This Log Type: 'WEBHOOK_DELETE' has not been previously seen before while the 'webhookUpdate' event has been trigerred.`)}`); + } else { + const { executor, target, createdAt, createdTimestamp } = WBD; + + console.log(`\n\n${grey("======================================")}\n${yellow("[!] An Event has been fired.")}\n${yellowBright("[Server]: " + channel.guild.name)}\n${green("[Event]: 'webhookUpdate'")}\n${greenBright("[Log Type]: 'WEBHOOK_DELETE'")}`) + console.log(`${greenBright(`[Event Desc.]: [Webhook]: ${target.name} Was deleted.`)}`); + + console.log(`${blue(`[Log Timestamp]: ${createdTimestamp}`)}\n${blueBright(`[Event Timestamp]: ${eventsTimestamp}`)}`); + + /** + * Checks Whitelisted & Trusted Users Before banning + */ + const TrustedUserIDs = require('./commands/Database/trustedUserIDs.json'); const Acess = require('./commands/Database/whitelist.json'); - - const WhiteListedUser = Acess.find(el => el === `${executor.id}`) - const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); - - // Unsuccessful Ban Executor - - const WebhookBan = new MessageEmbed() - .setDescription(`**Unauthorised Webhook Deleted By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Ban.`) - .setColor(0x36393E) - .setTimestamp(Date.now()); - - const WebhookBanError = new MessageEmbed() - .setDescription(`**Unauthorised Webhook Deleted By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Not given.\n**Reason:** Missing Permissions.`) - .setColor("RED") - .setTimestamp(Date.now()); - - // Unsuccessful Ban Victim - - const LogTimeString = createdTimestamp.toString(); - const EventExecution = eventsTimestamp; - - const logtime = LogTimeString.slice(0, -3); - const eventtime = EventExecution.slice(0, -3); - - const logtime2 = LogTimeString.slice(0, -4); - const eventtime2 = EventExecution.slice(0, -4); - - if (logtime === eventtime) { - console.log(`${grey(`[Event Validity #1]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) - if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Deleted" }).catch((err) => { - return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { - return console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }).then(() => { - return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { - console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }) - } else if (logtime2 === eventtime2) { - console.log(`${grey(`[Event Validity #2]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) - if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); - channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Deleted" }).catch((err) => { - return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { - console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }).then(() => { - return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { - console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); - }); - }) - } else { - return console.log(`${grey(`[Event Validity]: False`)}\n${magenta("[Reason]: Event was triggered but the timestamps didn't match.")}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.tag + " (Bot)")}\n${grey("======================================")}\n`) - } - } + + const WhiteListedUser = Acess.find(el => el === `${executor.id}`) + const Trusted = TrustedUserIDs.find((user) => user === `${executor.id}`); + + // Unsuccessful Ban Executor + + const WebhookBan = new MessageEmbed() + .setDescription(`**Unauthorised Webhook Deleted By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Ban.`) + .setColor(0x36393E) + .setTimestamp(Date.now()); + + const WebhookBanError = new MessageEmbed() + .setDescription(`**Unauthorised Webhook Deleted By:** ${executor.tag}\n\n**Webhook Name:** ${target.name} \n**Time:** ${createdAt.toDateString()} \n**Sentence:** Not given.\n**Reason:** Missing Permissions.`) + .setColor("RED") + .setTimestamp(Date.now()); + + // Unsuccessful Ban Victim + + const LogTimeString = createdTimestamp.toString(); + const EventExecution = eventsTimestamp; + + const logtime = LogTimeString.slice(0, -3); + const eventtime = EventExecution.slice(0, -3); + + const logtime2 = LogTimeString.slice(0, -4); + const eventtime2 = EventExecution.slice(0, -4); + + if (logtime === eventtime) { + console.log(`${grey(`[Event Validity #1]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) + if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Deleted" }).catch((err) => { + return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { + return console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }).then(() => { + return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { + console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }) + } else if (logtime2 === eventtime2) { + console.log(`${grey(`[Event Validity #2]: True`)}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.name + " (Webhook)")}`) + if (executor.id === client.user.id) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === channel.guild.ownerID) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + if (executor.id === WhiteListedUser || Trusted) return console.log(`${magentaBright(`[Action Type]: AUTHORISED`)}\n${grey("======================================")}\n`); + channel.guild.member(executor).ban({ reason: "Unauthorised Webhook Deleted" }).catch((err) => { + return console.log(`${redBright("[Trial]: False")}\n${red("[Sentence]: No Sentence Given")}\n${magentaBright("[Sentence Error]: " + err)}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBanError).catch((err) => { + console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }).then(() => { + return console.log(`${redBright("[Trial]: True")}\n${red("[Sentence]: Ban")}\n${grey("======================================")}\n`) + channel.guild.owner.send(WebhookBan).catch((err) => { + console.log(red("[Owner]: " + channel.guild.owner.user.tag + " could not be messaged. [Message Error Desc.]: " + err)); + }); + }) + } else { + return console.log(`${grey(`[Event Validity]: False`)}\n${magenta("[Reason]: Event was triggered but the timestamps didn't match.")}\n${cyan("[Executor]: " + executor.tag)}\n${cyanBright("[Target]: " + target.tag + " (Bot)")}\n${grey("======================================")}\n`) + } + } }); diff --git a/Private/restart.js b/Private/restart.js deleted file mode 100644 index 78689bb..0000000 --- a/Private/restart.js +++ /dev/null @@ -1,17 +0,0 @@ -var spawn = require('child_process').spawn; - -(function main() { - - if (process.env.process_restarting) { - delete process.env.process_restarting; - setTimeout(main, 1000); - return; - } - - // Restart process ... - spawn(process.argv[0], process.argv.slice(1), { - env: { process_restarting: 1 }, - detached: true, - stdio: 'ignore' - }).unref(); -})(); \ No newline at end of file diff --git a/README.md b/README.md index 8ca0db6..08395bf 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Only fast nukers are used for testing. A generic nuke tool would not get passed ## Repl.it? -- Yes. You can use this on Repl. [Click Here](https://replit.com/@17teen/Bladee-V3-Beta?v=1) +- Yes. You can use this on Repl. [Click Here](https://replit.com/@17teen/bladee?v=1) ## Bug(s): - Repeated offender bug: