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
      }
    }
  }
}

here is how i am using voiceStateUpdate , and it logs as
...
 rawError: {
    message: 'Cannot execute action on this channel type',
    code: 50024
  },
...
how to fix this?
Was this page helpful?