Modified the audio player (still doesn't work though)

This commit is contained in:
ION606
2022-04-24 13:31:24 -04:00
parent a7b909a015
commit ba06b45b66
3 changed files with 9 additions and 26 deletions
+8 -25
View File
@@ -6,31 +6,14 @@ const { VoiceConnectionStatus, AudioPlayerStatus } = require('@discordjs/voice')
module.exports = {
name: "playaudio",
execute(message, args, client) {
message.channel.send("This command has not been set up yet\nSorry!");
return;
// //const guild = client.guilds.cache.get(client.guild.id);
// const channel = client.guilds.channels.cache.get('930148609406685227');
// channel.join()
// .then(connection => console.log('Connected'))
// .catch(console.error);
// const { createAudioResource, createAudioPlayer } = require('@discordjs/voice');
// const player = createAudioPlayer();
// const resource = createAudioResource('/home/user/voice/music.mp3', {
// metadata: {
// title: 'A good song!',
// },
// });
// // Not recommended - listen to errors from the audio player instead for most usecases!
// resource.playStream.on('error', error => {
// console.error('Error:', error.message, 'with track', resource.metadata.title);
// });
// player.play(resource);
// message.channel.send("This command has not been set up yet\nSorry!");
// return;
const ytdl = require('ytdl-core-discord');
const url = args[0];
async function play(connection, url) {
connection.playOpusStream(await ytdl(url));
}
}