wawa (he/him)
DIAdiscord.js - Imagine an app
•Created by wawa (he/him) on 7/26/2023 in #djs-questions
Getting Clients Connected to Voice Channels without Cache
I'm working on a bot that should help us see if people who signed up for an event are present in voice chat and if so assign them their attendance credit. For that I've created a slash command which loops through all voice channels and gets a list of all connected users and to what channels they are connected.
The issue is: once the bot is running, if a new client joins voice, it won't be displayed. Furthermore if a client leaves voice chat it's still displayed. To me it seams clear there's a caching issue.
Question: how can I get an up to date list of members in a channel at command invocation?
One thing I've already tried was refetching the guild channels, by using the
fetch
function of message.guild.channels
, however even if I use that
I still get the stale/outdated list of users. The c.members
doesn't have a fetch
function.
Intents used: ["Guilds", "GuildMembers", "GuildMessages", "MessageContent"]
Versions:
- Discord.JS: [email protected]
- Node: v18.17.09 replies