the audio does not want to play and i dont get any error

whats the fix?
5 Replies
d.js toolkit
d.js toolkit17mo 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!
bf8
bf8OP17mo ago
| `-- [email protected] deduped
| `-- [email protected] deduped
v18.13.0
const { createAudioPlayer, createAudioResource, joinVoiceChannel, AudioPlayerStatus } = require('@discordjs/voice');
const { Client, CommandInteraction, ApplicationCommandType } = require('discord.js');

const radioStreams = [
{ name: 'TAKE ME HIGHER', url: 'https://fortnite.gg/img/items/7753/audio.mp3' },
{ name: 'CALL IT BAD LUCK', url: 'https://fortnite.gg/img/items/8385/audio.mp3' },
];

module.exports = {
name: 'radio',
description: 'plays Fortnite Radio',
type: ApplicationCommandType.ChatInput,

/**
* @param {Client} client
* @param {CommandInteraction} interaction
*/
run: async (client, interaction) => {
try {
const randomIndex = Math.floor(Math.random() * radioStreams.length);
const selectedSong = radioStreams[randomIndex];

const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator,
});

const audioPlayer = createAudioPlayer();
const resource = createAudioResource(selectedSong.url, { inlineVolume: true });

audioPlayer.play(resource);
connection.subscribe(audioPlayer);

audioPlayer.on(AudioPlayerStatus.Idle, () => {
connection.destroy();
});

await interaction.reply({ content: `Now playing: "${selectedSong.name}".` });
} catch (err) {
console.log(err);
}
},
};
const { createAudioPlayer, createAudioResource, joinVoiceChannel, AudioPlayerStatus } = require('@discordjs/voice');
const { Client, CommandInteraction, ApplicationCommandType } = require('discord.js');

const radioStreams = [
{ name: 'TAKE ME HIGHER', url: 'https://fortnite.gg/img/items/7753/audio.mp3' },
{ name: 'CALL IT BAD LUCK', url: 'https://fortnite.gg/img/items/8385/audio.mp3' },
];

module.exports = {
name: 'radio',
description: 'plays Fortnite Radio',
type: ApplicationCommandType.ChatInput,

/**
* @param {Client} client
* @param {CommandInteraction} interaction
*/
run: async (client, interaction) => {
try {
const randomIndex = Math.floor(Math.random() * radioStreams.length);
const selectedSong = radioStreams[randomIndex];

const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.guild.id,
adapterCreator: interaction.guild.voiceAdapterCreator,
});

const audioPlayer = createAudioPlayer();
const resource = createAudioResource(selectedSong.url, { inlineVolume: true });

audioPlayer.play(resource);
connection.subscribe(audioPlayer);

audioPlayer.on(AudioPlayerStatus.Idle, () => {
connection.destroy();
});

await interaction.reply({ content: `Now playing: "${selectedSong.name}".` });
} catch (err) {
console.log(err);
}
},
};
Kobra
Kobra16mo ago
I'm also getting the same issue but with discord-player and ytdl. It seems to be an issue within DiscordJs/Voice somewhere since certain voice servers on discord are broken.
bunnyears6776
bunnyears677616mo ago
hi
Kobra
Kobra16mo ago
I had no idea it was against TOS. It's not a public bot, I was just seeing what I could do.
Want results from more Discord servers?
Add your server