izy521 / discord.io

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

Empty Member Object Properties #314

Closed JamesonRGrieve closed 5 years ago

JamesonRGrieve commented 5 years ago

I've scoured the docs and for the life of me I can't figure out how to pull the roles list from the members of a server.

Upon viewing the typescript file I determined what I believed to be the correct string of properties, but it doesn't seem to be working.

var server = bot.servers[evt.d.guild_id];
for (var member in server.members)
{
   Info("User: "+bot.users[member].username+"#"+bot.users[member].discriminator);
   Info("Member ID: "+member);
   Info("Status: ")+server.members[member].status;
   Info("Roles: ")+server.members[member].roles.length;
}

produces the output:

info: User: Simple User Role Bot#1743
info: Member ID: 568838919878082561
info: Status:
info: Roles:

I've been trying for hours fiddling around with various permutations and reading the docs and various posts and I haven't been able to get those values to resolve for some reason. I may be missing something obvious as I'm a bit tired but I can't figure it out.

Any input is greatly appreciated.

P.S. The Info() method is a quick method I wrote that will output to both the winston console and optionally display a response in the server.

cloudrac3r commented 5 years ago

you need to put +server.members[member].status inside the parentheses to output the result of the string concatenation

JamesonRGrieve commented 5 years ago

Wow I actually feel really stupid now. Thanks for the second pair of eyes. I need to stop coding when I'm exhausted haha.

cloudrac3r commented 5 years ago

while you're here, feel free to join the help server: https://discord.gg/0MvHMfHcTKVVmIGP