if (whereChoice === 'in Voice') { await interaction.deferReply({ ephemeral: true }) if (!interaction.member.voice.channel) return interaction.editReply({ content: `You should be in Voice Channel to Use This Command`, ephemeral: true }); if (interaction.guild.me.voice.channel && interaction.guild.me.voice.channel.id !== `917264372630446130`) return interaction.editReply({ content: `I cant connect to your Voice right now i am in ${interaction.guild.me.voice.channel}`, ephemeral: true }); const Channel = interaction.member.voice.channel if (!Channel.permissionsFor(interaction.guild.me).has("VIEW_CHANNEL")) return interaction.editReply({ content: `I Dont have permission to View ${Channel} | Needed permission: \`View Channel\``, ephemeral: true }) if (!Channel.permissionsFor(interaction.guild.me).has("CONNECT")) return interaction.editReply({ content: `I Dont have permission to connect to ${Channel} | Needed permission: \`Connect\``, ephemeral: true }) if (!Channel.permissionsFor(interaction.guild.me).has("SPEAK")) return interaction.editReply({ content: `I Dont have permission to speak in ${Channel} | Needed permission: \`Speak\``, ephemeral: true }) if (!Channel.permissionsFor(interaction.member).has("SPEAK")) return interaction.editReply({ content: `You Dont have permission to speak in ${Channel} | Needed permission: \`Speak\``, ephemeral: true }) if (interaction.member.voice.serverMute || interaction.member.voice.selfMute) return interaction.editReply({ content: `You Can't use this command when you are mute`, ephemeral: true }) if (interaction.member.voice.serverDeaf || interaction.member.voice.selfDeaf) return interaction.editReply({ content: `You Can't use this command when you are deafen`, ephemeral: true }) const player = voiceDiscord.createAudioPlayer(); const connection = voiceDiscord.joinVoiceChannel({ channelId: Channel.id, guildId: interaction.guild.id, adapterCreator: interaction.guild.voiceAdapterCreator, selfDeaf: true, }); player.play(resource); connection.subscribe(player); await interaction.editReply({ content: `Connected to ${Channel} - Voice: ${songName}`, ephemeral: true }); player.on(voiceDiscord.AudioPlayerStatus.Idle, () => { connection.destroy(); }); }