Discord.js: Does user.voiceChannel Still Exist?

Created on 8 Oct 2016  路  2Comments  路  Source: discordjs/discord.js

I am making a crude bot (since I am new at java script), and was wondering if "user.voiceChannel" still existed. When I looked through the structure I did not see it, but I saw it was added a while back. I am just wanting the bot to see if the author of a command message is in a voice channel so that it can join the channel, play a short audio file that is about 3 seconds long, and leave the channel at the end of the audio file.

Any help is much appreciated!

question (please use Discord instead)

Most helpful comment

Message.member and GuildMember.voiceChannel are what you want.

And please, _please_ do not use Collection.find for IDs. Just use Collection.get. Collections extend Map.

All 2 comments

There might be an easier way to do this, but I started from the client, found the Guild, and then the appropriate GuildMember which has the voiceChannel property that you're looking for.

client.guilds.find('id', msg.guild.id).members.find('id', msg.author.id).voiceChannel

Message.member and GuildMember.voiceChannel are what you want.

And please, _please_ do not use Collection.find for IDs. Just use Collection.get. Collections extend Map.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SirDeadlystrike picture SirDeadlystrike  路  32Comments

ericnelson0 picture ericnelson0  路  62Comments

JMTK picture JMTK  路  20Comments

DreamXZE picture DreamXZE  路  39Comments

Yimura picture Yimura  路  21Comments