inlife / discord-global-mutual

Get the list of people that you have shared servers with
MIT License
49 stars 12 forks source link

Error while running the export.js file #9

Open DyteSprite opened 4 years ago

DyteSprite commented 4 years ago

When running "node export.js [token]", console returns multiple similar errors.


[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
[info] requesting users for guild: xxxxxxxxxxxxxxxxxx
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)
TypeError: results.map is not a function
    at getMembers (C:\Users\<user>\Desktop\Discord-Mutuals-Finder\discord-global-mutual-master\export.js:12:34)
    at process._tickCallback (internal/process/next_tick.js:68:7)`
inlife commented 4 years ago

Hello,

Seems similar as #8. Discord might have changed api, i'll try to check it out when I will have some free time.

Cheers!

DyteSprite commented 4 years ago

Also just a quick suggestion,

Maybe incorporating a logging of Discord ID & tag, not just name. So instead of it's current printout of (as an example), "DyteSprite" as the name, it would be "DyteSprite#9999, 987654321123456789". This would help a lot of keeping track of users if they changed their name.

Thanks!

inlife commented 4 years ago

that is indeed a great suggestion

inlife commented 4 years ago

Seems like discord blocked the ability to use method for fetching members of the guild for user token. And currently, I don't see a way of how that can be fixed.

The error message that is returned:

{"message": "Missing Access", "code": 50001}
DyteSprite commented 4 years ago

Maybe it's possible to obtain via cache or something?

inlife commented 4 years ago

I tried all the possible ways that I'm aware of. I couldn't find anything that would work. Unfortunately, I think the project will remain in a "broken" state until someone hopefully will find a way to fix it.

ghost commented 4 years ago

Took your scripts and used Discord.js instead. Works like a charm so far. What's the format of your json exported files in /data ? @inlife (I want to use the same one, and couldn't see it as the json files are blank with the current script.)

inlife commented 4 years ago

oh, interesting @prrjn could you show how did you do that? I wanted to work on a new version until I got stuck on this issue

format for json files was simply following the api responses:

  1. fetch user guilds as an array image

  2. for each guild fetch users (they were stored as buch of json files in data/members folder): image

  3. and then they were glued together by user id's forming a json object, where keys are user ids, and one of the object's members was a new "shared_servers" field, containing an array of shared servers image

ghost commented 4 years ago

I'm currently re-working your export.js script to fix the issue. compare.js and print.js should work afterwards.

Here's the Discord.js method I used to fetch members from different guilds

Here's the 'homemade' script I used :

const Discord = require('discord.js');
const client = new Discord.Client();

const fs = require("fs");
const gracefulFs = require('graceful-fs');
gracefulFs.gracefulify(fs);
client.exported_data = require ("./exported_data.json");

client.once('ready', async () => {
    // Set the guild id
    const guild = client.guilds.get('THE_GUILD_ID')

    // Updating the members of the guild
    await fetch(guild)

    // Write in .json file every info for each member
    var i = 0
    guild.members.forEach( mem => {
        client.exported_data[i] = {
            ["user"]: {
                id: mem.user.id,
                username: mem.user.username,
                discriminator: mem.user.discriminator,
                avatar: mem.user.avatar,
                locale: mem.user.locale,
                verified: mem.user.verified,
                email: mem.user.email,
                flags: mem.user.flags,
                premium_type: mem.user.premium_type,
                created_at: mem.user.createdAt
            },
            ["nickname"]: mem.nickname,
            ["joined_at"]: mem.joinedAt,
            ["premium_since"]: mem.premium_since,
            ["roles"]: mem.roles
        } 
        i++

    })

    fs.writeFile("./exported_data.json", JSON.stringify (client.exported_data, null, 4), err => {
        if (err) throw err;

    })
    console.log('Done!')
});

async function fetch(oneGuild) {
    await oneGuild.fetchMembers()
    return console.log(oneGuild.members.size)
}

client.login("YOUR_DISCORD_TOKEN");
inlife commented 4 years ago

hm, but how are you fetching the guilds current user belongs to?
the script you showed me works as an exporter for a single guild

or am i missing something?

ghost commented 4 years ago

Yup, this was for testing! I need to loop on all user's guilds, create all the jsons, like your script.

inlife commented 4 years ago

if you find a way to do this, that would be amazing so far its the only problem im blocked by

xhist commented 4 years ago

So I'm not the only who is having the same problem.

inlife commented 4 years ago

yea, unfortunately, seems like discord decided to block the ability to do this at least as i understand the situation

madebynoxc commented 4 years ago

That would make sense considering how many problems they had with bots using user accounts to join the servers and spam DMs. They might have limited that functionality only to bot users that require owner invitation to join

inlife commented 4 years ago

yea, I can't say I disagree with how essentially unsecure all of that stuff was :D

DyteSprite commented 4 years ago

@prrjn any progress so far? :)

ayyneya commented 4 years ago

Was hoping to use this to check on spies from other guilds in a guild of an MMO I'm playing. Cause people are joining our discord to find us and harass us in game, but we don't know who they are. :(

madebynoxc commented 4 years ago

@ayyneya maybe you will benefit from server management bot like Tatsumaki, Mee6 or Miki

DyteSprite commented 4 years ago

Anyone have an updates on the status of this, or is it still completely broken?

inlife commented 4 years ago

no updates, most likely it is, i doubt discord made any changes in that regards