| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- const { MessageEmbed } = require("discord.js");
- const _ = require("lodash");
- const prettyMilliseconds = require("pretty-ms");
- module.exports = {
- name: "queue",
- description: "The server queue",
- usage: "",
- permissions: {
- channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
- member: [],
- },
- aliases: ["q"],
- /**
- *
- * @param {import("../structures/DiscordMusicBot")} client
- * @param {import("discord.js").Message} message
- * @param {string[]} args
- * @param {*} param3
- */
- run: async (client, message, args, { GuildDB }) => {
- let player = await client.Manager.get(message.guild.id);
- if (!player)
- return client.sendTime(
- message.channel,
- "❌ | **Nothing is playing right now...**"
- );
- if (!player.queue || !player.queue.length || player.queue === 0) {
- let QueueEmbed = new MessageEmbed()
- .setAuthor("Currently playing", client.config.IconURL)
- .setColor("RANDOM")
- .setDescription(
- `[${player.queue.current.title}](${player.queue.current.uri})`
- )
- .addField("Requested by", `${player.queue.current.requester}`, true)
- .addField(
- "Duration",
- `${
- client.ProgressBar(
- player.position,
- player.queue.current.duration,
- 15
- ).Bar
- } \`[${prettyMilliseconds(player.position, {
- colonNotation: true,
- })} / ${prettyMilliseconds(player.queue.current.duration, {
- colonNotation: true,
- })}]\``
- )
- .setThumbnail(player.queue.current.displayThumbnail());
- return message.channel.send(QueueEmbed);
- }
- let Songs = player.queue.map((t, index) => {
- t.index = index;
- return t;
- });
- let ChunkedSongs = _.chunk(Songs, 10); //How many songs to show per-page
- let Pages = ChunkedSongs.map((Tracks) => {
- let SongsDescription = Tracks.map(
- (t) =>
- `\`${t.index + 1}.\` [${t.title}](${t.uri}) \n\`${prettyMilliseconds(
- t.duration,
- {
- colonNotation: true,
- }
- )}\` **|** Requested by: ${t.requester}\n`
- ).join("\n");
- let Embed = new MessageEmbed()
- .setAuthor("Queue", client.config.IconURL)
- .setColor("RANDOM")
- .setDescription(
- `**Currently Playing:** \n[${player.queue.current.title}](${player.queue.current.uri}) \n\n**Up Next:** \n${SongsDescription}\n\n`
- )
- .addField("Total songs: \n", `\`${player.queue.totalSize - 1}\``, true)
- .addField(
- "Total length: \n",
- `\`${prettyMilliseconds(player.queue.duration, {
- colonNotation: true,
- })}\``,
- true
- )
- .addField("Requested by:", `${player.queue.current.requester}`, true)
- .addField(
- "Current song duration:",
- `${
- client.ProgressBar(
- player.position,
- player.queue.current.duration,
- 15
- ).Bar
- } \`${prettyMilliseconds(player.position, {
- colonNotation: true,
- })} / ${prettyMilliseconds(player.queue.current.duration, {
- colonNotation: true,
- })}\``
- )
- .setThumbnail(player.queue.current.displayThumbnail());
- return Embed;
- });
- if (!Pages.length || Pages.length === 1)
- return message.channel.send(Pages[0]);
- else client.Pagination(message, Pages);
- },
- SlashCommand: {
- /**
- *
- * @param {import("../structures/DiscordMusicBot")} client
- * @param {import("discord.js").Message} message
- * @param {string[]} args
- * @param {*} param3
- */
- run: async (client, interaction, args, { GuildDB }) => {
- let player = await client.Manager.get(interaction.guild_id);
- if (!player)
- return interaction.send("❌ | **Nothing is playing right now...**");
- if (!player.queue || !player.queue.length || player.queue === 0) {
- let QueueEmbed = new MessageEmbed()
- .setAuthor("Currently playing", client.config.IconURL)
- .setColor("RANDOM")
- .setDescription(
- `[${player.queue.current.title}](${player.queue.current.uri})`
- )
- .addField("Requested by", `${player.queue.current.requester}`, true)
- .addField(
- "Duration",
- `${
- client.ProgressBar(
- player.position,
- player.queue.current.duration,
- 15
- ).Bar
- } \`[${prettyMilliseconds(player.position, {
- colonNotation: true,
- })} / ${prettyMilliseconds(player.queue.current.duration, {
- colonNotation: true,
- })}]\``
- )
- .setThumbnail(player.queue.current.displayThumbnail());
- return interaction.send(QueueEmbed);
- }
- let Songs = player.queue.map((t, index) => {
- t.index = index;
- return t;
- });
- let ChunkedSongs = _.chunk(Songs, 10); //How many songs to show per-page
- let Pages = ChunkedSongs.map((Tracks) => {
- let SongsDescription = Tracks.map(
- (t) =>
- `\`${t.index + 1}.\` [${t.title}](${
- t.uri
- }) \n\`${prettyMilliseconds(t.duration, {
- colonNotation: true,
- })}\` **|** Requested by: ${t.requester}\n`
- ).join("\n");
- let Embed = new MessageEmbed()
- .setAuthor("Queue", client.config.IconURL)
- .setColor("RANDOM")
- .setDescription(
- `**Currently Playing:** \n[${player.queue.current.title}](${player.queue.current.uri}) \n\n**Up Next:** \n${SongsDescription}\n\n`
- )
- .addField(
- "Total songs: \n",
- `\`${player.queue.totalSize - 1}\``,
- true
- )
- .addField(
- "Total length: \n",
- `\`${prettyMilliseconds(player.queue.duration, {
- colonNotation: true,
- })}\``,
- true
- )
- .addField("Requested by:", `${player.queue.current.requester}`, true)
- .addField(
- "Current song duration:",
- `${
- client.ProgressBar(
- player.position,
- player.queue.current.duration,
- 15
- ).Bar
- } \`[${prettyMilliseconds(player.position, {
- colonNotation: true,
- })} / ${prettyMilliseconds(player.queue.current.duration, {
- colonNotation: true,
- })}]\``
- )
- .setThumbnail(player.queue.current.displayThumbnail());
- return Embed;
- });
- if (!Pages.length || Pages.length === 1)
- return interaction.send(Pages[0]);
- else client.Pagination(interaction, Pages);
- },
- },
- };
|