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 toolkit12mo 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
Syjalo12mo ago
<VoiceChannel>.members.has('id')
GMS
GMS12mo 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
Syjalo12mo 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)) {}
GMS
GMS12mo 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