javascriptnode.jsdiscorddiscord.js

Open chat on voice channel discord.js v13


I know I can send messages on a voice channel's chat panel as a discord user like so :

Open chat

Message sent in the voice channel

But I have no idea how to achieve the same thing using discord.js, there's absolutely nothing I can find about this on google, the official documentation or anywhere else??

For context, this is how I send messages on (for example) a text channel:

client.channels.cache.get("id_of_the_channel").send('Test message !')

But if I try this with a voice channel, it tells me that client.channels.cache.get(...).send is not a function, while I'm sure to having copied the good id since my channelinfo command works with this id and that my bot is in the server of the channel, therefore I guess VoiceChannels don't have a send method.

So, how to do the same on those voice channels?


Solution

  • VoiceChannel#send() is only available from v13.8.0, so you'll need to upgrade your discord.js to use this feature.