Question about GuildChannel

<GuildChannel>.members(memberId)
<GuildChannel>.members(memberId)
how can i check if a certain member connected to the voice
5 Replies
d.js toolkit
d.js toolkit2y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
Syjalo
Syjalo2y ago
<VoiceChannel>.members.has('id')
Shahar
ShaharOP2y ago
so somthing like this would work?
(event client ready)
const guilds = await guildService.getAllGuilds();
for (const guild of guilds) {
const guildId = guild.guildId;
const realGuild = client.guilds.cache.get(guildId);
const channel = realGuild.channels.cache.get(channelId);
if(channel.members.has(dbChannel.channelOwner)){
//user is in the channel
}
(event client ready)
const guilds = await guildService.getAllGuilds();
for (const guild of guilds) {
const guildId = guild.guildId;
const realGuild = client.guilds.cache.get(guildId);
const channel = realGuild.channels.cache.get(channelId);
if(channel.members.has(dbChannel.channelOwner)){
//user is in the channel
}
Syjalo
Syjalo2y ago
Yes, but you can just do
const channel = client.channels.cache.get('id');
if (channel.members.has(dbChannel.channelOwner)) {}
const channel = client.channels.cache.get('id');
if (channel.members.has(dbChannel.channelOwner)) {}
Shahar
ShaharOP2y ago
ahh I see. thanks OH yea, it was just an example, in my code the channels id comes from the data base, then i check if the channels exist or not
Want results from more Discord servers?
Add your server