Compare commits
2 Commits
f76f42244f
...
2172572489
Author | SHA1 | Date |
---|---|---|
Jill | 2172572489 | |
Jill | ba5aaf12e5 |
10
src/index.js
10
src/index.js
|
@ -23,7 +23,6 @@ bot.once('ready', () => {
|
|||
const prefix = ';';
|
||||
const embedColor = 0xa0ffa5;
|
||||
const foggyImg = 'https://cdn.discordapp.com/attachments/789023763396165633/898908687299657728/552bb191-93e3-4eaa-b935-d5031f3845e7.gif';
|
||||
const ffprobeRegex = /Audio: ([^,\n]+), (\d+) ?Hz, ?([^,\n]+), ?([^,\n]+)(, ?([^,\n]+))?/;
|
||||
|
||||
async function checkVoiceChannel(msg) {
|
||||
if (!msg.guild) return;
|
||||
|
@ -95,7 +94,7 @@ async function play(song, id, connection, channel) {
|
|||
let err, out
|
||||
|
||||
try {
|
||||
err, out = await promisify(exec)('youtube-dl -f bestaudio --youtube-skip-dash-manifest --force-ipv4 -g "' + song.originalUrl + '"');
|
||||
err, out = await promisify(exec)('youtube-dl -f bestaudio,best --youtube-skip-dash-manifest --force-ipv4 -g "' + song.originalUrl + '"');
|
||||
} catch(err_) {
|
||||
err = err_;
|
||||
}
|
||||
|
@ -157,6 +156,10 @@ function rawYTDLQueue(info) {
|
|||
return song;
|
||||
}
|
||||
|
||||
function formatTime(t) {
|
||||
return `${Math.floor(t / 60).toString().padStart(2, '0')}:${Math.floor(t % 60).toString().padStart(2, '0')}`
|
||||
}
|
||||
|
||||
async function queueUp(url, id) {
|
||||
if (!queue[id]) queue[id] = [];
|
||||
|
||||
|
@ -246,7 +249,7 @@ bot.on('messageCreate', async (msg) => {
|
|||
if (q.length === 0) {
|
||||
msg.channel.send('no songs queued!');
|
||||
} else {
|
||||
msg.channel.send('```' + q.map((m, i) => `${i === 0 ? 'now playing:' : i + '.'} ${m.title}`).join('\n') + '```');
|
||||
msg.channel.send('```' + q.map((m, i) => `${i === 0 ? 'now playing:' : i + '.'} ${m.title} ${(m.duration !== 0) ? formatTime(m.duration) : ''}`).join('\n') + '```');
|
||||
}
|
||||
} else if (cmd === 'np' || cmd === 'nowplaying') {
|
||||
const song = (queue[msg.guild.id] || [])[0];
|
||||
|
@ -261,6 +264,7 @@ bot.on('messageCreate', async (msg) => {
|
|||
progressStr = '🔘 `buffering,,`';
|
||||
} else {
|
||||
progressStr = `${'▬'.repeat(Math.floor(Math.abs(progress) * progressLength))}🔘${'▬'.repeat(Math.floor((1 - Math.abs(progress)) * progressLength))}`;
|
||||
progressStr += `\n\`${formatTime((Date.now() - (playerStartTime[msg.guild.id] || 0)) / 1000)}\`/\`${formatTime(song.duration)}\``
|
||||
}
|
||||
|
||||
let embed = new Discord.MessageEmbed()
|
||||
|
|
Reference in New Issue