Skip to content
This repository has been archived by the owner on Oct 26, 2020. It is now read-only.

Error while running the export.js file #9

Open
DyteSprite opened this issue Jan 9, 2020 · 21 comments
Open

Error while running the export.js file #9

DyteSprite opened this issue Jan 9, 2020 · 21 comments

Comments

@DyteSprite
Copy link

DyteSprite commented Jan 9, 2020

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
Copy link
Owner

inlife commented Jan 9, 2020

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
Copy link
Author

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
Copy link
Owner

inlife commented Jan 11, 2020

that is indeed a great suggestion

@inlife
Copy link
Owner

inlife commented Jan 11, 2020

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
Copy link
Author

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

@inlife
Copy link
Owner

inlife commented Jan 13, 2020

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
Copy link

ghost commented Jan 20, 2020

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
Copy link
Owner

inlife commented Jan 20, 2020

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
Copy link

ghost commented Jan 20, 2020

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
Copy link
Owner

inlife commented Jan 20, 2020

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
Copy link

ghost commented Jan 20, 2020

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

@inlife
Copy link
Owner

inlife commented Jan 20, 2020

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

@xhist
Copy link

xhist commented Jan 21, 2020

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

@inlife
Copy link
Owner

inlife commented Jan 21, 2020

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

@madebynoxc
Copy link
Collaborator

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
Copy link
Owner

inlife commented Jan 21, 2020

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

@DyteSprite
Copy link
Author

@prrjn any progress so far? :)

@ayyneya
Copy link

ayyneya commented Feb 16, 2020

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
Copy link
Collaborator

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

@DyteSprite
Copy link
Author

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

@inlife
Copy link
Owner

inlife commented Apr 28, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants