qeled / discordie

Predictable JavaScript abstractions for Discord API.
https://qeled.github.io/discordie/
BSD 2-Clause "Simplified" License
190 stars 45 forks source link

No way to step through Guild_Array/Channel_Array besides forEach #77

Open Ryu945 opened 7 years ago

Ryu945 commented 7 years ago

There is no way to step through those IGuildCollection/IChannelCollection besides using forEach which you can't use in all coding situations. For example, you can't denote them with [i] for i = 1 to 50 or anything like that.

Ryu945 commented 7 years ago

I ended up making a function like this to get around the problem.

function guild_selector(guilds, index) {
    var ID = guilds.toArray()[index].id;
    var guild = guilds.get(ID);
    return guild;
}
drdrjojo commented 7 years ago

It doesn't make sense to go by indexes, when a guild because unavailable. You should go by id and access them directly over guild.get(id).

Ryu945 commented 7 years ago

This is if you want to going through a guild on the list but do not want to go through them all. Just the very next one.