Skip to content

Commit

Permalink
Merge branch 'slave'
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBoombastic committed Mar 29, 2023
2 parents e707ef4 + e128342 commit a1fe794
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 330 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Just get data of (nearly) all of Discord guild members. Or track deleted and edi

## Warning:

This app uses [fork of discord.js-selfbot-v13](https://github.com/MrBoombastic/discord.js-selfbot-v13/tree/old-deps).
This app uses [fork of discord.js-selfbot-v13](https://github.com/MrBoombastic/discord.js-selfbot-v13).

"I don't take any responsibility for blocked Discord accounts that used this module.
Using this on a user account is prohibited by the Discord TOS and can lead to the account block."
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "osintcord",
"version": "1.5.3",
"version": "1.5.4",
"description": "Get data of (nearly) all of Discord guild members",
"main": "src/index.js",
"scripts": {
Expand Down Expand Up @@ -36,11 +36,10 @@
"homepage": "https://github.com/MrBoombastic/OSINTCord#readme",
"dependencies": {
"dayjs": "^1.11.7",
"node-fetch": "^2.6.9",
"discord.js-selfbot-v13": "https://github.com/MrBoombastic/discord.js-selfbot-v13#1.5.3",
"dotenv": "^16.0.3",
"fs-extra": "^11.1.1",
"log4js": "^6.9.1",
"ora": "~5.4.1",
"request": "^2.88.2"
"ora": "~5.4.1"
}
}
33 changes: 14 additions & 19 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const fse = require("fs-extra"); // typings are broken, so I'm importing fs too :(
const fs = require("fs");
const request = require("request");
const path = require("path");
const packagejson = require("../package.json");
const fetch = require("node-fetch");

module.exports = {
formatUserData: function (member, spacing, dateFormat) {
Expand Down Expand Up @@ -50,9 +49,11 @@ module.exports = {
data += guild.members.cache.map(member => module.exports.formatUserData(member, process.env.SPACING, process.env.DATE_FORMAT)).join("\n");

// Save to file
const filename = `logs/members-${guild.id}-${Date.now()}.txt`;
const logsDir = './logs';
const filename = `${logsDir}/members-${guild.id}-${Date.now()}.txt`;
try {
fse.outputFileSync(filename, data);
if (!fs.existsSync(logsDir)) fs.mkdirSync(logsDir);
fs.writeFileSync(filename, data);
console.log(`Saved data to ${filename}!`);
} catch (e) {
console.error(e);
Expand All @@ -63,26 +64,20 @@ module.exports = {
client.destroy();
process.exit(0);
},
downloadFile: function (url) {
downloadFile: async function (url) {
const mediaDir = './media';
if (!fs.existsSync(mediaDir)) {
fs.mkdirSync(mediaDir);
}
if (!fs.existsSync(mediaDir)) fs.mkdirSync(mediaDir);

let fileName = url.replace("https://media.discordapp.net/attachments/", "");
fileName = fileName.replaceAll("/", "-");
const filePath = path.join(mediaDir, fileName);

request(url)
.on('error', (err) => {
console.error(`Error downloading file: ${err.message}`);
})
.pipe(fs.createWriteStream(filePath))
.on('error', (err) => {
console.error(`Error saving file: ${err.message}`);
})
.on('finish', () => {
console.log(`File saved to ${filePath}`);
});
const res = await fetch(url);
const data = await res.buffer();
if (res.ok) {
fs.writeFileSync(filePath, data);
console.log(`File saved to ${filePath}`);
} else console.error(`Failed to download deleted media (${url}): ${res.status} ${res.statusText}`);
},

art: `
Expand Down
Loading

0 comments on commit a1fe794

Please sign in to comment.