parent
a119e84a42
commit
e3410aa97b
@ -0,0 +1,25 @@ |
|||||||
|
const Discord = require('discord.js'); |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
name: "clearqueue", |
||||||
|
aliases: ['cq'], |
||||||
|
meta: { |
||||||
|
category: 'Music', |
||||||
|
description: "Clear your music queue", |
||||||
|
syntax: '`clearqueue`', |
||||||
|
extra: null |
||||||
|
}, |
||||||
|
help: "Clear your music queue", |
||||||
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||||
|
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");} |
||||||
|
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");} |
||||||
|
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");} |
||||||
|
|
||||||
|
let ct = client.misc.queue[message.guild.id].queue[0]; |
||||||
|
client.misc.queue[message.guild.id].queue = []; |
||||||
|
client.misc.queue[message.guild.id].queue.push(ct); |
||||||
|
|
||||||
|
require('../../util/updatecontroller')(message, client); |
||||||
|
message.channel.send("Queue cleared!"); |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,22 @@ |
|||||||
|
const Discord = require('discord.js'); |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
name: "pause", |
||||||
|
aliases: ['pa', 'res', 'resume'], |
||||||
|
meta: { |
||||||
|
category: 'Music', |
||||||
|
description: "Pause/play the current song", |
||||||
|
syntax: '`pause`', |
||||||
|
extra: null |
||||||
|
}, |
||||||
|
help: "Pause/play the current song", |
||||||
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||||
|
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");} |
||||||
|
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");} |
||||||
|
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");} |
||||||
|
|
||||||
|
await client.misc.queue[message.guild.id].player.pause(!client.misc.queue[message.guild.id].player.paused); |
||||||
|
require('../../util/updatecontroller')(message, client); |
||||||
|
return message.channel.send(`${client.misc.queue[message.guild.id].player.paused ? "Paused your music." : "Resuming the tunes <a:NC_happy:830701612426199040>"}`); |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,59 @@ |
|||||||
|
const Discord = require('discord.js'); |
||||||
|
const moment = require('moment'); |
||||||
|
require('moment-precise-range-plugin'); |
||||||
|
|
||||||
|
const {Pagination} = require('../../util/pagination'); |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
name: "queue", |
||||||
|
aliases: ['q'], |
||||||
|
meta: { |
||||||
|
category: 'Music', |
||||||
|
description: "View your music queue", |
||||||
|
syntax: '`queue`', |
||||||
|
extra: null |
||||||
|
}, |
||||||
|
help: "View your music queue", |
||||||
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||||
|
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");} |
||||||
|
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");} |
||||||
|
|
||||||
|
let queue = client.misc.queue[message.guild.id].queue; |
||||||
|
if (queue.length > 10) { |
||||||
|
let pages = []; |
||||||
|
let x = 0; |
||||||
|
while (true) { |
||||||
|
let cond = false; |
||||||
|
let page = ''; |
||||||
|
for (let i = 0; i < 10; i++) { |
||||||
|
if (queue[(x * 10) + i] === undefined) {cond = true; break;} |
||||||
|
page += `**${(x * 10) + i + 1}.** **${queue[(x * 10) + i].song.info.title}** - ${queue[(x * 10) + i].song.info.author}\n<@${queue[(x * 10) + i].player}> | ${moment.preciseDiff(Date.now(), Date.now() + queue[(x * 10) + i].song.info.length)}\n`; |
||||||
|
if ((x * 10) + i >= queue.length) {cond = true; break;} |
||||||
|
} |
||||||
|
pages.push(new Discord.MessageEmbed() |
||||||
|
.setTitle(`Server Music Queue [${(x * 10) + 1}-${(x * 10) + 10} of ${queue.length}]`) |
||||||
|
.setThumbnail(message.guild.iconURL({size: 2048})) |
||||||
|
.setDescription(page) |
||||||
|
.setColor('2c9cb0') |
||||||
|
.setFooter("Kit", client.user.avatarURL()) |
||||||
|
.setTimestamp() |
||||||
|
); |
||||||
|
if (cond) {break;} |
||||||
|
x++; |
||||||
|
} |
||||||
|
let queueList = new Pagination(message.channel, pages, message, client, true); |
||||||
|
return queueList.start({user: message.author.id, endTime: 60000}); |
||||||
|
} else { |
||||||
|
let page = ''; |
||||||
|
for (let i = 0; i < queue.length; i++) {page += `**${i + 1}.** **${queue[i].song.info.title}** - ${queue[i].song.info.author}\n<@${queue[i].player}> | ${moment.preciseDiff(Date.now(), Date.now() + queue[i].song.info.length)}\n`;} |
||||||
|
return message.channel.send(new Discord.MessageEmbed() |
||||||
|
.setTitle(`Server Music Queue - ${queue.length}`) |
||||||
|
.setThumbnail(message.guild.iconURL({size: 2048})) |
||||||
|
.setDescription(page) |
||||||
|
.setColor('2c9cb0') |
||||||
|
.setFooter("Kit", client.user.avatarURL()) |
||||||
|
.setTimestamp() |
||||||
|
); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
@ -0,0 +1,44 @@ |
|||||||
|
const Discord = require('discord.js'); |
||||||
|
|
||||||
|
const updateController = require('../../util/updatecontroller'); |
||||||
|
|
||||||
|
module.exports = { |
||||||
|
name: "skip", |
||||||
|
aliases: ['s'], |
||||||
|
meta: { |
||||||
|
category: 'Music', |
||||||
|
description: "Skips the currently-playing song", |
||||||
|
syntax: '`skip [count]`', |
||||||
|
extra: null |
||||||
|
}, |
||||||
|
help: "Skips the currently-playing song", |
||||||
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
||||||
|
if (!message.guild) {return message.channel.send("You must be in a server in order to use this command!");} |
||||||
|
if (!client.misc.queue[message.guild.id]) {return message.channel.send("This server doesn't have any music playing!");} |
||||||
|
if (!message.member.voice.channel || !message.member.voice.channel === client.misc.queue[message.guild.id].updates) {return message.channel.send("You're not in the music voice channel!");} |
||||||
|
|
||||||
|
let skips = 0; |
||||||
|
|
||||||
|
async function skip() { |
||||||
|
client.misc.queue[message.guild.id].queue.shift(); |
||||||
|
skips++; |
||||||
|
|
||||||
|
if (!client.misc.queue[message.guild.id].queue.length) { |
||||||
|
await client.lavacordManager.leave(message.guild.id); |
||||||
|
message.guild.channels.cache.get(client.misc.queue[message.guild.id].updates).send('Finished playing.'); |
||||||
|
delete client.misc.queue[message.guild.id]; |
||||||
|
return false; |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
if (args[0] && (isNaN(Number(args[0])) || Number(args[0]) < 1)) {return message.channel.send("You must specify a positive number of songs to delete!");} |
||||||
|
if (args[0] && Number(args[0]) > 50) {return message.channel.send("That's too big of a number!");} |
||||||
|
let count = args[0] ? Number(args[0]) : 1; |
||||||
|
for (let i=0; i < count; i++) {if (!skip()) {break;}} |
||||||
|
|
||||||
|
await message.channel.send(`Skipped ${skips} song${skips === 1 ? '' : 's'}!`); |
||||||
|
await client.misc.queue[message.guild.id].player.play(client.misc.queue[message.guild.id].queue[0].song.track); |
||||||
|
await updateController(message, client); |
||||||
|
} |
||||||
|
}; |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,21 @@ |
|||||||
|
const Discord = require("discord.js"); |
||||||
|
const moment = require('moment'); |
||||||
|
require('moment-precise-range-plugin'); |
||||||
|
|
||||||
|
module.exports = async (message, client) => { |
||||||
|
let t = client.misc.queue[message.guild.id].queue[0]; |
||||||
|
let length = 0; |
||||||
|
client.misc.queue[message.guild.id].queue.forEach(x => length += x.song.info.length); |
||||||
|
await client.misc.queue[message.guild.id].controller.edit("", new Discord.MessageEmbed() |
||||||
|
.setAuthor("Now Playing", client.users.cache.get(t.player).avatarURL()) |
||||||
|
.setTitle(t.song.info.title) |
||||||
|
.setThumbnail(`https://i.ytimg.com/vi/${t.song.info.identifier}/maxresdefault.jpg`) |
||||||
|
.setDescription(`Channel: ${t.song.info.author}\n[Original video](${t.song.info.uri})`) |
||||||
|
.addField("Queued By", `<@${t.player}>`, true) |
||||||
|
.addField("Length", moment.preciseDiff(Date.now(), Date.now() + t.song.info.length), true) |
||||||
|
.addField("Songs in Queue", `**${client.misc.queue[message.guild.id].queue.length}** Song${client.misc.queue[message.guild.id].queue.length > 1 ? 's' : ''}\n${moment.preciseDiff(Date.now(), Date.now() + length)}${client.misc.queue[message.guild.id].queue.length > 1 ? `\n\nNext up: **${client.misc.queue[message.guild.id].queue[1].song.info.title}**` : ''}`) |
||||||
|
.addField("Settings", `Volume: **${client.misc.queue[message.guild.id].volume}**/**150**${client.misc.queue[message.guild.id].player.paused ? '\n**Currently paused.**' : ''}`) |
||||||
|
.setColor('328ba8') |
||||||
|
.setFooter("Luno") |
||||||
|
).catch(() => {}); |
||||||
|
}; |
Loading…
Reference in new issue