Home > Back-end >  (DiscordJs v13) How do I get a list of a voice channel in discord interaction guild
(DiscordJs v13) How do I get a list of a voice channel in discord interaction guild

Time:05-11

I'm trying to get a list of all the voice channels that are on the interaction server to put it on a select menu later.

CodePudding user response:

You can simply use the guild object to list the channels, like so:

const { options, guild, member } = interaction;

// if you have not disabled caching 
let channels = guild.channels.cache

// no cache
let channels = await guild.channels.fetch()

More info at: https://discord.js.org/#/docs/discord.js/stable/class/Guild?scrollTo=channels

  • Related