diff --git a/Jenkinsfile b/Jenkinsfile index 1b48590..77d44a2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,9 +6,9 @@ pipeline { steps { script { echo "[Subsonics-Deploy] - Test Stage" - sh "rm -rf subsonics" - sh "git clone https://git.raphix.fr/raphix/subsonics.git" - sh "cd subsonics" + sh "rm -rf bot" + sh "git clone https://git.raphix.fr/subsonics/bot.git" + sh "cd bot" sh "npm i" sh "ENV='TEST' node src/main.js" } diff --git a/package.json b/package.json index 462e901..4061cb9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "subsonics-discord", "author": "Raphix", - "version": "5.5", + "version": "6.0", "nodemonConfig": { "ext": "js, html", "ignore": [ diff --git a/src/commands/play.js b/src/commands/play.js index 805db8f..b243e37 100644 --- a/src/commands/play.js +++ b/src/commands/play.js @@ -46,9 +46,9 @@ module.exports = { if(!player) { player = client.manager.create({ - guild: interaction.guild.id, - voiceChannel: interaction.member.voice.channel.id, - textChannel: interaction.channel.id, + guild: interaction.guild.id, + voiceChannel: interaction.member.voice.channel.id, + textChannel: interaction.channel.id, }); player.connect(); diff --git a/src/commands/restart.js b/src/commands/restart.js index 4faf570..c61eb60 100644 --- a/src/commands/restart.js +++ b/src/commands/restart.js @@ -34,8 +34,8 @@ module.exports = { const nodes = [ { - host: "lavalink.devamop.in", - password: "DevamOP", + host: "lavalink.lexnet.cc", + password: "lexn3tl@val!nk", port: 443, secure: true } diff --git a/src/main.js b/src/main.js index bc383ad..de697ba 100644 --- a/src/main.js +++ b/src/main.js @@ -129,8 +129,8 @@ function startDiscordBot() { const nodes = [ { - host: "lavalink.devamop.in", - password: "DevamOP", + host: "lavalink.lexnet.cc", + password: "lexn3tl@val!nk", port: 443, secure: true } @@ -460,6 +460,35 @@ function startServer(client) { } + }) + + socket.on("loop", (token) => { + + if(users.has(token)) { + + let player = client.manager.players.get("137291455336022018") + + log.server("Looping demandé par" + users.get(token).username + "#" + users.get(token).discriminator) + + if(player) { + + if(player.queueRepeat == true) { + player.setQueueRepeat(false) + + } else { + player.setQueueRepeat(true) + + } + + } + + actualize() + } else { + socket.emit("authFailed") + + } + + }) socket.on("exit", (token) => { @@ -530,13 +559,28 @@ function startServer(client) { "playing": 0, "current":null, "isOnline": false, - "queue": null + "queue": null, + "loop": false, + "durationNow": null, + "durationAll": null } if(player) { data["current"] = player.queue.current + if(player.queueRepeat == true) { + + data["loop"] = true + } + + + + if(player.queue.current) { + data["durationNow"] = player.position + data["durationAll"] = player.queue.current.duration + } + if(player.playing == true && player.paused == false) { data["playing"] = 1 @@ -544,11 +588,11 @@ function startServer(client) { data["playing"] = 0 } - + data["queue"] = player.queue; if(player.playing == true) { - + log.server("Musique : Musique actuelle : " + player.queue.current.title) } @@ -667,7 +711,7 @@ function startServer(client) { function createIdentity(response, token, socket) { - console.log(response) + log.server("Discord Auth : REQUESTING DATA - TOKEN : " + token + " - DISCORD_ACCESS_TOKEN : " + response.access_token) fetch('https://discord.com/api/users/@me', { @@ -684,7 +728,7 @@ function startServer(client) { async function addIdentity(response, token, socket) { - console.log(response) + log.server("Discord Auth : [IDENTITE] : Nouvelle identité - SOCKET_ID : " + socket.id + " - DISCORD_USER : " + response.username + "#" + response.discriminator) @@ -694,24 +738,19 @@ function startServer(client) { await fs.writeFileSync(__dirname + path.sep + "tokens.json", JSON.stringify(tokens, null, 2)) - await addAllUsers() + await users.set(token, response) + + + - await socket.emit("successLogin", token) + socket.emit("successLogin", token) actualize() authTokenWait.delete(token) } - function addAllUsers() { - users = new Map() - for(var user in tokens) { - - users.set(user , tokens[user]) - } - - } diff --git a/src/tokens.json b/src/tokens.json index 077404a..8a00c26 100644 --- a/src/tokens.json +++ b/src/tokens.json @@ -1,3 +1,138 @@ { - + "c6eda614-d07f-4411-8b9d-c03a56722999": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "6c50f21c-2d73-4176-8d9f-ef84b8ab9997": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "5fe53ab5-5d26-4d2b-9d1f-0068492d01a4": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "b85c122c-f68f-4248-ab38-868693aa92a7": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "a6148b9d-6d83-42c8-bca7-7000ca70185b": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "241cb45e-f597-4ab9-b678-12f86e498862": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "49c3072b-7bd6-471b-a955-13572682e130": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + }, + "198af2b4-3248-4d0e-b37c-fbdffb336c11": { + "id": "486943594893017119", + "username": "Raphix", + "global_name": null, + "display_name": null, + "avatar": "883ec1a7136b0aa3c22e4bdc33e278e5", + "discriminator": "8434", + "public_flags": 4194368, + "flags": 4194368, + "banner": null, + "banner_color": "#ff4d4d", + "accent_color": 16731469, + "locale": "fr", + "mfa_enabled": true, + "premium_type": 0, + "avatar_decoration": null + } } \ No newline at end of file