Closed KriskotooBG closed 5 years ago
bot.servers[serverID].channels
where serverID
equals preset value or something like event.d.guild_id
to list only channel names you could use something like
Object.values(bot.servers[serverID].channels).map(c => c.name)
types of channels on the other hand vary (they are listed on discord API website), for example 0
means text channel, while 2
means voice channel, you can use that information in similar fashion:
Object.values(bot.servers[serverID].channels).filter(c => c.type == 2)
This would list all voice channel objects in the server, for just their names you would do combination of filter and map
Object.values(bot.servers[serverID].channels).filter(c => c.type == 2).map(c => c.name)
I believe you figured it out by now but just to be clear, finding channel ID of a channel with certain name and type would work like this (for a text channel named "general")
Object.values(bot.servers[serverID].channels).find(c => c.type == 0 && c.name == "general").id
Thanks @Peacerekam! I guess I didn't read the docs carefully enough still haven't tried it but I'm sure it will work thank you!
I've read through the whole documentation but didn't find a way to get a list of the channels in a server. I tried Google but again no luck. What I'm trying to accomplish is get the general vc's Id and the general text channel id if they are not called general get the first vc's id and same with the text
I tried a couple of stuff but no luck I'm starting to think this is not possible?