voice channel
Why when i fetch a voice channel, and use the voiceChannel.members property, it works fine, but it does not refresh, like when someone leave, enter the voice channel, it do nothing, am making an API that is also combined with the discord bot for controll, this is the handler function:
exports.getAllMembersInRoom = catchAsync(async (req, res, next) => {
if (!req.params?.id)
return next(new AppError('Please provice channel id', 400));
// Get the voice channel object for the voice room you want to list the members of.
const voiceChannel = await client.channels.fetch(req.params.id);
if (!voiceChannel) return next(new AppError(
if (!voiceChannel.isVoiceBased())
return next(new AppError(
// Get the members of the voice channel.
const members = voiceChannel.members;
// Returning the members to the client
res.status(200).json({
status: 'success',
data: {
members,
},
});
});
exports.getAllMembersInRoom = catchAsync(async (req, res, next) => {
if (!req.params?.id)
return next(new AppError('Please provice channel id', 400));
// Get the voice channel object for the voice room you want to list the members of.
const voiceChannel = await client.channels.fetch(req.params.id);
if (!voiceChannel) return next(new AppError(
Invalid channel ID, 400));if (!voiceChannel.isVoiceBased())
return next(new AppError(
Please provide a voice channel ID, 400));// Get the members of the voice channel.
const members = voiceChannel.members;
// Returning the members to the client
res.status(200).json({
status: 'success',
data: {
members,
},
});
});