-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed ALL in watchdog mode, housekeeping
- Loading branch information
1 parent
817648c
commit 5fec919
Showing
5 changed files
with
80 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const {art, saveAndExit} = require("../../utils"); | ||
const {perms, overlap, bruteforce} = require("../../steps"); | ||
module.exports = async (client) => { | ||
console.log(art.replace("$MODE", process.env.MODE)); | ||
console.log(`Logged in as ${client.user.tag} (${client.user?.emailAddress || "NO EMAIL"})`); | ||
|
||
// Getting target | ||
const guild = await client.guilds.cache.get(process.env.GUILD_ID); | ||
if (!guild?.available) { | ||
console.error("ERROR: selected guild is not available!\nAvailable guilds:", client.guilds.cache.map(x => `${x.name} (${x.id})`).join(", ")); | ||
process.exit(1); | ||
} | ||
const channel = await guild.channels.cache.get(process.env.CHANNEL_ID); | ||
if (!channel) { | ||
console.warn("WARNING: selected channel is missing! 'Member list' method will be skipped\nAvailable channels: ", guild.channels.cache.map(x => `${x.name} (${x.id})`).join(", ")); | ||
} | ||
|
||
console.log(`Target acquired: ${guild.name} (${channel?.name || "NO CHANNEL"})`); | ||
|
||
// Fetching! | ||
await perms(guild); // Method 1 - fetching with perms | ||
if (channel) await overlap(guild, client); // Method 2 - overlap member list fetching | ||
if ((guild.members.cache.size < guild.memberCount) && (guild.members.cache.size !== guild.memberCount)) await bruteforce(guild); // Method 3 - brute-force fetching | ||
|
||
// Done! | ||
console.log(`Fetching done! Found ${guild.members.cache.size}/${guild.memberCount} => ${guild.members.cache.size / guild.memberCount * 100}% members.`); | ||
|
||
await saveAndExit(client, guild); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const {downloadFile} = require("../../utils"); | ||
module.exports = async (client, message) => { | ||
if (message.guildId === process.env.GUILD_ID || process.env.GUILD_ID.toLowerCase() === "all") { | ||
let info = `DELETED MESSAGE: Guild: ${message.guild.name} Channel: ${message.channel.name} Author: ${message.author?.tag} Bot: ${message.author?.bot}\nCONTENT: ${message.cleanContent}`; | ||
if (message.attachments.size > 0) { | ||
info += `\nMEDIA: ${message.attachments.map(x => x.proxyURL).join(", ")}`; | ||
message.attachments.forEach(x => { | ||
downloadFile(x.proxyURL); | ||
}); | ||
} | ||
client.logger.info(info); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = async (client, oldMsg, newMsg) => { | ||
if ((oldMsg.guildId === process.env.GUILD_ID || process.env.GUILD_ID.toLowerCase() === "all") && oldMsg.content !== newMsg.content) { | ||
let info = `EDITED MESSAGE: Guild: ${oldMsg.guild.name} Channel: ${oldMsg.channel.name} Author: ${oldMsg.author?.tag} Bot: ${oldMsg.author?.bot} | ||
OLD: ${oldMsg.content} | ||
NEW: ${newMsg.content}`; | ||
if (oldMsg.attachments.size > 0) info += `\nOLD MEDIA: ${newMsg.attachments.map(x => x.url).join(", ")}`; | ||
if (newMsg.attachments.size > 0) info += `\nNEW MEDIA: ${newMsg.attachments.map(x => x.url).join(", ")}`; | ||
client.logger.info(info); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const log4js = require("log4js"); | ||
const {art} = require("../../utils"); | ||
module.exports = async (client) => { | ||
console.log(art.replace("$MODE", process.env.MODE)); | ||
console.log(`Logged in as ${client.user.tag} (${client.user?.emailAddress || "NO EMAIL"})`); | ||
|
||
// Getting target | ||
const info = process.env.GUILD_ID.toLowerCase() === "all" ? "ALL GUILDS" : await client.guilds.cache.get(process.env.GUILD_ID).name; | ||
console.log(`Target acquired: ${info}`); | ||
|
||
// Set up message logging | ||
log4js.configure({ | ||
appenders: {watchdog: {type: "file", filename: `${process.env.GUILD_ID}.log`}}, | ||
categories: {default: {appenders: ["watchdog"], level: "info"}}, | ||
}); | ||
|
||
client.logger = log4js.getLogger("watchdog"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters