bf8
bf8
Explore posts from servers
DIAdiscord.js - Imagine a bot
Created by bf8 on 7/27/2023 in #djs-voice
the audio does not want to play and i dont get any error
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);
}
},
};
9 replies
DIAdiscord.js - Imagine a bot
Created by bf8 on 7/27/2023 in #djs-voice
the audio does not want to play and i dont get any error
v18.13.0
9 replies
DIAdiscord.js - Imagine a bot
Created by bf8 on 7/27/2023 in #djs-voice
the audio does not want to play and i dont get any error
| `-- [email protected] deduped
| `-- [email protected] deduped
9 replies