diff --git a/commands/music.js b/commands/music.js index c21f68e..5b9a704 100644 --- a/commands/music.js +++ b/commands/music.js @@ -47,7 +47,6 @@ async function play (bot, values, discord, channeldc, selector, config) { bot.music.queue.push(song) bot.music.play(song) } catch (e) { - bot.console.error(e.stack) if (discord) { const Embed = new EmbedBuilder() .setColor(config.discord.embedsColors.error) @@ -71,6 +70,8 @@ async function playUrl (bot, values, discord, channeldc, selector, config) { responseType: 'arraybuffer' }) + song = await bot.music.load(response.data, getFilenameFromUrl(url)) + if (discord) { const Embed = new EmbedBuilder() .setColor(config.discord.embedsColors.normal) @@ -81,7 +82,6 @@ async function playUrl (bot, values, discord, channeldc, selector, config) { bot.tellraw(selector, [{ text: 'Added ', color: 'white' }, { text: song.name, color: 'gold' }, { text: ' to the song queue', color: 'white' }]) } - song = await bot.music.load(response.data, getFilenameFromUrl(url)) bot.music.queue.push(song) bot.music.play(song) } catch (_err) { @@ -168,8 +168,7 @@ module.exports = { alias: [], trusted: 0, usage: [ - 'play ', - 'playurl ', + 'play ', 'stop', 'loop ', 'list [directory]', @@ -180,10 +179,12 @@ module.exports = { execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { switch (args[0]) { case 'play': - play(bot, args.slice(1), false, null, selector, config) - break - case 'playurl': - playUrl(bot, args.slice(1), false, null, selector, config) + case 'playurl': // deprecated + if (args.slice(1).startsWith('http')) { + playUrl(bot, args.slice(1), false, null, selector, config) + } else { + play(bot, args.slice(1), false, null, selector, config) + } break case 'stop': try {