forgorRrRR

This commit is contained in:
ChomeNS 2023-02-28 14:21:14 +07:00
parent 33f03675fb
commit 76302ea658

View file

@ -47,7 +47,6 @@ async function play (bot, values, discord, channeldc, selector, config) {
bot.music.queue.push(song) bot.music.queue.push(song)
bot.music.play(song) bot.music.play(song)
} catch (e) { } catch (e) {
bot.console.error(e.stack)
if (discord) { if (discord) {
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.error) .setColor(config.discord.embedsColors.error)
@ -71,6 +70,8 @@ async function playUrl (bot, values, discord, channeldc, selector, config) {
responseType: 'arraybuffer' responseType: 'arraybuffer'
}) })
song = await bot.music.load(response.data, getFilenameFromUrl(url))
if (discord) { if (discord) {
const Embed = new EmbedBuilder() const Embed = new EmbedBuilder()
.setColor(config.discord.embedsColors.normal) .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' }]) 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.queue.push(song)
bot.music.play(song) bot.music.play(song)
} catch (_err) { } catch (_err) {
@ -168,8 +168,7 @@ module.exports = {
alias: [], alias: [],
trusted: 0, trusted: 0,
usage: [ usage: [
'play <song>', 'play <song|url>',
'playurl <url>',
'stop', 'stop',
'loop <all|current|off>', 'loop <all|current|off>',
'list [directory]', 'list [directory]',
@ -180,10 +179,12 @@ module.exports = {
execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) { execute (bot, username, sender, prefix, args, config, hash, ownerhash, selector) {
switch (args[0]) { switch (args[0]) {
case 'play': case 'play':
play(bot, args.slice(1), false, null, selector, config) case 'playurl': // deprecated
break if (args.slice(1).startsWith('http')) {
case 'playurl':
playUrl(bot, args.slice(1), false, null, selector, config) playUrl(bot, args.slice(1), false, null, selector, config)
} else {
play(bot, args.slice(1), false, null, selector, config)
}
break break
case 'stop': case 'stop':
try { try {