izy521 / discord.io

A small, single-file library for creating DiscordApp clients from Node.js or the browser
https://discord.gg/0MvHMfHcTKVVmIGP
MIT License
534 stars 155 forks source link

Not showing all users in server #185

Closed CheweyZ closed 7 years ago

CheweyZ commented 7 years ago

image

this image pretty much summarizes it

how i got it was bot.servers['12345678'].members

I've tried outputting the bots object to a file to check if anything was getting cropped but yet it's the same four members out of the 56

Note this is a userbot so some differences may be there i don't know

izy521 commented 7 years ago

Yeah, if you're using a user bot, you have to call bot.getAllUsers() in the ready event, then start your code in the allUsers event.

CheweyZ commented 7 years ago

in the documentation it says that only returns an error so what would I ref?

also is there any known reason as to why 1-4 people show as I've got some servers of 3 others where all 3 show up

izy521 commented 7 years ago

The method updates the lib, it doesn't return anything. You just us an allUsers event listener instead of ready.

bot.on('ready', bot.getAllUsers);
bot.on('allUsers', function() {
    //Now ready.
});

You need to use the getAllUsers method to correctly use a user-bot.