Speak in Stage Channel

i am using latest djs version,
if (newState.id === client.user.id && newState.channel?.type === 13) {
if (!oldState.channelId) {
try {

const hasRequestToSpeakPermission = newState.guild.members.me.permissions.has(
PermissionsBitField.Flags.RequestToSpeak
) || newState.channel.permissionsFor(newState.guild.members.me).has(
PermissionsBitField.Flags.RequestToSpeak
);

if (hasRequestToSpeakPermission) {
await newState.guild.members.me.voice.setRequestToSpeak(true).catch((err) => {
console.error("Failed to set Request to Speak:", err);
});
}
} catch (err) {
console.error("Error handling Stage Channel connection:", err);
const player = client.kazagumo.players.get(newState.guild.id);
if (player) {
player.pause(false); // Resume playback if there's an active player
}
}
}
}
if (newState.id === client.user.id && newState.channel?.type === 13) {
if (!oldState.channelId) {
try {

const hasRequestToSpeakPermission = newState.guild.members.me.permissions.has(
PermissionsBitField.Flags.RequestToSpeak
) || newState.channel.permissionsFor(newState.guild.members.me).has(
PermissionsBitField.Flags.RequestToSpeak
);

if (hasRequestToSpeakPermission) {
await newState.guild.members.me.voice.setRequestToSpeak(true).catch((err) => {
console.error("Failed to set Request to Speak:", err);
});
}
} catch (err) {
console.error("Error handling Stage Channel connection:", err);
const player = client.kazagumo.players.get(newState.guild.id);
if (player) {
player.pause(false); // Resume playback if there's an active player
}
}
}
}
here is how i am using voiceStateUpdate , and it logs as
...
rawError: {
message: 'Cannot execute action on this channel type',
code: 50024
},
...
...
rawError: {
message: 'Cannot execute action on this channel type',
code: 50024
},
...
how to fix this?
2 Replies
d.js toolkit
d.js toolkit4w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
A R Y A N
A R Y A NOP4w ago
yep nvm i fixed the error, i was trying to set the vc status to stage , but there is one problem which is not fixed ,bot joins stage channel but does not join as speaker i have to manually invite for speaker in stage Thank you , fixed it.

Did you find this page helpful?