From ba06b45b66e0520bae9cb22ec0aa909b953c0f3f Mon Sep 17 00:00:00 2001 From: ION606 Date: Sun, 24 Apr 2022 13:31:24 -0400 Subject: [PATCH] Modified the audio player (still doesn't work though) --- commands/kareoke.js | 2 +- commands/playAudio.js | 33 ++++++++------------------------- database.sqlite | Bin 32768 -> 32768 bytes 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/commands/kareoke.js b/commands/kareoke.js index 6d09327..02ecee8 100644 --- a/commands/kareoke.js +++ b/commands/kareoke.js @@ -1,6 +1,6 @@ module.exports ={ name: 'kareoke', - description: 'Sing your least-favorite song with you favorite person, me!', + description: 'Sing your least-favorite song with your favorite person, me!', execute(message, args) { const axios = require('axios'); const cheerio = require('cheerio') diff --git a/commands/playAudio.js b/commands/playAudio.js index 16229e6..12f1c30 100644 --- a/commands/playAudio.js +++ b/commands/playAudio.js @@ -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)); + } } diff --git a/database.sqlite b/database.sqlite index 029562f1581902e1b15dd93384f4b547781f9a72..23cccca1bf53a0550246d004f056eeed866b8bfa 100644 GIT binary patch delta 149 zcmZo@U}|V!njpjA{x=N#Z#D}i+~l7az`6O2zpwx!_of6E0VW0k Ii0A}G01jLd7ytkO