From 82d3f45c0f8be9ebff93ac418036a4a8928c1bd6 Mon Sep 17 00:00:00 2001 From: Brian Ferri <81859084+BioCla@users.noreply.github.com> Date: Thu, 19 May 2022 18:32:12 +0200 Subject: [PATCH 01/84] Updated choices method (#843) Make code less spaghetti ish --- commands/slash/filters.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/commands/slash/filters.js b/commands/slash/filters.js index 136c832e3..cc4e500f7 100644 --- a/commands/slash/filters.js +++ b/commands/slash/filters.js @@ -9,17 +9,18 @@ const command = new SlashCommand() .setName("preset") .setDescription("the preset to add") .setRequired(true) - .addChoice("Nightcore", "nightcore") - .addChoice("BassBoost", "bassboost") - .addChoice("Vaporwave", "vaporwave") - .addChoice("Pop", "pop") - .addChoice("Soft", "soft") - .addChoice("Treblebass", "treblebass") - .addChoice("Eight Dimension", "eightD") - .addChoice("Karaoke", "karaoke") - .addChoice("Vibrato", "vibrato") - .addChoice("Tremolo", "tremolo") - .addChoice("Reset", "off") + .addChoices( + { name: "Nightcore", value: "nightcore"}, + { name: "BassBoost", value: "bassboost"}, + { name: "Vaporwave", value: "vaporwave"}, + { name: "Pop", value: "pop"}, + { name: "Soft", value: "soft"}, + { name: "Treblebass", value: "treblebass"}, + { name: "Eight Dimension", value: "eightD"}, + { name: "Karaoke", value: "karaoke"}, + { name: "Vibrato", value: "vibrato"}, + { name: "Tremolo", value: "tremolo"}, + { name: "Reset", value: "off"},) ) .setRun(async (client, interaction, options) => { From 3fd8a26a5b45ced05d07399a24fd0a1d31290879 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 19 May 2022 21:09:09 -0500 Subject: [PATCH 02/84] fix(deps): update dependency discord-api-types to v0.33.0 (#803) Co-authored-by: Darren Nathanael --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0b41e8f1..d4f4e7ffe 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "better-erela.js-apple": "^0.1.0", "better-erela.js-spotify": "1.3.7", "colors": "1.3.3", - "discord-api-types": "0.31.1", + "discord-api-types": "0.33.0", "discord-together": "^1.3.25", "discord.js": "^13.5.1", "ejs": "^3.1.6", From 5f18d9480941273be9d1357288cb8d7c8ecef094 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 30 May 2022 21:15:53 +0530 Subject: [PATCH 03/84] fix(deps): update dependency discord-api-types to v0.33.1 (#848) Co-authored-by: Renovate Bot --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d4f4e7ffe..cebe5566d 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "better-erela.js-apple": "^0.1.0", "better-erela.js-spotify": "1.3.7", "colors": "1.3.3", - "discord-api-types": "0.33.0", + "discord-api-types": "0.33.1", "discord-together": "^1.3.25", "discord.js": "^13.5.1", "ejs": "^3.1.6", From 47e1bb6c6ec7df1166f10107d06716440059ca2d Mon Sep 17 00:00:00 2001 From: Aka <70210356+Itsnotaka@users.noreply.github.com> Date: Fri, 3 Jun 2022 01:01:55 +0800 Subject: [PATCH 04/84] =?UTF-8?q?Change=20errorEmbed=20to=20embed=20msg=20?= =?UTF-8?q?to=20remove=20double=20=E2=9D=8C=20(#853)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/slash/lyrics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/slash/lyrics.js b/commands/slash/lyrics.js index de582acf8..d7109e8e5 100644 --- a/commands/slash/lyrics.js +++ b/commands/slash/lyrics.js @@ -26,7 +26,7 @@ const command = new SlashCommand() if (!args && !player) return interaction.editReply({ - embeds: [client.ErrorEmbed("❌ | **There's nothing playing**")], + embeds: [client.Embed("❌ | **There's nothing playing**")], }); // if no input, search for the current song. if no song console.log("No song input"); From 20e06aab9a43d4a74075d1e4cc0abe24ad4ceebc Mon Sep 17 00:00:00 2001 From: Amiyo <84950599+DevAmiyo@users.noreply.github.com> Date: Fri, 3 Jun 2022 22:26:34 +0530 Subject: [PATCH 05/84] fix: DOuble X in lyrics and loop command --- commands/slash/loop.js | 2 +- commands/slash/lyrics.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/slash/loop.js b/commands/slash/loop.js index 06270760c..e71802416 100644 --- a/commands/slash/loop.js +++ b/commands/slash/loop.js @@ -8,7 +8,7 @@ const command = new SlashCommand() let player = client.manager.players.get(interaction.guild.id); if (!player) { return interaction.reply({ - embeds: [client.ErrorEmbed("❌ | **Nothing is playing right now...**")], + embeds: [client.ErrorEmbed("**Nothing is playing right now...**")], }); } if (!interaction.member.voice.channel) { diff --git a/commands/slash/lyrics.js b/commands/slash/lyrics.js index d7109e8e5..0da2764f0 100644 --- a/commands/slash/lyrics.js +++ b/commands/slash/lyrics.js @@ -26,7 +26,7 @@ const command = new SlashCommand() if (!args && !player) return interaction.editReply({ - embeds: [client.Embed("❌ | **There's nothing playing**")], + embeds: [client.ErrorEmbed("**There's nothing playing**")], }); // if no input, search for the current song. if no song console.log("No song input"); From 2794ecbf8ca9aafcaab33badbc0f69f4fc385122 Mon Sep 17 00:00:00 2001 From: LewdHuTao <90232327+LewdHuTao@users.noreply.github.com> Date: Mon, 6 Jun 2022 12:43:07 +0800 Subject: [PATCH 06/84] track duration and author in search cmd [v5] (#863) --- commands/slash/search.js | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/commands/slash/search.js b/commands/slash/search.js index bf1fdda18..8f49b8682 100644 --- a/commands/slash/search.js +++ b/commands/slash/search.js @@ -4,6 +4,7 @@ const { MessageActionRow, MessageSelectMenu, } = require("discord.js"); +const prettyMilliseconds = require("pretty-ms"); const command = new SlashCommand() .setName("search") @@ -105,6 +106,11 @@ const command = new SlashCommand() resultFromSearch.push({ label: `${track.title}`, value: `${track.uri}`, + description: track.isStream + ? `LIVE` + : `${prettyMilliseconds(track.duration, { + secondsDecimalDigits: 0, + })} - ${track.author}`, }); }); diff --git a/package.json b/package.json index cebe5566d..1489c953c 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "colors": "1.3.3", "discord-api-types": "0.33.1", "discord-together": "^1.3.25", - "discord.js": "^13.5.1", + "discord.js": "^13.8.0", "ejs": "^3.1.6", "erela.js": "^2.3.3", "erela.js-deezer": "^1.0.7", From 11011bddb57644d1b5eae9829b8e75b1303e65e1 Mon Sep 17 00:00:00 2001 From: LewdHuTao <90232327+LewdHuTao@users.noreply.github.com> Date: Wed, 8 Jun 2022 02:49:29 +0800 Subject: [PATCH 07/84] autoplay [v5] (#867) --- commands/slash/autoplay.js | 72 ++++++++++++++++++++++++++++++++++++++ lib/DiscordMusicBot.js | 14 +++++++- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 commands/slash/autoplay.js diff --git a/commands/slash/autoplay.js b/commands/slash/autoplay.js new file mode 100644 index 000000000..8553f613f --- /dev/null +++ b/commands/slash/autoplay.js @@ -0,0 +1,72 @@ +const { MessageEmbed } = require("discord.js"); +const SlashCommand = require("../../lib/SlashCommand"); + +const command = new SlashCommand() + .setName("autoplay") + .setDescription("Autoplay music toggle") + .setRun(async (client, interaction, options) => { + let player = client.manager.players.get(interaction.guild.id); + if (!interaction.member.voice.channel) { + const joinEmbed = new MessageEmbed() + .setColor(client.config.embedColor) + .setDescription( + "❌ | **You need to join voice channel first before you can use this command.**" + ); + return interaction.reply({ embeds: [joinEmbed], ephemeral: true }); + } + + if ( + interaction.guild.me.voice.channel && + !interaction.guild.me.voice.channel.equals( + interaction.member.voice.channel + ) + ) { + const sameEmbed = new MessageEmbed() + .setColor(client.config.embedColor) + .setDescription( + "❌ | **You must be in the same voice channel as me.**" + ); + return interaction.reply({ embeds: [sameEmbed], ephemeral: true }); + } + if (!player) { + return interaction.reply({ + embeds: [ + client.ErrorEmbed( + "Please add track to the queue to activate autoplay" + ), + ], + }); + } + + await interaction.deferReply(); + + const autoplay = player.get("autoplay"); + + if (autoplay === false) { + const identifier = player.queue.current.identifier; + + player.set("autoplay", true); + player.set("requester", interaction.user); + player.set("identifier", identifier); + const search = `https://www.youtube.com/watch?v=${identifier}&list=RD${identifier}`; + res = await player.search(search, interaction.user); + player.queue.add(res.tracks[1]); + + let embed = new MessageEmbed() + .setColor(client.config.embedColor) + .setDescription(`Autoplay is now \`enabled\``); + + return interaction.editReply({ embeds: [embed] }); + } else { + player.set("autoplay", false); + player.queue.clear(); + + let embed = new MessageEmbed() + .setColor(client.config.embedColor) + .setDescription(`Autoplay is now \`disabled\``); + + return interaction.editReply({ embeds: [embed] }); + } + }); + +module.exports = command; diff --git a/lib/DiscordMusicBot.js b/lib/DiscordMusicBot.js index 4c39bab3e..4a013d138 100644 --- a/lib/DiscordMusicBot.js +++ b/lib/DiscordMusicBot.js @@ -4,7 +4,7 @@ const { MessageEmbed, Collection, MessageActionRow, - MessageButton + MessageButton, } = require("discord.js"); const fs = require("fs"); const path = require("path"); @@ -114,6 +114,7 @@ class DiscordMusicBot extends Client { new facebook(), new filters(), ], + autoPlay: true, nodes: this.config.nodes, retryDelay: this.config.retryDelay, retryAmount: this.config.retryAmount, @@ -275,6 +276,17 @@ class DiscordMusicBot extends Client { .catch(this.warn); player.setNowplayingMessage(nowPlaying); }) + .on("trackEnd", async (player, track, playload) => { + const autoplay = player.get("autoplay"); + if (autoplay === true) { + const requester = player.get("requester"); + const oldidentifier = player.get("identifier"); + const identifier = player.queue.current.identifier; + const search = `https://www.youtube.com/watch?v=${identifier}&list=RD${identifier}`; + res = await player.search(search, requester); + player.queue.add(res.tracks[2]); + } + }) .on("queueEnd", (player) => { this.warn(`Player: ${player.options.guild} | Queue has been ended`); let queueEmbed = this.Embed() From d2f505a0c4ade772a836d0cd5813490ec13ed6eb Mon Sep 17 00:00:00 2001 From: Neko Life Date: Thu, 9 Jun 2022 13:19:05 +0700 Subject: [PATCH 08/84] Avoid repeating sequence of tracks (#868) * Avoid repeating sequence of tracks * Track play command when autoplay mode is enabled --- commands/slash/autoplay.js | 11 +++++++++-- commands/slash/play.js | 23 ++++++++++++++++++++++- lib/DiscordMusicBot.js | 29 +++++++++++++++++++++++++++-- 3 files changed, 58 insertions(+), 5 deletions(-) diff --git a/commands/slash/autoplay.js b/commands/slash/autoplay.js index 8553f613f..054ade115 100644 --- a/commands/slash/autoplay.js +++ b/commands/slash/autoplay.js @@ -42,7 +42,7 @@ const command = new SlashCommand() const autoplay = player.get("autoplay"); - if (autoplay === false) { + if (autoplay !== true) { const identifier = player.queue.current.identifier; player.set("autoplay", true); @@ -50,7 +50,14 @@ const command = new SlashCommand() player.set("identifier", identifier); const search = `https://www.youtube.com/watch?v=${identifier}&list=RD${identifier}`; res = await player.search(search, interaction.user); - player.queue.add(res.tracks[1]); + const psba = player.get("autoplayed") || []; + const r = res.tracks[1]; + for (const a of [identifier, r?.identifier]) { + if (a && !psba.includes(a)) psba.push(a); + } + if (r) player.queue.add(r); + while (psba.length > 100) psba.shift(); + player.set("autoplayed", psba); let embed = new MessageEmbed() .setColor(client.config.embedColor) diff --git a/commands/slash/play.js b/commands/slash/play.js index 34ff76ea8..a09cd7710 100644 --- a/commands/slash/play.js +++ b/commands/slash/play.js @@ -77,7 +77,18 @@ const command = new SlashCommand() } if (res.loadType === "TRACK_LOADED" || res.loadType === "SEARCH_RESULT") { - player.queue.add(res.tracks[0]); + const r = res.tracks[0]; + if (player.get("autoplay")) { + const psba = player.get("autoplayed") || []; + if (r) { + if (!psba.includes(r?.identifier)) { + psba.push(r.identifier); + } + } + while (psba.length > 100) psba.shift(); + player.set("autoplayed", psba); + } + player.queue.add(r); if (!player.playing && !player.paused && !player.queue.size) player.play(); let addQueueEmbed = client @@ -117,6 +128,16 @@ const command = new SlashCommand() } if (res.loadType === "PLAYLIST_LOADED") { + if (player.get("autoplay")) { + const psba = player.get("autoplayed") || []; + for (const r of res.tracks) { + if (r && !psba.includes(r?.identifier)) { + psba.push(r.identifier); + } + } + while (psba.length > 100) psba.shift(); + player.set("autoplayed", psba); + } player.queue.add(res.tracks); if ( !player.playing && diff --git a/lib/DiscordMusicBot.js b/lib/DiscordMusicBot.js index 4a013d138..75553d0e5 100644 --- a/lib/DiscordMusicBot.js +++ b/lib/DiscordMusicBot.js @@ -118,7 +118,6 @@ class DiscordMusicBot extends Client { nodes: this.config.nodes, retryDelay: this.config.retryDelay, retryAmount: this.config.retryAmount, - autoPlay: true, clientName: `DiscordMusic/v${require("../package.json").version} (Bot: ${ this.config.clientId })`, @@ -279,12 +278,38 @@ class DiscordMusicBot extends Client { .on("trackEnd", async (player, track, playload) => { const autoplay = player.get("autoplay"); if (autoplay === true) { + /** + * Array of played songs + * @type {string[]} + */ + const psba = player.get("autoplayed") || []; + const requester = player.get("requester"); const oldidentifier = player.get("identifier"); const identifier = player.queue.current.identifier; const search = `https://www.youtube.com/watch?v=${identifier}&list=RD${identifier}`; res = await player.search(search, requester); - player.queue.add(res.tracks[2]); + + /** + * Track to add to queue + * @type {import("erela.js").Track} + */ + let a; + for (let i = 0; i < res.tracks.length; i++) { + const v = res.tracks[i]; + + // Don't add this track if it's the last 100 played + if (!v || psba.includes(v.identifier)) continue; + + a = v; + psba.push(a.identifier); + break; + } + if (!a) throw new RangeError("End of playlist"); + player.queue.add(a); + + if (psba.length > 100) psba.shift(); + player.set("autoplayed", psba); } }) .on("queueEnd", (player) => { From a3fc74db0203506a388cc98cae550b9a0172ef15 Mon Sep 17 00:00:00 2001 From: Brian Ferri <81859084+BioCla@users.noreply.github.com> Date: Thu, 9 Jun 2022 10:38:18 +0200 Subject: [PATCH 09/84] Create ping.js (#860) * Create ping.js simple Ping command inspired by @XstreamSpeed This version fixes the mistakes from the previous PR, which include but do not limit themselves to: Wrong scopes, mismatched parenthesis, undefined methods and variables, redundant information provided by other commands... * fix hanging login on replit systems * Update index.js changed scope --- commands/slash/ping.js | 57 ++++++++++++++++++++++++++++++++++++++++++ index.js | 14 +++++++++++ 2 files changed, 71 insertions(+) create mode 100644 commands/slash/ping.js diff --git a/commands/slash/ping.js b/commands/slash/ping.js new file mode 100644 index 000000000..66dd1f1f9 --- /dev/null +++ b/commands/slash/ping.js @@ -0,0 +1,57 @@ +const { MessageEmbed } = require("discord.js"); +const SlashCommand = require("../../lib/SlashCommand"); + +const command = new SlashCommand() +.setName("ping") +.setDescription("View the bot's latency") +.setRun(async (client, interaction, options) => { + let msg = await interaction.channel.send({ + embeds: [new MessageEmbed() + .setDescription("🏓 | Fetching ping...") + .setColor("#6F8FAF") + ] + }) + + let zap = "⚡"; + let green = "🟢"; + let red = "🔴"; + let yellow = "🟡"; + + var botState = zap; + var apiState = zap; + + let apiPing = client.ws.ping; + let botPing = Math.floor(msg.createdAt - interaction.createdAt); + + if (apiPing >= 40 && apiPing < 200) { + apiState = green; + } else if (apiPing >= 200 && apiPing < 400) { + apiState = yellow; + } else if (apiPing >= 400) { + apiState = red; + } + + if (botPing >= 40 && botPing < 200) { + botState = green; + } else if (botPing >= 200 && botPing < 400) { + botState = yellow; + } else if (botPing >= 400) { + botState = red; + } + + msg.delete(); + interaction.reply({ + embeds: [new MessageEmbed() + .setTitle("🏓 | Pong!") + .addField("API Latency", `\`\`\`yml\n${apiState} | ${apiPing}ms\`\`\``, true) + .addField("Bot Latency", `\`\`\`yml\n${botState} | ${botPing}ms\`\`\``, true) + .setColor(client.config.embedColor) + .setFooter({ + text: `Requested by ${interaction.user.tag}`, + iconURL: (interaction.user.avatarURL()) + }) + ] + }) +}); + +module.exports = command; diff --git a/index.js b/index.js index 44c9b8fb5..9047cfd0e 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,18 @@ const DiscordMusicBot = require("./lib/DiscordMusicBot"); +const { exec } = require("child_process"); + +if (process.env.REPL_ID) { + console.log("Replit system detected, initiating special `unhandledRejection` event listener | index.js:19") + process.on('unhandledRejection', (reason, promise) => { + promise.catch((err) => { + if (err.status === 429) { + console.log("something went wrong while logging in, resetting..."); + exec("kill 1"); + } + }); + }); +} + const client = new DiscordMusicBot(); console.log("Make sure to fill in the config.js before starting the bot."); From a587e47a62681f0412af123b7a71e88515f531b2 Mon Sep 17 00:00:00 2001 From: Neko Life Date: Thu, 9 Jun 2022 15:39:05 +0700 Subject: [PATCH 10/84] harder, faster, better, stronger (#869) --- deploy/destroy.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/deploy/destroy.js b/deploy/destroy.js index 691f4d820..b6ac5731c 100644 --- a/deploy/destroy.js +++ b/deploy/destroy.js @@ -3,7 +3,6 @@ const readline = require("readline"); const { REST } = require("@discordjs/rest"); const { Routes } = require("discord-api-types/v9"); const getConfig = require("../util/getConfig"); -const LoadCommands = require("../util/loadCommands"); const rl = readline.createInterface({ input: process.stdin, @@ -14,25 +13,26 @@ const rl = readline.createInterface({ const config = await getConfig(); const rest = new REST({ version: "9" }).setToken(config.token); - rl.question( + if (!process.argv.includes("--global")) rl.question( "Enter the guild id you wanted to delete commands: ", async (guild) => { console.log("Evil bot has been started to delete commands..."); - let commands = await rest.get( - Routes.applicationGuildCommands(config.clientId, guild) - ); - for (let i = 0; i < commands.length; i++) { - const cmd = commands[i]; - await rest - .delete( - Routes.applicationGuildCommand(config.clientId, guild, cmd.id) - ) - .catch(console.log); - console.log("Deleted command: " + cmd.name); - } - if (commands.length === 0) - console.log("Evil bot doesn't seen any commands to delete :c"); + await rest + .put(Routes.applicationGuildCommands(config.clientId, guild), { + body: [], + }) + .catch(console.log); + console.log("Evil bot has done the deed, exiting..."); rl.close(); } - ); + ); else { + console.log("Evil bot has been started to delete global commands..."); + await rest + .put(Routes.applicationCommands(config.clientId), { + body: [], + }) + .catch(console.log); + console.log("Evil bot has done the deed, exiting..."); + process.exit(); + } })(); From 5af6a3ef153f50b0d37f00926c4a05108b73cbe7 Mon Sep 17 00:00:00 2001 From: Neko Life Date: Thu, 9 Jun 2022 17:06:08 +0700 Subject: [PATCH 11/84] Include tracking on search command (#870) --- commands/slash/play.js | 8 ++++---- commands/slash/search.js | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/commands/slash/play.js b/commands/slash/play.js index a09cd7710..a31dfa79d 100644 --- a/commands/slash/play.js +++ b/commands/slash/play.js @@ -77,11 +77,11 @@ const command = new SlashCommand() } if (res.loadType === "TRACK_LOADED" || res.loadType === "SEARCH_RESULT") { - const r = res.tracks[0]; - if (player.get("autoplay")) { + const r = res.tracks[0]; + if (player.get("autoplay")) { const psba = player.get("autoplayed") || []; if (r) { - if (!psba.includes(r?.identifier)) { + if (!psba.includes(r.identifier)) { psba.push(r.identifier); } } @@ -131,7 +131,7 @@ const command = new SlashCommand() if (player.get("autoplay")) { const psba = player.get("autoplayed") || []; for (const r of res.tracks) { - if (r && !psba.includes(r?.identifier)) { + if (r && !psba.includes(r.identifier)) { psba.push(r.identifier); } } diff --git a/commands/slash/search.js b/commands/slash/search.js index 8f49b8682..2c4888816 100644 --- a/commands/slash/search.js +++ b/commands/slash/search.js @@ -151,7 +151,20 @@ const command = new SlashCommand() uriFromCollector, interaction.user ); - player?.queue?.add(trackForPlay.tracks[0]); + if (player?.queue) { + const r = trackForPlay.tracks[0]; + if (player.get("autoplay")) { + const psba = player.get("autoplayed") || []; + if (r) { + if (!psba.includes(r.identifier)) { + psba.push(r.identifier); + } + } + while (psba.length > 100) psba.shift(); + player.set("autoplayed", psba); + } + player.queue.add(r); + } if (!player?.playing && !player?.paused && !player?.queue?.size) player?.play(); i.editReply({ From 7290b2531fd8f4720dfb1087d522ff0930bcad2a Mon Sep 17 00:00:00 2001 From: Darren Date: Thu, 9 Jun 2022 07:35:30 -0500 Subject: [PATCH 12/84] =?UTF-8?q?Bye=20old=20docs=20=F0=9F=91=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documentation/docs/index.md | 9 -- documentation/docs/installation/linux.md | 129 ------------------ documentation/docs/installation/replit.md | 39 ------ documentation/docs/installation/windows.md | 44 ------ .../docs/popular topics/common-problems.md | 2 - documentation/mkdocs.yml | 57 -------- documentation/requirements.txt | 3 - documentation/runtime.txt | 1 - 8 files changed, 284 deletions(-) delete mode 100644 documentation/docs/index.md delete mode 100644 documentation/docs/installation/linux.md delete mode 100644 documentation/docs/installation/replit.md delete mode 100644 documentation/docs/installation/windows.md delete mode 100644 documentation/docs/popular topics/common-problems.md delete mode 100644 documentation/mkdocs.yml delete mode 100644 documentation/requirements.txt delete mode 100644 documentation/runtime.txt diff --git a/documentation/docs/index.md b/documentation/docs/index.md deleted file mode 100644 index e2364c6a9..000000000 --- a/documentation/docs/index.md +++ /dev/null @@ -1,9 +0,0 @@ -# Warning -This docs is for the v5 version of the discord bot, please note if you are using v4 you'll need to follow https://github.com/sudhanPlayz/discord-MusicBot/wiki instead. -# Welcome to Discord-MusicBot - -An advanced discord music bot, supports Spotify, Soundcloud, YouTube with Shuffling, Volume Control and Web Dashboard with Slash Commands support! - -## What does this docs contains? - -This docs contains how to install on servers, frequently asked questions and how to solve common problems. diff --git a/documentation/docs/installation/linux.md b/documentation/docs/installation/linux.md deleted file mode 100644 index 86790a079..000000000 --- a/documentation/docs/installation/linux.md +++ /dev/null @@ -1,129 +0,0 @@ -# Installation on a Linux server - -## Prerequisites - -- [Discord Application](#create-a-discord-application) -- [NodeJS & NPM](#install-nodejs-npm) - -### Create a Discord Application - -- go to the [Discord Developer portal](https://discord.com/developers/applications) -- create a new application + bot -- create a bot invitelink using it's client id [here](https://discordapi.com/permissions.html) -- save the bot token for later - -### Install nodejs & npm - -follow [those](https://github.com/nodesource/distributions) instructions - -## Installation - -- [Configuration](#configuration) -- [Lavalink](#lavalink) -- [Final Steps](#final-steps) - -### Configuration - -- run `git clone -b v5 https://github.com/SudhanPlayz/Discord-MusicBot.git` -- go into the folder with `cd Discord-MusicBot` -- edit the config.js with the tokens from earlier - -### lavalink - -use [public lavalink](https://lavalink-list.darrennathanael.com) - -or [host your own](https://darrennathanael.com/post/how-to-lavalink/) - -### Final steps - -- run `npm install` -- deploy the slash command by using `npm run deploy` or `yarn deploy` -- start the bot with `npm run start` or `yarn start` - -### Dashboard setup. - -> You can do this in 2 ways, with a custom domain or with your vps/server ip. - -### Dashboard with custom domain - -##### With Nginx - -Create a new file in `/etc/nginx/sites-available` - -> you can use whatever your favorite text editor, but I'll be using vim cause I'm used to it - -Do `vi /etc/nginx/sites-available/musicbot.conf` -Then enter this example config - -```c -server { - listen 80; - server_name foo.bar; - - location / { - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_pass http://127.0.0.1:3000; - } -} -``` - -then saved it and quit `:wq` - -> Replace `foo.bar` with your domain -> for https support use https://letsencrypt.org/ - -##### With Apache - -**Apache Conf file** -Go to your apache configuration file then paste this in - -```apache - - ServerAdmin wilbur@example.com - DocumentRoot "/path/to/bot/file" - ServerName example.com - ServerAlias example.com - #errorDocument 404 /404.html - - - #Referenced reverse proxy rule, if commented, the configured reverse proxy will be invalid - #Take a note of this dir - IncludeOptional /server/apache/proxy/example.com/*.conf - - #DENY FILES - - Order allow,deny - Deny from all - - - -``` - -**Apache Reverse Proxy file** - -> put it in /server/apache/proxy/example.com/discordbot.conf - -Make a new file at your config dir, above for reference - -```apache -#PROXY-START/ - - ProxyRequests Off - SSLProxyEngine on - ProxyPass / http://127.0.0.1:3000/ - ProxyPassReverse / http://127.0.0.1:3000/ - -#PROXY-END/ -``` - -Then once done save it then restart apache. - -> Replace `example.com` with your domain -> for https support use https://letsencrypt.org/ - -### Dashboard with IP - -- open port 80, Then edit the `botconfig.js` and change the `Port` on line `5`, change it to 80, `Website` line `18` to **Example**`https://192.168.0.1` - -- Go to the Discord Developer Portal under the OAuth2 tab. Then put your server ip in this format `http://192.168.0.1/api/callback` diff --git a/documentation/docs/installation/replit.md b/documentation/docs/installation/replit.md deleted file mode 100644 index ee5b66d09..000000000 --- a/documentation/docs/installation/replit.md +++ /dev/null @@ -1,39 +0,0 @@ -# Installation on Repl.it - -## Prerequisites - -- [Discord Application](#create-a-discord-application) - -### Create a Discord Application - -- go to the [Discord Developer portal](https://discord.com/developers/applications) -- create a new application + bot -- create a bot invitelink using it's client id [here](https://discordapi.com/permissions.html) -- save the bot token for later - -## Installation - -Click [![Run on Repl.it](https://repl.it/badge/github/ModelBuses/DiscordMusic)](https://repl.it/github/SudhanPlayz/Discord-MusicBot) - -Then let it load the project, It may take 1 - 5 min. - -After that, in shell, run `git checkout v5` - -Then you'll need to edit the `config.js` and fill in the [Lavalink](https://github.com/freyacodes/Lavalink), Token, ClientSecret, ClientId. - -> If you want to host lavalink on replit you can check out this [repo](https://github.com/DarrenOfficial/lavalink-replit) - -## Deploying slash commands - -run `yarn deploy` or `npm run deploy` -## Final - -Once done you can restart your bot, then invite it using this url template. https://discord.com/oauth2/authorize?client_id=CLIENT_ID&scope=bot%20applications.commands&permissions=2205280576 - -- CLIENT_ID needs to be replaced with your bot Id -- Permission calculator: [learn more](https://finitereality.github.io/permissions-calculator) -- You can use #generateInvite instead: [learn more](https://discord.js.org/#/docs/main/main/class/Client?scrollTo=generateInvite) - - -**SIDE NOTES**: -- If you're running the version 4 of the bot, please kick it and reinvite using the invite link stated in [final](#final) diff --git a/documentation/docs/installation/windows.md b/documentation/docs/installation/windows.md deleted file mode 100644 index 1ec4a932d..000000000 --- a/documentation/docs/installation/windows.md +++ /dev/null @@ -1,44 +0,0 @@ -# Installation on a Windows computer/server - -## Prerequisites - -- [Discord Application](#create-a-discord-application) -- [Lavalink server](#lavalink) -- [NodeJS & NPM](#install-nodejs-npm) -- [Git](https://git-scm.com/download/windows) - -### Create a Discord Application - -- go to the [Discord Developer portal](https://discord.com/developers/applications) -- create a new application + bot -- create a bot invitelink using it's client id [here](https://discordapi.com/permissions.html) -- save the bot token for later - -### Install nodejs & npm - -follow [these](https://nodejs.org/en/download/) instructions - -## Installation - -- [Configuration](#configuration) -- [Lavalink](#lavalink) -- [Final Steps](#final-steps) - -## Configuration - -- Git clone the repository by opening command prompt or powershell and doing `git clone -b v5 https://github.com/SudhanPlayz/Discord-MusicBot` -- Open your text editor and configure config.js there! - -### lavalink - -use [public lavalink](https://lavalink-list.darrennathanael.com) - -or [host your own](https://darrennathanael.com/post/how-to-lavalink/) - -## Final steps - -- Open your preferred terminal (command prompt or powershell) and change the directory to your Music bot folder. -- Deploy your slash commands by doing `npm run deploy` to deploy globally or `npm run guild` if you want to deploy on a specific guild. -- Once done, type `npm run start` or `node index.js` - -Now your bot is running! diff --git a/documentation/docs/popular topics/common-problems.md b/documentation/docs/popular topics/common-problems.md deleted file mode 100644 index 76f7a7841..000000000 --- a/documentation/docs/popular topics/common-problems.md +++ /dev/null @@ -1,2 +0,0 @@ -# Common Problems -# TBD \ No newline at end of file diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml deleted file mode 100644 index a9a1221dc..000000000 --- a/documentation/mkdocs.yml +++ /dev/null @@ -1,57 +0,0 @@ -site_name: Discord MusicBot -site_url: https://musicbot.sudhan.tech -site_author: SudhanPlayz -site_description: >- - An advanced discord music bot, supports Spotify, Soundcloud, YouTube with Shuffling, Volume Control - and Web Dashboard with Slash Commands support! - -repo_name: sudhanplayz/discord-musicbot -repo_url: https://github.com/sudhanplayz/discord-musicbot -edit_uri: https://github.com/sudhanplayz/discord-musicbot/blob/v5/documentation/docs - -theme: - name: "material" - logo: "https://raw.githubusercontent.com/SudhanPlayz/Discord-MusicBot/master/assets/logo.gif" - include_search_page: false - search_index_only: true - favicon: "https://raw.githubusercontent.com/SudhanPlayz/Discord-MusicBot/master/assets/logo.gif" - features: - - content.code.annotate - - navigation.expand - - navigation.indexes - - navigation.instant - - navigation.sections - - navigation.top - - navigation.tracking - - search.highlight - - search.suggest - - palette: - scheme: slate - primary: "deep purple" - accent: "indigo" - font: - text: "Roboto" - code: "Fira Mono" - -markdown_extensions: - - admonition - - pymdownx.details - - pymdownx.superfences - - pymdownx.tabbed - - pymdownx.keys - - attr_list - - pymdownx.betterem: - smart_enable: all - -extra: - social: - - icon: fontawesome/brands/youtube - link: https://youtube.com/CodingWithSudhan - - icon: fontawesome/brands/discord - link: https://discord.gg/sbySMS7m3v - - icon: "fontawesome/brands/github-alt" - link: "https://github.com/SudhanPlayz" - generator: false - -copyright: Copyright © 2020 - 2021 Sudhan diff --git a/documentation/requirements.txt b/documentation/requirements.txt deleted file mode 100644 index c68e48850..000000000 --- a/documentation/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -mkdocs -mkdocs-material -markdown-meta-extension \ No newline at end of file diff --git a/documentation/runtime.txt b/documentation/runtime.txt deleted file mode 100644 index 475ba515c..000000000 --- a/documentation/runtime.txt +++ /dev/null @@ -1 +0,0 @@ -3.7 From 36bad650b1314663081b79ebfefaab43aaa806a8 Mon Sep 17 00:00:00 2001 From: Mex <79592017+XstreamSpeed@users.noreply.github.com> Date: Fri, 10 Jun 2022 15:44:16 +0530 Subject: [PATCH 13/84] Update invite.js (#874) * new look for invite.js * idk why the gap is still there, in the code there are no lines left --- commands/slash/invite.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/commands/slash/invite.js b/commands/slash/invite.js index cabfa6a3d..9a1f52996 100644 --- a/commands/slash/invite.js +++ b/commands/slash/invite.js @@ -1,16 +1,19 @@ -const { MessageEmbed } = require("discord.js"); +const { MessageActionRow, MessageButton, MessageEmbed } = require("discord.js"); const SlashCommand = require("../../lib/SlashCommand"); const command = new SlashCommand() - .setName("invite") - .setDescription("Invite me to your server") - .setRun(async (client, interaction, options) => { - const embed = new MessageEmbed() - .setColor(client.config.embedColor) - .setTitle(`Invite me to your server`) - .setDescription( - `You can invite me to your server by clicking [here](https://discord.com/oauth2/authorize?client_id=${client.config.clientId}&permissions=${client.config.permissions}&scope=bot%20applications.commands)` - ); - return interaction.reply({ embeds: [embed] }); - }); -module.exports = command; +.setName("invite") +.setDescription("Invite me to your server") +.setRun(async (client, interaction, options) => { + return interaction.reply({ + embeds: [new MessageEmbed() + .setColor(client.config.embedColor) + .setTitle(`Invite me to your server!`)], + components: [new MessageActionRow() + .addComponents(new MessageButton() + .setLabel("Invite me") + .setStyle("LINK") + .setURL(`https://discord.com/oauth2/authorize?client_id=${client.config.clientId}&permissions=${client.config.permissions}&scope=${client.config.scopes.toString().replace(',', '%20')}`)) + ] + }); +}); From 898b44b65d90623cb72c9cb08dfbb700587f088a Mon Sep 17 00:00:00 2001 From: Neko Life Date: Fri, 10 Jun 2022 17:15:29 +0700 Subject: [PATCH 14/84] Ignore empty folder (#873) --- util/loadCommands.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/util/loadCommands.js b/util/loadCommands.js index 8acb78f88..1febd496c 100644 --- a/util/loadCommands.js +++ b/util/loadCommands.js @@ -14,18 +14,12 @@ const LoadDirectory = (dir) => { return new Promise((resolve) => { let commands = []; let CommandsDir = path.join(__dirname, "..", "commands", dir); - let i = 0, - f = 0, - r = false; fs.readdir(CommandsDir, (err, files) => { if (err) throw err; - f = files.length; - files.forEach((file) => { + for (const file of files) { let cmd = require(CommandsDir + "/" + file); - i++; - if (i == f) r = true; if (!cmd || (dir == "context" && !cmd.command)) return console.log( "Unable to load Command: " + @@ -34,8 +28,8 @@ const LoadDirectory = (dir) => { ); if (dir == "context") commands.push(cmd.command); else commands.push(cmd); - if (r) resolve(commands); - }); + }; + resolve(commands); }); }); }; From 172750b52a0fbb2a86b270a9467913bd52f101ba Mon Sep 17 00:00:00 2001 From: Metal Units Date: Fri, 10 Jun 2022 17:32:27 +0530 Subject: [PATCH 15/84] feat: Dashboard UI - NextJS --- api/home/dashboard.js | 9 - api/index.js | 14 +- api/routes/data.js | 20 + api/routes/test.js | 6 - api/routes/title.js | 11 - dashboard/.eslintrc.json | 3 + dashboard/.gitignore | 31 + dashboard/README.md | 34 + dashboard/components/content.tsx | 17 + dashboard/components/navbar.tsx | 30 + dashboard/components/server.tsx | 32 + dashboard/next-env.d.ts | 5 + dashboard/next.config.js | 6 + dashboard/out/404.html | 11 + .../TptEpqZ5gPy1hNVc7azB2/_buildManifest.js | 1 + .../_middlewareManifest.js | 1 + .../TptEpqZ5gPy1hNVc7azB2/_ssgManifest.js | 1 + .../static/chunks/767-002aa6c6f3233a53.js | 1 + .../chunks/framework-a87821de553db91d.js | 1 + .../static/chunks/main-fc7d2f0e2098927e.js | 1 + .../chunks/pages/_app-c37ec7542a90e23d.js | 1 + .../chunks/pages/_error-0a004b8b8498208d.js | 1 + .../pages/dashboard-4dbdd9683e2f72fd.js | 1 + .../chunks/pages/index-130e559957d274d5.js | 1 + .../chunks/pages/login-1aae883f06b6e9a5.js | 1 + .../chunks/pages/logout-3cb813733766654f.js | 1 + .../chunks/pages/servers-b2419c4dbe45d5ba.js | 1 + .../pages/servers/[id]-e0d1109134d94895.js | 1 + .../chunks/polyfills-5cd94c89d3acac5f.js | 1 + .../static/chunks/webpack-69bfa6990bb9e155.js | 1 + dashboard/out/dashboard.html | 1 + dashboard/out/index.html | 1 + dashboard/out/login.html | 1 + dashboard/out/logout.html | 1 + dashboard/out/servers.html | 1 + dashboard/out/servers/[id].html | 1 + dashboard/package.json | 25 + dashboard/pages/_app.tsx | 13 + dashboard/pages/_document.tsx | 30 + dashboard/pages/dashboard.tsx | 98 +++ dashboard/pages/index.tsx | 40 ++ dashboard/pages/login.tsx | 12 + dashboard/pages/logout.tsx | 10 + dashboard/pages/servers.tsx | 20 + dashboard/pages/servers/[id].tsx | 29 + dashboard/svgs/AudiotrackRounded.svg | 1 + dashboard/svgs/DnsRounded.svg | 1 + dashboard/svgs/PersonRounded.svg | 1 + dashboard/svgs/RocketLaunchRounded.svg | 1 + dashboard/tsconfig.json | 31 + package.json | 6 +- public/index.html | 579 ------------------ 52 files changed, 530 insertions(+), 618 deletions(-) delete mode 100644 api/home/dashboard.js create mode 100644 api/routes/data.js delete mode 100644 api/routes/test.js delete mode 100644 api/routes/title.js create mode 100644 dashboard/.eslintrc.json create mode 100644 dashboard/.gitignore create mode 100644 dashboard/README.md create mode 100644 dashboard/components/content.tsx create mode 100644 dashboard/components/navbar.tsx create mode 100644 dashboard/components/server.tsx create mode 100644 dashboard/next-env.d.ts create mode 100644 dashboard/next.config.js create mode 100644 dashboard/out/404.html create mode 100644 dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_buildManifest.js create mode 100644 dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_middlewareManifest.js create mode 100644 dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_ssgManifest.js create mode 100644 dashboard/out/_next/static/chunks/767-002aa6c6f3233a53.js create mode 100644 dashboard/out/_next/static/chunks/framework-a87821de553db91d.js create mode 100644 dashboard/out/_next/static/chunks/main-fc7d2f0e2098927e.js create mode 100644 dashboard/out/_next/static/chunks/pages/_app-c37ec7542a90e23d.js create mode 100644 dashboard/out/_next/static/chunks/pages/_error-0a004b8b8498208d.js create mode 100644 dashboard/out/_next/static/chunks/pages/dashboard-4dbdd9683e2f72fd.js create mode 100644 dashboard/out/_next/static/chunks/pages/index-130e559957d274d5.js create mode 100644 dashboard/out/_next/static/chunks/pages/login-1aae883f06b6e9a5.js create mode 100644 dashboard/out/_next/static/chunks/pages/logout-3cb813733766654f.js create mode 100644 dashboard/out/_next/static/chunks/pages/servers-b2419c4dbe45d5ba.js create mode 100644 dashboard/out/_next/static/chunks/pages/servers/[id]-e0d1109134d94895.js create mode 100644 dashboard/out/_next/static/chunks/polyfills-5cd94c89d3acac5f.js create mode 100644 dashboard/out/_next/static/chunks/webpack-69bfa6990bb9e155.js create mode 100644 dashboard/out/dashboard.html create mode 100644 dashboard/out/index.html create mode 100644 dashboard/out/login.html create mode 100644 dashboard/out/logout.html create mode 100644 dashboard/out/servers.html create mode 100644 dashboard/out/servers/[id].html create mode 100644 dashboard/package.json create mode 100644 dashboard/pages/_app.tsx create mode 100644 dashboard/pages/_document.tsx create mode 100644 dashboard/pages/dashboard.tsx create mode 100644 dashboard/pages/index.tsx create mode 100644 dashboard/pages/login.tsx create mode 100644 dashboard/pages/logout.tsx create mode 100644 dashboard/pages/servers.tsx create mode 100644 dashboard/pages/servers/[id].tsx create mode 100644 dashboard/svgs/AudiotrackRounded.svg create mode 100644 dashboard/svgs/DnsRounded.svg create mode 100644 dashboard/svgs/PersonRounded.svg create mode 100644 dashboard/svgs/RocketLaunchRounded.svg create mode 100644 dashboard/tsconfig.json delete mode 100644 public/index.html diff --git a/api/home/dashboard.js b/api/home/dashboard.js deleted file mode 100644 index 672245839..000000000 --- a/api/home/dashboard.js +++ /dev/null @@ -1,9 +0,0 @@ -const { Router } = require("express"); -const api = Router(); - -api.get("*", (req, res) => - // haha nerds. - res.redirect("https://cdn.darrennathanael.com/video/free.mp4") -); - -module.exports = api; diff --git a/api/index.js b/api/index.js index 1c44928b0..11f66f2db 100644 --- a/api/index.js +++ b/api/index.js @@ -33,19 +33,9 @@ class Server extends EventEmitter { ); }); }); - fs.readdir(join(__dirname, "home"), (err, files) => { - if (err) return console.log(err); - files.forEach((file) => { - this.app.use( - "/" + file.split(".")[0], - require(join(__dirname, "home") + "/" + file) - ); - }); - }); + this.app.use(express.static(join(__dirname, "..", "public"))); - // this.app.use((req, res) => { - // res.sendFile(join(__dirname, "..", "dashboard", "build", "index.html")); - // }); + this.app.use(express.static(join(__dirname, "..", "dashboard", "out"))); } listen() { diff --git a/api/routes/data.js b/api/routes/data.js new file mode 100644 index 000000000..46c6fdaf5 --- /dev/null +++ b/api/routes/data.js @@ -0,0 +1,20 @@ +const { Router } = require("express"); +const api = Router(); + +const package = require("../../package.json"); +const client = require("../../") + +api.get("/", (req, res) => { + res.json({ + name: package.name, + version: package.version, + commands: client.commands.map(cmd => { + return { + name: cmd.name, + description: cmd.description + } + }) + }); +}); + +module.exports = api; diff --git a/api/routes/test.js b/api/routes/test.js deleted file mode 100644 index ce013bbc6..000000000 --- a/api/routes/test.js +++ /dev/null @@ -1,6 +0,0 @@ -const { Router } = require("express"); -const api = Router(); - -api.get("*", (req, res) => res.send("amogus")); - -module.exports = api; diff --git a/api/routes/title.js b/api/routes/title.js deleted file mode 100644 index c725977b5..000000000 --- a/api/routes/title.js +++ /dev/null @@ -1,11 +0,0 @@ -const { Router } = require("express"); -const api = Router(); - -// send title in json format -api.get("/", (req, res) => { - res.json({ - name: "Discord Music Bot", - }); -}); - -module.exports = api; diff --git a/dashboard/.eslintrc.json b/dashboard/.eslintrc.json new file mode 100644 index 000000000..bffb357a7 --- /dev/null +++ b/dashboard/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/dashboard/.gitignore b/dashboard/.gitignore new file mode 100644 index 000000000..bf920c17b --- /dev/null +++ b/dashboard/.gitignore @@ -0,0 +1,31 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* + +# local env files +.env*.local + +# vercel +.vercel diff --git a/dashboard/README.md b/dashboard/README.md new file mode 100644 index 000000000..b12f3e33e --- /dev/null +++ b/dashboard/README.md @@ -0,0 +1,34 @@ +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). + +## Getting Started + +First, run the development server: + +```bash +npm run dev +# or +yarn dev +``` + +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. + +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. + +[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. + +The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. + +## Learn More + +To learn more about Next.js, take a look at the following resources: + +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. + +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! + +## Deploy on Vercel + +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. + +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. diff --git a/dashboard/components/content.tsx b/dashboard/components/content.tsx new file mode 100644 index 000000000..2182edb83 --- /dev/null +++ b/dashboard/components/content.tsx @@ -0,0 +1,17 @@ +import { PropsWithChildren } from "react"; +import Navbar from "./navbar"; + +export default function Content(props: PropsWithChildren){ + return
+ +
+ {props.children} +
+
+} \ No newline at end of file diff --git a/dashboard/components/navbar.tsx b/dashboard/components/navbar.tsx new file mode 100644 index 000000000..d53a495a6 --- /dev/null +++ b/dashboard/components/navbar.tsx @@ -0,0 +1,30 @@ +import { Button, Spacer } from "@nextui-org/react"; +import Link from "next/link"; + +export default function Navbar(){ + return
+

Discord Music Bot

+ + + + + + + + + + +
+} \ No newline at end of file diff --git a/dashboard/components/server.tsx b/dashboard/components/server.tsx new file mode 100644 index 000000000..d0bbfa097 --- /dev/null +++ b/dashboard/components/server.tsx @@ -0,0 +1,32 @@ +import { Avatar, Tooltip } from "@nextui-org/react"; +import Link from "next/link"; + +interface IProps { + icon: string; + name: string; + id: string; +} + +const getColor = () => { + let c = ["gradient", "primary", "secondary", "error", "warning"] + return c[Math.floor(Math.random() * c.length)]; +} + +export default function Server(props: IProps) { + return +} \ No newline at end of file diff --git a/dashboard/next-env.d.ts b/dashboard/next-env.d.ts new file mode 100644 index 000000000..4f11a03dc --- /dev/null +++ b/dashboard/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/dashboard/next.config.js b/dashboard/next.config.js new file mode 100644 index 000000000..a843cbee0 --- /dev/null +++ b/dashboard/next.config.js @@ -0,0 +1,6 @@ +/** @type {import('next').NextConfig} */ +const nextConfig = { + reactStrictMode: true, +} + +module.exports = nextConfig diff --git a/dashboard/out/404.html b/dashboard/out/404.html new file mode 100644 index 000000000..66c97b3c3 --- /dev/null +++ b/dashboard/out/404.html @@ -0,0 +1,11 @@ +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_buildManifest.js b/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_buildManifest.js new file mode 100644 index 000000000..5763f1b54 --- /dev/null +++ b/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST=function(s){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,"static/chunks/pages/index-130e559957d274d5.js"],"/_error":["static/chunks/pages/_error-0a004b8b8498208d.js"],"/dashboard":[s,"static/chunks/pages/dashboard-4dbdd9683e2f72fd.js"],"/login":["static/chunks/pages/login-1aae883f06b6e9a5.js"],"/logout":["static/chunks/pages/logout-3cb813733766654f.js"],"/servers":[s,"static/chunks/pages/servers-b2419c4dbe45d5ba.js"],"/servers/[id]":[s,"static/chunks/pages/servers/[id]-e0d1109134d94895.js"],sortedPages:["/","/_app","/_error","/dashboard","/login","/logout","/servers","/servers/[id]"]}}("static/chunks/767-002aa6c6f3233a53.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_middlewareManifest.js b/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_middlewareManifest.js new file mode 100644 index 000000000..a17fc8bf9 --- /dev/null +++ b/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_middlewareManifest.js @@ -0,0 +1 @@ +self.__MIDDLEWARE_MANIFEST=[];self.__MIDDLEWARE_MANIFEST_CB&&self.__MIDDLEWARE_MANIFEST_CB() \ No newline at end of file diff --git a/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_ssgManifest.js b/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_ssgManifest.js new file mode 100644 index 000000000..0511aa895 --- /dev/null +++ b/dashboard/out/_next/static/TptEpqZ5gPy1hNVc7azB2/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set,self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB(); \ No newline at end of file diff --git a/dashboard/out/_next/static/chunks/767-002aa6c6f3233a53.js b/dashboard/out/_next/static/chunks/767-002aa6c6f3233a53.js new file mode 100644 index 000000000..c3f6dcd61 --- /dev/null +++ b/dashboard/out/_next/static/chunks/767-002aa6c6f3233a53.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[767],{1691:function(e,t,r){"use strict";r.d(t,{ZP:function(){return j}});var o=r(7294),n=r(9641),i=r(4213),s=r(7354);function a(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}function l(e,t){let r,{elementType:o="button",isDisabled:a,onPress:l,onPressStart:c,onPressEnd:u,onPressChange:d,preventFocusOnPress:f,allowFocusWhenDisabled:b,onClick:p,href:g,target:h,rel:$,type:m="button"}=e;r="button"===o?{type:m,disabled:a}:{role:"button",tabIndex:a?void 0:0,href:"a"===o&&a?void 0:g,target:"a"===o?h:void 0,type:"input"===o?m:void 0,disabled:"input"===o?a:void 0,"aria-disabled":a&&"input"!==o?a:void 0,rel:"a"===o?$:void 0};let{pressProps:v,isPressed:y}=(0,s.r7)({onPressStart:c,onPressEnd:u,onPressChange:d,onPress:l,isDisabled:a,preventFocusOnPress:f,ref:t}),{focusableProps:x}=(0,n.kc)(e,t);b&&(x.tabIndex=a?-1:x.tabIndex);let w=(0,i.dG)(x,v,(0,i.zL)(e,{labelable:!0}));return{isPressed:y,buttonProps:(0,i.dG)(r,w,{"aria-haspopup":e["aria-haspopup"],"aria-expanded":e["aria-expanded"],"aria-controls":e["aria-controls"],"aria-pressed":e["aria-pressed"],onClick:e=>{p&&(p(e),console.warn("onClick is deprecated, please use onPress"))}})}}a({},"useButton",(()=>l));function c(e,t,r){const{isSelected:o}=t,{isPressed:n,buttonProps:s}=l({...e,onPress:(0,i.tS)(t.toggle,e.onPress)},r);return{isPressed:n,buttonProps:(0,i.dG)(s,{"aria-pressed":o})}}a({},"useToggleButton",(()=>c));const u={};var d=(e,t)=>{const r=`[Next UI]${t?` [${t}]`:" "}: ${e}`;"undefined"==typeof console||u[r]||(u[r]=!0,console.warn(r))},f=r(6212),b=r(88),p=r(1309),g=r(5893);const h=(0,f.F4)({"0%":{opacity:0,transform:"scale(0.25)"},"30%":{opacity:1},"80%":{opacity:.5},"100%":{transform:"scale(28)",opacity:0}}),$=(0,f.zo)("div",{position:"absolute",left:0,right:0,top:0,bottom:0,"& svg":{position:"absolute",animation:`350ms linear ${h}`,animationFillMode:"forwards",width:"$md",height:"$md"}}),m=o.memo((({visible:e,x:t,y:r,color:n,onCompleted:i,className:s,...a})=>{const l=(0,o.useRef)(null),c=Number.isNaN(+r)?0:r-10,u=Number.isNaN(+t)?0:t-10;return(0,o.useEffect)((()=>{if(l.current)return l.current.addEventListener("animationend",i),()=>{l.current&&l.current.removeEventListener("animationend",i)}})),e?(0,g.jsx)($,{ref:l,className:(0,p.Z)("nextui-drip",s),...a,children:(0,g.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",style:{top:c,left:u},children:(0,g.jsx)("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd",children:(0,g.jsx)("g",{className:"nextui-drip-filler",fill:n,children:(0,g.jsx)("rect",{width:"100%",height:"100%",rx:"10"})})})})}):null}));var v=(0,b.Z)(m,{visible:!1,x:0,y:0,className:""});const y=o.createContext({isButtonGroup:!1,disabled:!1}),x=(0,f.zo)("span",{dflex:"center",position:"absolute",left:"$$buttonPadding",right:"auto",top:"50%",transform:"translateY(-50%)",color:"inherit",zIndex:"$1","& svg":{background:"transparent"},variants:{isAuto:{true:{position:"relative",transform:"none",top:"0%"}},isRight:{true:{right:"$$buttonPadding",left:"auto"}},isSingle:{true:{position:"static",transform:"none"}},isGradientButtonBorder:{true:{}}},compoundVariants:[{isAuto:!0,isRight:!0,isSingle:!1,css:{order:2,ml:"calc($$buttonPadding / 2)",right:"0%",left:"0%"}},{isAuto:!0,isRight:!1,isSingle:!1,css:{order:0,mr:"calc($$buttonPadding / 2)",right:"0%",left:"0%"}},{isSingle:!0,isRight:!1,css:{ml:0}},{isSingle:!0,isRight:!0,css:{mr:0}},{isSingle:!0,isRight:!1,isGradientButtonBorder:!0,css:{mr:"calc($$buttonPadding / 2)"}}]}),w=({children:e,className:t,css:r,...o})=>(0,g.jsx)(x,{className:(0,p.Z)("nextui-button-icon",{"nextui-button-icon-right":o.isRight,"nextui-button-icon-single":o.isSingle},t),css:{...r},...o,children:e});w.toString=()=>".nextui-button-icon";const S=o.memo(w);var C=(0,b.Z)(S,{className:""}),E=(e=!1,t)=>{const[r,n]=(0,o.useState)(e),[i,s]=(0,o.useState)(0),[a,l]=(0,o.useState)(0);return{visible:r,x:i,y:a,onClick:e=>{if(!t.current)return;const r=t.current.getBoundingClientRect();n(!0),s(e.clientX-r.left),l(e.clientY-r.top)},onCompleted:()=>{n(!1),s(0),l(0)}}},P=r(9975);var L=(0,f.zo)("button",{$$buttonBorderRadius:"$radii$md",$$buttonPressedScale:.97,dflex:"center",appearance:"none",boxSizing:"border-box",fontWeight:"$medium",us:"none",lineHeight:"$sm",ta:"center",whiteSpace:"nowrap",transition:"$button",position:"relative",overflow:"hidden",border:"none",cursor:"pointer",pe:"auto",p:0,br:"$$buttonBorderRadius","@motion":{transition:"none"},".nextui-button-text":{dflex:"center",zIndex:"$2","p, pre, div":{margin:0}},[`& ${$}`]:{zIndex:"$1",".nextui-drip-filler":{opacity:.25,fill:"$accents2"}},variants:{bordered:{true:{bg:"transparent",borderStyle:"solid",color:"$text"}},ghost:{true:{}},color:{default:{bg:"$primary",color:"$primarySolidContrast"},primary:{bg:"$primary",color:"$primarySolidContrast"},secondary:{bg:"$secondary",color:"$secondarySolidContrast"},success:{bg:"$success",color:"$successSolidContrast"},warning:{bg:"$warning",color:"$warningSolidContrast"},error:{bg:"$error",color:"$errorSolidContrast"},gradient:{bg:"$gradient",color:"$primarySolidContrast"}},size:{xs:{$$buttonPadding:"$space$3",$$buttonBorderRadius:"$radii$xs",$$buttonHeight:"$space$10",px:"$3",height:"$$buttonHeight",lh:"$space$10",width:"auto",minWidth:"$20",fontSize:"$xs"},sm:{$$buttonPadding:"$space$5",$$buttonBorderRadius:"$radii$sm",$$buttonHeight:"$space$12",px:"$5",height:"$$buttonHeight",lh:"$space$14",width:"auto",minWidth:"$36",fontSize:"$sm"},md:{$$buttonPadding:"$space$7",$$buttonBorderRadius:"$radii$md",$$buttonHeight:"$space$14",px:"$7",height:"$$buttonHeight",lh:"$space$14",width:"auto",minWidth:"$48",fontSize:"$sm"},lg:{$$buttonPadding:"$space$9",$$buttonBorderRadius:"$radii$base",$$buttonHeight:"$space$16",px:"$9",height:"$$buttonHeight",lh:"$space$15",width:"auto",minWidth:"$60",fontSize:"$md"},xl:{$$buttonPadding:"$space$10",$$buttonBorderRadius:"$radii$xl",$$buttonHeight:"$space$18",px:"$10",height:"$$buttonHeight",lh:"$space$17",width:"auto",minWidth:"$72",fontSize:"$lg"}},borderWeight:{light:{bw:"$light",$$buttonBorderWeight:"$borderWeights$light"},normal:{bw:"$normal",$$buttonBorderWeight:"$borderWeights$normal"},bold:{bw:"$bold",$$buttonBorderWeight:"$borderWeights$bold"},extrabold:{bw:"$extrabold",$$buttonBorderWeight:"$borderWeights$extrabold"},black:{bw:"$black",$$buttonBorderWeight:"$borderWeights$black"}},flat:{true:{color:"$text"}},light:{true:{bg:"transparent",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$accents2"}}}},shadow:{true:{bs:"$sm"}},animated:{false:{transition:"none"}},auto:{true:{width:"auto",minWidth:"min-content"}},rounded:{true:{$$buttonBorderRadius:"$radii$pill"}},isPressed:{true:{}},isHovered:{true:{}},isChildLess:{true:{p:0,width:"$$buttonHeight",height:"$$buttonHeight"}}},compoundVariants:[{isPressed:!0,animated:!0,css:{transform:"scale($$buttonPressedScale)"}},{auto:!0,isChildLess:!1,size:"xs",css:{px:"$5",minWidth:"min-content"}},{auto:!0,isChildLess:!1,size:"sm",css:{px:"$8",minWidth:"min-content"}},{auto:!0,isChildLess:!1,size:"md",css:{px:"$9",minWidth:"min-content"}},{auto:!0,isChildLess:!1,size:"lg",css:{px:"$10",minWidth:"min-content"}},{auto:!0,isChildLess:!1,size:"xl",css:{px:"$11",minWidth:"min-content"}},{shadow:!0,color:"default",css:{normalShadow:"$primaryShadow"}},{shadow:!0,color:"primary",css:{normalShadow:"$primaryShadow"}},{shadow:!0,color:"secondary",css:{normalShadow:"$secondaryShadow"}},{shadow:!0,color:"warning",css:{normalShadow:"$warningShadow"}},{shadow:!0,color:"success",css:{normalShadow:"$successShadow"}},{shadow:!0,color:"error",css:{normalShadow:"$errorShadow"}},{shadow:!0,color:"gradient",css:{normalShadow:"$primaryShadow"}},{light:!0,color:"default",css:{bg:"transparent",color:"$text",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$primaryLightActive"}}}},{light:!0,color:"primary",css:{bg:"transparent",color:"$primary",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$primaryLightActive"}}}},{light:!0,color:"secondary",css:{bg:"transparent",color:"$secondary",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$secondaryLightActive"}}}},{light:!0,color:"warning",css:{bg:"transparent",color:"$warning",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$warningLightActive"}}}},{light:!0,color:"success",css:{bg:"transparent",color:"$success",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$successLightActive"}}}},{light:!0,color:"error",css:{bg:"transparent",color:"$error",[`& ${$}`]:{".nextui-drip-filler":{opacity:.8,fill:"$errorLightActive"}}}},{bordered:!0,color:"default",css:{bg:"transparent",borderColor:"$primary",color:"$primary",[`& ${$}`]:{".nextui-drip-filler":{fill:"$primary"}}}},{bordered:!0,color:"primary",css:{bg:"transparent",borderColor:"$primary",color:"$primary",[`& ${$}`]:{".nextui-drip-filler":{fill:"$primary"}}}},{bordered:!0,color:"secondary",css:{bg:"transparent",borderColor:"$secondary",color:"$secondary",[`& ${$}`]:{".nextui-drip-filler":{fill:"$secondary"}}}},{bordered:!0,color:"success",css:{bg:"transparent",borderColor:"$success",color:"$success",[`& ${$}`]:{".nextui-drip-filler":{fill:"$success"}}}},{bordered:!0,color:"warning",css:{bg:"transparent",borderColor:"$warning",color:"$warning",[`& ${$}`]:{".nextui-drip-filler":{fill:"$warning"}}}},{bordered:!0,color:"error",css:{bg:"transparent",borderColor:"$error",color:"$error",[`& ${$}`]:{".nextui-drip-filler":{fill:"$error"}}}},{bordered:!0,color:"gradient",css:{bg:"transparent",color:"$text",padding:"$$buttonBorderWeight",bgClip:"content-box, border-box",borderColor:"$primary",backgroundImage:"linear-gradient($background, $background), $gradient",border:"none",[`& ${$}`]:{".nextui-drip-filler":{fill:"$secondary"}}}},{ghost:!0,isHovered:!0,color:"default",css:{bg:"$primary",color:"$primarySolidContrast"}},{ghost:!0,isHovered:!0,color:"primary",css:{bg:"$primary",color:"$primarySolidContrast"}},{ghost:!0,isHovered:!0,color:"secondary",css:{bg:"$secondary",color:"$secondarySolidContrast"}},{ghost:!0,isHovered:!0,color:"success",css:{bg:"$success",color:"$successSolidContrast"}},{ghost:!0,isHovered:!0,color:"warning",css:{bg:"$warning",color:"$warningSolidContrast"}},{ghost:!0,isHovered:!0,color:"error",css:{bg:"$error",color:"$errorSolidContrast"}},{ghost:!0,color:"gradient",isHovered:!0,css:{bg:"$gradient",color:"$white"}},{flat:!0,color:"default",css:{bg:"$primaryLight",color:"$primaryLightContrast",[`& ${$}`]:{".nextui-drip-filler":{opacity:.4,fill:"$primary"}}}},{flat:!0,color:"primary",css:{bg:"$primaryLight",color:"$primaryLightContrast",[`& ${$}`]:{".nextui-drip-filler":{opacity:.4,fill:"$primary"}}}},{flat:!0,color:"secondary",css:{bg:"$secondaryLight",color:"$secondaryLightContrast",[`& ${$}`]:{".nextui-drip-filler":{opacity:.4,fill:"$secondary"}}}},{flat:!0,color:"success",css:{bg:"$successLight",color:"$successLightContrast",[`& ${$}`]:{".nextui-drip-filler":{opacity:.4,fill:"$success"}}}},{flat:!0,color:"warning",css:{bg:"$warningLight",color:"$warningLightContrast",[`& ${$}`]:{".nextui-drip-filler":{opacity:.4,fill:"$warning"}}}},{flat:!0,color:"error",css:{bg:"$errorLight",color:"$errorLightContrast",[`& ${$}`]:{".nextui-drip-filler":{opacity:.4,fill:"$error"}}}},{flat:!0,isHovered:!0,color:"default",css:{bg:"$primaryLightHover"}},{flat:!0,isHovered:!0,color:"primary",css:{bg:"$primaryLightHover"}},{flat:!0,isHovered:!0,color:"secondary",css:{bg:"$secondaryLightHover"}},{flat:!0,isHovered:!0,color:"success",css:{bg:"$successLightHover"}},{flat:!0,isHovered:!0,color:"warning",css:{bg:"$warningLightHover"}},{flat:!0,isHovered:!0,color:"error",css:{bg:"$errorLightHover"}},{flat:!0,isPressed:!0,color:"default",css:{bg:"$primaryLightActive"}},{flat:!0,isPressed:!0,color:"primary",css:{bg:"$primaryLightActive"}},{flat:!0,isPressed:!0,color:"secondary",css:{bg:"$secondaryLightActive"}},{flat:!0,isPressed:!0,color:"success",css:{bg:"$successLightActive"}},{flat:!0,isPressed:!0,color:"warning",css:{bg:"$warningLightActive"}},{flat:!0,isPressed:!0,color:"error",css:{bg:"$errorLightActive"}},{auto:!0,color:"gradient",bordered:!0,css:{".nextui-button-text":{px:"$$buttonPadding"},".nextui-button-icon":{ml:"$$buttonPadding"},".nextui-button-icon-right":{mr:"$$buttonPadding"},".nextui-button-text-left":{pl:0},".nextui-button-text-right":{pr:0}}},{rounded:!0,size:"xs",css:{br:"$pill"}},{rounded:!0,size:"sm",css:{br:"$pill"}},{rounded:!0,size:"md",css:{br:"$pill"}},{rounded:!0,size:"lg",css:{br:"$pill"}},{rounded:!0,size:"xl",css:{br:"$pill"}}],defaultVariants:{color:"default",borderWeight:"normal",animated:!0,size:"md"}},P.BM,P.Oe),N=r(2903),k=r(3569);const F=o.forwardRef((({as:e,css:t,iconLeftCss:r,iconRightCss:a,onClick:c,onPress:u,onPressStart:f,onPressEnd:b,onPressChange:h,onPressUp:$,...m},x)=>{const w=((e,t)=>{var r,o,n,i,s,a,l,c,u,d,f;return t.isButtonGroup?{...e,auto:!0,shadow:!1,bordered:null!=(r=t.bordered)?r:e.bordered,borderWeight:null!=(o=t.borderWeight)?o:e.borderWeight,ghost:null!=(n=t.ghost)?n:e.ghost,ripple:null!=(i=t.ripple)?i:e.ripple,flat:null!=(s=t.flat)?s:e.flat,animated:null!=(a=t.animated)?a:e.animated,rounded:null!=(l=t.rounded)?l:e.rounded,light:null!=(c=t.light)?c:e.light,size:null!=(u=t.size)?u:e.size,color:null!=(d=t.color)?d:e.color,disabled:null!=(f=t.disabled)?f:e.disabled}:e})(m,o.useContext(y)),S=(e=>{if(!e.disabled)return e.auto&&"gradient"===e.color&&(e.bordered||e.ghost)?{px:"$$buttonBorderWeight",py:"$$buttonBorderWeight"}:{};const t={bg:"$accents1",color:"$accents7",transform:"none",boxShadow:"none",pe:"none"};return e.bordered||e.flat||e.ghost||e.light?"gradient"===e.color&&(e.bordered||e.ghost)?{color:"$accents4",backgroundImage:"linear-gradient($background, $background), linear-gradient($accents2, $accents2)",transform:"none",boxShadow:"none",pe:"none",pl:"$$buttonBorderWeight",pr:"$$buttonBorderWeight"}:e.bordered||e.ghost||e.light?{...t,bg:"transparent",borderColor:"$accents4"}:e.flat?{...t,bg:"$accents1"}:{}:t})(w),{flat:P,children:F,disabled:R,animated:W,light:H,ripple:B,bordered:A,auto:j,borderWeight:z,icon:I,iconRight:M,ghost:T,autoFocus:O,className:K,...G}=w,V=e=>{W&&B&&D.current&&Q(e)},D=(0,N.gy)(x),{buttonProps:_,isPressed:U}=l({...m,onClick:e=>{V(e),null==c||c(e)},isDisabled:R,elementType:e,onPress:e=>{"keyboard"!==e.pointerType&&"virtual"!==e.pointerType||(V(e),null==c||c(e)),null==u||u(e)},onPressStart:f,onPressEnd:b,onPressChange:h,onPressUp:$},D),{hoverProps:Z,isHovered:q}=(0,s.XI)({isDisabled:R}),{isFocused:Y,isFocusVisible:J,focusProps:X}=(0,n.Fx)({autoFocus:O}),{onClick:Q,...ee}=E(!1,D);k.Ts&&"gradient"===w.color&&(P||H)&&d("Using the gradient color on flat and light buttons will have no effect.");const te=I||M,re=0===o.Children.count(F),oe=Boolean(M),ne=(0,o.useMemo)((()=>U?"pressed":q?"hovered":R?"disabled":"ready"),[R,q,U]),ie=(0,o.useMemo)((()=>oe?a:r),[oe,a,r]);return(0,g.jsxs)(L,{as:e,ref:D,borderWeight:z,auto:j,flat:P,light:H,ghost:T,bordered:A||T,"data-state":ne,animated:W,isChildLess:re,isPressed:U,isHovered:q||T&&Y,isFocusVisible:J&&!R,className:(0,p.Z)("nextui-button",`nextui-button--${ne}`,K),css:{...t,...S},...(0,i.dG)(_,X,Z,G),children:[0===o.Children.count(F)?(0,g.jsx)(C,{isSingle:!0,isAuto:j,isRight:oe,css:ie,isGradientButtonBorder:"gradient"===G.color&&(A||T),children:te}):te?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(C,{isSingle:!1,isAuto:j,isRight:oe,css:ie,isGradientButtonBorder:"gradient"===G.color&&(A||T),children:te}),(0,g.jsx)("div",{className:(0,p.Z)("nextui-button-text",{"nextui-button-text-right":oe,"nextui-button-text-left":!oe}),children:F})]}):(0,g.jsx)("span",{className:"nextui-button-text",children:F}),(0,g.jsx)(v,{color:"white",...ee})]})}));k.Ts&&(F.displayName="NextUI.Button"),F.toString=()=>".nextui-button";var R=(0,b.Z)(F,{ghost:!1,bordered:!1,ripple:!0,animated:!0,disabled:!1,autoFocus:!1,auto:!1,className:"",type:"button"});var W=(0,f.zo)("div",{display:"inline-flex",margin:"$3",backgroundColor:"transparent",height:"min-content",[`& ${L}`]:{".nextui-button-text":{top:0}},variants:{vertical:{true:{fd:"column",[`& ${L}`]:{"&:not(:first-child)":{btlr:0,btrr:0},"&:not(:last-child)":{bblr:0,bbrr:0}}},false:{fd:"row",[`& ${L}`]:{"&:not(:first-child)":{btlr:0,bblr:0},"&:not(:last-child)":{btrr:0,bbrr:0}}}},size:{xs:{br:"$xs"},sm:{br:"$sm"},md:{br:"$md"},lg:{br:"$base"},xl:{br:"$xl"}},rounded:{true:{br:"$pill"}},bordered:{true:{bg:"transparent"}},gradient:{true:{pl:0}}},defaultVariants:{vertical:!1},compoundVariants:[{bordered:!0,vertical:!0,css:{[`& ${L}`]:{"&:not(:last-child)":{borderBottom:"none",paddingBottom:"0"}}}},{bordered:!0,vertical:!1,css:{[`& ${L}`]:{"&:not(:first-child)":{borderLeft:"none"}}}},{bordered:!0,vertical:!1,gradient:!0,css:{[`& ${L}`]:{"&:not(:last-child)&:not(:first-child)":{pl:0},"&:last-child":{pl:0}}}}]});const H=e=>{const{disabled:t,size:r,color:n,bordered:i,ghost:s,light:a,flat:l,shadow:c,auto:u,animated:d,rounded:f,ripple:b,borderWeight:p,children:h,...$}=e,m=(0,o.useMemo)((()=>({disabled:t,size:r,color:n,bordered:i,light:a,ghost:s,flat:l,shadow:c,auto:u,borderWeight:p,animated:d,rounded:f,ripple:b,isButtonGroup:!0})),[t,d,r,b,n,i,a,s,l,p]);return(0,g.jsx)(y.Provider,{value:m,children:(0,g.jsx)(W,{size:r,bordered:i||s,gradient:"gradient"===e.color,...$,children:h})})};H.toString=()=>".nextui-button-group";const B=o.memo(H);var A=(0,b.Z)(B,{borderWeight:"normal",size:"md",color:"default"});R.Group=A;var j=R},9975:function(e,t,r){"use strict";r.d(t,{BM:function(){return n},Oe:function(){return i}});var o=r(6212);(0,o.iv)({WebkitTapHighlightColor:"transparent","&:focus:not(&:focus-visible)":{boxShadow:"none"},"&:focus":{outline:"none",boxShadow:"0 0 0 2px $colors$background, 0 0 0 4px $colors$primary"},"@safari":{WebkitTapHighlightColor:"transparent",outline:"none"}});const n=(0,o.iv)({variants:{isFocusVisible:{true:{outline:"transparent solid 2px",outlineOffset:"2px",boxShadow:"0 0 0 2px $colors$background, 0 0 0 4px $colors$primary"},false:{outline:"none"}}}}),i=((0,o.iv)({transform:"translateZ(0)",backfaceVisibility:"hidden"}),(0,o.iv)({border:"0px",clip:"rect(0px, 0px, 0px, 0px)",height:"1px",width:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"}),(0,o.iv)({'&[aria-haspopup="true"]&[aria-expanded="true"]':{opacity:.7,transform:"scale(0.97)"}}))},3569:function(e,t,r){"use strict";r.d(t,{Ts:function(){return o}});const o=!1},2903:function(e,t,r){"use strict";r.d(t,{gy:function(){return n}});var o=r(7294);"undefined"==typeof window||!window.document||window.document.createElement;function n(e){const t=(0,o.useRef)(null);return(0,o.useImperativeHandle)(e,(()=>t.current)),t}},9641:function(e,t,r){"use strict";r.d(t,{Fx:function(){return N},kc:function(){return B}});var o=r(7294),n=r(4213),i=r(7354),s=r(6010);function a(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}var l={};a(l,"FocusScope",(()=>p)),a(l,"useFocusManager",(()=>g)),a(l,"getFocusableTreeWalker",(()=>E)),a(l,"createFocusManager",(()=>P));function c(e){if("virtual"===(0,i.Jz)()){let t=document.activeElement;(0,n.QB)((()=>{document.activeElement===t&&document.contains(e)&&(0,n.Ao)(e)}))}else(0,n.Ao)(e)}function u(e,t){return"#comment"!==e.nodeName&&function(e){if(!(e instanceof HTMLElement)&&!(e instanceof SVGElement))return!1;let{display:t,visibility:r}=e.style,o="none"!==t&&"hidden"!==r&&"collapse"!==r;if(o){const{getComputedStyle:t}=e.ownerDocument.defaultView;let{display:r,visibility:n}=t(e);o="none"!==r&&"hidden"!==n&&"collapse"!==n}return o}(e)&&function(e,t){return!e.hasAttribute("hidden")&&("DETAILS"!==e.nodeName||!t||"SUMMARY"===t.nodeName||e.hasAttribute("open"))}(e,t)&&(!e.parentElement||u(e.parentElement,e))}a({},"focusSafely",(()=>c));const d=o.createContext(null);let f=null,b=new Map;function p(e){let{children:t,contain:r,restoreFocus:i,autoFocus:s}=e,a=(0,o.useRef)(),l=(0,o.useRef)(),c=(0,o.useRef)([]),u=(0,o.useContext)(d),p=null===u||void 0===u?void 0:u.scopeRef;(0,n.bt)((()=>{let e=a.current.nextSibling,t=[];for(;e&&e!==l.current;)t.push(e),e=e.nextSibling;c.current=t}),[t,p]),(0,n.bt)((()=>(b.set(c,p),()=>{c!==f&&!w(c,f)||p&&!b.has(p)||(f=p),b.delete(c)})),[c,p]),function(e,t){let r=(0,o.useRef)(),i=(0,o.useRef)(null);(0,n.bt)((()=>{let o=e.current;if(!t)return;let n=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey||e!==f)return;let r=document.activeElement,o=e.current;if(!y(r,o))return;let n=E(v(o),{tabbable:!0},o);n.currentNode=r;let i=t.shiftKey?n.previousNode():n.nextNode();i||(n.currentNode=t.shiftKey?o[o.length-1].nextElementSibling:o[0].previousElementSibling,i=t.shiftKey?n.previousNode():n.nextNode()),t.preventDefault(),i&&S(i,!0)},s=t=>{!f||w(f,e)?(f=e,r.current=t.target):e!==f||x(t.target,e)?e===f&&(r.current=t.target):r.current?r.current.focus():f&&C(f.current)},a=t=>{i.current=requestAnimationFrame((()=>{e!==f||x(document.activeElement,e)||(f=e,r.current=t.target,r.current.focus())}))};return document.addEventListener("keydown",n,!1),document.addEventListener("focusin",s,!1),o.forEach((e=>e.addEventListener("focusin",s,!1))),o.forEach((e=>e.addEventListener("focusout",a,!1))),()=>{document.removeEventListener("keydown",n,!1),document.removeEventListener("focusin",s,!1),o.forEach((e=>e.removeEventListener("focusin",s,!1))),o.forEach((e=>e.removeEventListener("focusout",a,!1)))}}),[e,t]),(0,o.useEffect)((()=>()=>cancelAnimationFrame(i.current)),[i])}(c,r),function(e,t,r){const i=(0,o.useRef)("undefined"!==typeof document?document.activeElement:null);(0,n.bt)((()=>{let o=i.current;if(!t)return;let n=t=>{if("Tab"!==t.key||t.altKey||t.ctrlKey||t.metaKey)return;let r=document.activeElement;if(!y(r,e.current))return;let n=E(document.body,{tabbable:!0});n.currentNode=r;let i=t.shiftKey?n.previousNode():n.nextNode();if(document.body.contains(o)&&o!==document.body||(o=null),(!i||!y(i,e.current))&&o){n.currentNode=o;do{i=t.shiftKey?n.previousNode():n.nextNode()}while(y(i,e.current));t.preventDefault(),t.stopPropagation(),i?S(i,!0):!function(e){for(let t of b.keys())if(y(e,t.current))return!0;return!1}(o)?r.blur():S(o,!0)}};return r||document.addEventListener("keydown",n,!0),()=>{r||document.removeEventListener("keydown",n,!0),t&&o&&y(document.activeElement,e.current)&&requestAnimationFrame((()=>{document.body.contains(o)&&S(o)}))}}),[e,t,r])}(c,i,r),function(e,t){const r=o.useRef(t);(0,o.useEffect)((()=>{r.current&&(f=e,y(document.activeElement,f.current)||C(e.current)),r.current=!1}),[])}(c,s);let g=function(e){return{focusNext(t={}){let r=e.current,{from:o,tabbable:n,wrap:i}=t,s=o||document.activeElement,a=r[0].previousElementSibling,l=E(v(r),{tabbable:n},r);l.currentNode=y(s,r)?s:a;let c=l.nextNode();return!c&&i&&(l.currentNode=a,c=l.nextNode()),c&&S(c,!0),c},focusPrevious(t={}){let r=e.current,{from:o,tabbable:n,wrap:i}=t,s=o||document.activeElement,a=r[r.length-1].nextElementSibling,l=E(v(r),{tabbable:n},r);l.currentNode=y(s,r)?s:a;let c=l.previousNode();return!c&&i&&(l.currentNode=a,c=l.previousNode()),c&&S(c,!0),c},focusFirst(t={}){let r=e.current,{tabbable:o}=t,n=E(v(r),{tabbable:o},r);n.currentNode=r[0].previousElementSibling;let i=n.nextNode();return i&&S(i,!0),i},focusLast(t={}){let r=e.current,{tabbable:o}=t,n=E(v(r),{tabbable:o},r);n.currentNode=r[r.length-1].nextElementSibling;let i=n.previousNode();return i&&S(i,!0),i}}}(c);return o.createElement(d.Provider,{value:{scopeRef:c,focusManager:g}},o.createElement("span",{"data-focus-scope-start":!0,hidden:!0,ref:a}),t,o.createElement("span",{"data-focus-scope-end":!0,hidden:!0,ref:l}))}function g(){var e;return null===(e=(0,o.useContext)(d))||void 0===e?void 0:e.focusManager}const h=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[contenteditable]"],$=h.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";h.push('[tabindex]:not([tabindex="-1"]):not([disabled])');const m=h.join(':not([hidden]):not([tabindex="-1"]),');function v(e){return e[0].parentElement}function y(e,t){return t.some((t=>t.contains(e)))}function x(e,t){for(let r of b.keys())if((r===t||w(t,r))&&y(e,r.current))return!0;return!1}function w(e,t){let r=b.get(t);return!!r&&(r===e||w(e,r))}function S(e,t=!1){if(null==e||t){if(null!=e)try{e.focus()}catch(r){}}else try{c(e)}catch(o){}}function C(e){let t=e[0].previousElementSibling,r=E(v(e),{tabbable:!0},e);r.currentNode=t,S(r.nextNode())}function E(e,t,r){let o=(null===t||void 0===t?void 0:t.tabbable)?m:$,n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){var n;return(null===t||void 0===t||null===(n=t.from)||void 0===n?void 0:n.contains(e))?NodeFilter.FILTER_REJECT:!e.matches(o)||!u(e)||r&&!y(e,r)||(null===t||void 0===t?void 0:t.accept)&&!t.accept(e)?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT}});return(null===t||void 0===t?void 0:t.from)&&(n.currentNode=t.from),n}function P(e,t={}){return{focusNext(r={}){let o=e.current,{from:n,tabbable:i=t.tabbable,wrap:s=t.wrap,accept:a=t.accept}=r,l=n||document.activeElement,c=E(o,{tabbable:i,accept:a});o.contains(l)&&(c.currentNode=l);let u=c.nextNode();return!u&&s&&(c.currentNode=o,u=c.nextNode()),u&&S(u,!0),u},focusPrevious(r=t){let o=e.current,{from:n,tabbable:i=t.tabbable,wrap:s=t.wrap,accept:a=t.accept}=r,l=n||document.activeElement,c=E(o,{tabbable:i,accept:a});if(!o.contains(l)){let e=L(c);return e&&S(e,!0),e}c.currentNode=l;let u=c.previousNode();return!u&&s&&(c.currentNode=o,u=L(c)),u&&S(u,!0),u},focusFirst(r=t){let o=e.current,{tabbable:n=t.tabbable,accept:i=t.accept}=r,s=E(o,{tabbable:n,accept:i}).nextNode();return s&&S(s,!0),s},focusLast(r=t){let o=e.current,{tabbable:n=t.tabbable,accept:i=t.accept}=r,s=L(E(o,{tabbable:n,accept:i}));return s&&S(s,!0),s}}}function L(e){let t,r;do{r=e.lastChild(),r&&(t=r)}while(r);return t}a({},"FocusRing",(()=>k));function N(e={}){let{autoFocus:t=!1,isTextInput:r,within:n}=e,s=(0,o.useRef)({isFocused:!1,isFocusVisible:t||(0,i.E)()}),[a,l]=(0,o.useState)(!1),[c,u]=(0,o.useState)((()=>s.current.isFocused&&s.current.isFocusVisible)),d=(0,o.useCallback)((()=>u(s.current.isFocused&&s.current.isFocusVisible)),[]),f=(0,o.useCallback)((e=>{s.current.isFocused=e,l(e),d()}),[d]);(0,i.mG)((e=>{s.current.isFocusVisible=e,d()}),[],{isTextInput:r});let{focusProps:b}=(0,i.KK)({isDisabled:n,onFocusChange:f}),{focusWithinProps:p}=(0,i.L_)({isDisabled:!n,onFocusWithinChange:f});return{isFocused:a,isFocusVisible:s.current.isFocused&&c,focusProps:n?p:b}}function k(e){let{children:t,focusClass:r,focusRingClass:i}=e,{isFocused:a,isFocusVisible:l,focusProps:c}=N(e),u=o.Children.only(t);return o.cloneElement(u,(0,n.dG)(u.props,{...c,className:(0,s.Z)({[r||""]:a,[i||""]:l})}))}a({},"useFocusRing",(()=>N));var F={};a(F,"FocusableProvider",(()=>H)),a(F,"useFocusable",(()=>B));let R=o.createContext(null);function W(e,t){let{children:r,...n}=e,i={...n,ref:t};return o.createElement(R.Provider,{value:i},r)}let H=o.forwardRef(W);function B(e,t){let{focusProps:r}=(0,i.KK)(e),{keyboardProps:s}=(0,i.v5)(e),a=(0,n.dG)(r,s),l=function(e){let t=(0,o.useContext)(R)||{};(0,n.lE)(t,e);let{ref:r,...i}=t;return i}(t),u=e.isDisabled?{}:l,d=(0,o.useRef)(e.autoFocus);return(0,o.useEffect)((()=>{d.current&&t.current&&c(t.current),d.current=!1}),[t]),{focusableProps:(0,n.dG)({...a,tabIndex:e.excludeFromTabOrder&&!e.isDisabled?-1:void 0},u)}}},1551:function(e,t,r){"use strict";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var d={};function f(e,t,r,o){if(e&&a.isLocalURL(t)){e.prefetch(t,r,o).catch((function(e){0}));var n=o&&"undefined"!==typeof o.locale?o.locale:e&&e.locale;d[t+"%"+r+(n?"%"+n:"")]=!0}}var b=s.default.forwardRef((function(e,t){var r,o=e.legacyBehavior,i=void 0===o?!0!==Boolean(!1):o,b=e.href,p=e.as,g=e.children,h=e.prefetch,$=e.passHref,m=e.replace,v=e.shallow,y=e.scroll,x=e.locale,w=e.onClick,S=e.onMouseEnter,C=u(e,["href","as","children","prefetch","passHref","replace","shallow","scroll","locale","onClick","onMouseEnter"]);r=g,i&&"string"===typeof r&&(r=s.default.createElement("a",null,r));var E,P=!1!==h,L=l.useRouter(),N=s.default.useMemo((function(){var e=n(a.resolveHref(L,b,!0),2),t=e[0],r=e[1];return{href:t,as:p?a.resolveHref(L,p):r||t}}),[L,b,p]),k=N.href,F=N.as,R=s.default.useRef(k),W=s.default.useRef(F);i&&(E=s.default.Children.only(r));var H=i?E&&"object"===typeof E&&E.ref:t,B=n(c.useIntersection({rootMargin:"200px"}),3),A=B[0],j=B[1],z=B[2],I=s.default.useCallback((function(e){W.current===F&&R.current===k||(z(),W.current=F,R.current=k),A(e),H&&("function"===typeof H?H(e):"object"===typeof H&&(H.current=e))}),[F,H,k,z,A]);s.default.useEffect((function(){var e=j&&P&&a.isLocalURL(k),t="undefined"!==typeof x?x:L&&L.locale,r=d[k+"%"+F+(t?"%"+t:"")];e&&!r&&f(L,k,F,{locale:t})}),[F,k,j,x,P,L]);var M={ref:I,onClick:function(e){i||"function"!==typeof w||w(e),i&&E.props&&"function"===typeof E.props.onClick&&E.props.onClick(e),e.defaultPrevented||function(e,t,r,o,n,i,s,l){("A"!==e.currentTarget.nodeName.toUpperCase()||!function(e){var t=e.currentTarget.target;return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)&&a.isLocalURL(r))&&(e.preventDefault(),t[n?"replace":"push"](r,o,{shallow:i,locale:l,scroll:s}))}(e,L,k,F,m,v,y,x)},onMouseEnter:function(e){i||"function"!==typeof S||S(e),i&&E.props&&"function"===typeof E.props.onMouseEnter&&E.props.onMouseEnter(e),a.isLocalURL(k)&&f(L,k,F,{priority:!0})}};if(!i||$||"a"===E.type&&!("href"in E.props)){var T="undefined"!==typeof x?x:L&&L.locale,O=L&&L.isLocaleDomain&&a.getDomainLocale(F,T,L&&L.locales,L&&L.domainLocales);M.href=O||a.addBasePath(a.addLocale(F,T,L&&L.defaultLocale))}return i?s.default.cloneElement(E,M):s.default.createElement("a",Object.assign({},C,M),r)}));t.default=b,("function"===typeof t.default||"object"===typeof t.default&&null!==t.default)&&(Object.assign(t.default,t),e.exports=t.default)},9246:function(e,t,r){"use strict";function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r0;t&&r&&t(r)}))}),e);return l.set(r,t={id:r,observer:i,elements:n}),t}(r),n=o.id,i=o.observer,s=o.elements;return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),l.delete(n);var t=c.findIndex((function(e){return e.root===n.root&&e.margin===n.margin}));t>-1&&c.splice(t,1)}}}(e,(function(e){return e&&b(e)}),{root:g,rootMargin:r}))}),[o,g,r,f]),m=i.useCallback((function(){b(!1)}),[]);return i.useEffect((function(){if(!a&&!f){var e=s.requestIdleCallback((function(){return b(!0)}));return function(){return s.cancelIdleCallback(e)}}}),[f]),i.useEffect((function(){t&&h(t.current)}),[t]),[$,f,m]};var i=r(7294),s=r(4686),a="undefined"!==typeof IntersectionObserver;var l=new Map,c=[];("function"===typeof t.default||"object"===typeof t.default&&null!==t.default)&&(Object.assign(t.default,t),e.exports=t.default)},9008:function(e,t,r){e.exports=r(3121)},1664:function(e,t,r){e.exports=r(1551)}}]); \ No newline at end of file diff --git a/dashboard/out/_next/static/chunks/framework-a87821de553db91d.js b/dashboard/out/_next/static/chunks/framework-a87821de553db91d.js new file mode 100644 index 000000000..1dd2b879d --- /dev/null +++ b/dashboard/out/_next/static/chunks/framework-a87821de553db91d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[774],{4448:function(e,n,t){var r=t(7294),l=t(3840);function a(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t