Version 2.1.0 - Version avec Moonlink.js
This commit is contained in:
parent
9f6460bc09
commit
9a235e2602
44
package-lock.json
generated
44
package-lock.json
generated
@ -1,22 +1,22 @@
|
||||
{
|
||||
"name": "subsonics-web",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "subsonics-web",
|
||||
"version": "2.0.0",
|
||||
"version": "2.1.0",
|
||||
"dependencies": {
|
||||
"cookie": "^0.5.0",
|
||||
"cookie-parser": "^1.4.6",
|
||||
"discord.js": "^14.9.0",
|
||||
"ejs": "^3.1.9",
|
||||
"erela.js": "^2.4.0",
|
||||
"express": "^4.18.2",
|
||||
"express-favicon": "^2.0.4",
|
||||
"loguix": "^1.4.2",
|
||||
"markdown-it": "^13.0.1",
|
||||
"moonlink.js": "^3.6.0",
|
||||
"nodemon": "^2.0.22",
|
||||
"pm2": "^5.3.0",
|
||||
"request": "^2.88.2",
|
||||
@ -1343,20 +1343,6 @@
|
||||
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/erela.js": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/erela.js/-/erela.js-2.4.0.tgz",
|
||||
"integrity": "sha512-wLfPvfzbDZTDV0zwJYXGkjO9Q6mkXi3PNf984apdv58Ktt0cv1Zp8og3hmp7Ose4C4iwAKitHxV/yiP+pt3FRQ==",
|
||||
"dependencies": {
|
||||
"@discordjs/collection": "^1.1.0",
|
||||
"tslib": "^2.4.0",
|
||||
"undici": "^5.10.0",
|
||||
"ws": "^8.8.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
@ -2284,6 +2270,14 @@
|
||||
"resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz",
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"node_modules/moonlink.js": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/moonlink.js/-/moonlink.js-3.6.0.tgz",
|
||||
"integrity": "sha512-uzXCc8G+bl87TqgoLV1pJZ0WMcGVY5RyjUJpegvKhF5lhqShIPREiH60ZORi832VQoVyg3KCBJLMSKv0D3j8wQ==",
|
||||
"engines": {
|
||||
"node": ">=16.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
@ -4855,17 +4849,6 @@
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz",
|
||||
"integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q=="
|
||||
},
|
||||
"erela.js": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/erela.js/-/erela.js-2.4.0.tgz",
|
||||
"integrity": "sha512-wLfPvfzbDZTDV0zwJYXGkjO9Q6mkXi3PNf984apdv58Ktt0cv1Zp8og3hmp7Ose4C4iwAKitHxV/yiP+pt3FRQ==",
|
||||
"requires": {
|
||||
"@discordjs/collection": "^1.1.0",
|
||||
"tslib": "^2.4.0",
|
||||
"undici": "^5.10.0",
|
||||
"ws": "^8.8.1"
|
||||
}
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
@ -5552,6 +5535,11 @@
|
||||
"resolved": "https://registry.npmjs.org/module-details-from-path/-/module-details-from-path-1.0.3.tgz",
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"moonlink.js": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/moonlink.js/-/moonlink.js-3.6.0.tgz",
|
||||
"integrity": "sha512-uzXCc8G+bl87TqgoLV1pJZ0WMcGVY5RyjUJpegvKhF5lhqShIPREiH60ZORi832VQoVyg3KCBJLMSKv0D3j8wQ=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "subsonics-web",
|
||||
"author": "Raphix",
|
||||
"version": "2.0.4",
|
||||
"version": "2.1.0",
|
||||
"nodemonConfig": {
|
||||
"ext": "js, html",
|
||||
"ignore": [
|
||||
@ -16,11 +16,11 @@
|
||||
"cookie-parser": "^1.4.6",
|
||||
"discord.js": "^14.9.0",
|
||||
"ejs": "^3.1.9",
|
||||
"erela.js": "^2.4.0",
|
||||
"express": "^4.18.2",
|
||||
"express-favicon": "^2.0.4",
|
||||
"loguix": "^1.4.2",
|
||||
"markdown-it": "^13.0.1",
|
||||
"moonlink.js": "^3.6.0",
|
||||
"nodemon": "^2.0.22",
|
||||
"pm2": "^5.3.0",
|
||||
"request": "^2.88.2",
|
||||
|
@ -1,12 +1,14 @@
|
||||
const { Client, GatewayIntentBits, Collection, ActivityType, REST, Routes } = require("discord.js")
|
||||
const fs = require("node:fs")
|
||||
const path = require("path")
|
||||
const { Manager } = require("erela.js")
|
||||
const { __glob } = require("./global-variables")
|
||||
const { LogType } = require("loguix")
|
||||
const { List } = require("./sub-list")
|
||||
const nodeFinder = require("./nodes-finder")
|
||||
const metric = require("webmetrik")
|
||||
const { MoonlinkManager } = require("moonlink.js")
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
const client = new Client({
|
||||
intents:[GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMembers],
|
||||
@ -153,16 +155,17 @@ function startErelaManager(dlog, config) {
|
||||
const elog = new LogType("Lavalink-Manager")
|
||||
const nodes = nodeFinder.getNodes()
|
||||
|
||||
client.manager = new Manager({
|
||||
client.manager = new MoonlinkManager(
|
||||
// The nodes to connect to, optional if using default lavalink options
|
||||
nodes,
|
||||
// Method to send voice data to Discord
|
||||
send: (id, payload) => {
|
||||
const guild = client.guilds.cache.get(id);
|
||||
// NOTE: FOR ERIS YOU NEED JSON.stringify() THE PAYLOAD
|
||||
if (guild) guild.shard.send(payload);
|
||||
{
|
||||
/* Options */
|
||||
},
|
||||
(guild, sPayload) => {
|
||||
// Sending payload information to the server
|
||||
client.guilds.cache.get(guild).shard.send(JSON.parse(sPayload));
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
const plog = new LogType("Lavalink-Player")
|
||||
|
||||
@ -196,6 +199,7 @@ function startErelaManager(dlog, config) {
|
||||
plog.log("Nouveau Player instancié dans : " + channel.name)
|
||||
})
|
||||
|
||||
player.setVolume(100)
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
@ -220,12 +224,12 @@ function startErelaManager(dlog, config) {
|
||||
songPlayed.setValue(songPlayed.getValue() + 1)
|
||||
|
||||
if(player) {
|
||||
plog.log("Lecture de '" + player.queue.current.title + "' de '" + player.queue.current.author + "'")
|
||||
// Create a metric to count the number of minutes played by the bot using player.queue.current.duration which is in ms (milliseconds) and verify if it's not a livestream
|
||||
plog.log("Lecture de '" + player.current.title + "' de '" + player.current.author + "'")
|
||||
// Create a metric to count the number of minutes played by the bot using player.current.duration which is in ms (milliseconds) and verify if it's not a livestream
|
||||
|
||||
if(player.queue.current.duration && player.queue.current.duration != 9223372036854776000) {
|
||||
if(player.current.duration && player.current.duration != 9223372036854776000) {
|
||||
const songDuration = new metric.Metric("songDuration", "Durée totale des musiques jouées en secondes")
|
||||
songDuration.setValue(songDuration.getValue() + (player.queue.current.duration / 1000))
|
||||
songDuration.setValue(songDuration.getValue() + (player.current.duration / 1000))
|
||||
}
|
||||
|
||||
await list.setCurrent(player)
|
||||
@ -252,29 +256,36 @@ function startErelaManager(dlog, config) {
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
})
|
||||
|
||||
client.manager.on("playerUpdate", (player) => {
|
||||
require("./sub-player").updateMusicState(client)
|
||||
})
|
||||
|
||||
// Emitted whenever a node connects
|
||||
client.manager.on("nodeConnect", node => {
|
||||
elog.log(`Connecté au serveur Lavalink : "${node.options.identifier}"` )
|
||||
nodeFinder.setNodeState(node.options.identifier, true)
|
||||
client.manager.on("nodeReady", node => {
|
||||
elog.log(`Connecté au serveur Lavalink : "${node.host}"` )
|
||||
nodeFinder.setNodeState(node.host, true)
|
||||
|
||||
|
||||
})
|
||||
|
||||
// Emitted whenever a node encountered an error
|
||||
client.manager.on("nodeError", (node, error) => {
|
||||
elog.warn(`Node "${node.options.identifier}" encountered an error: ${error.message}.`)
|
||||
elog.warn(`Node "${node.host}" encountered an error: ${error.message}.`)
|
||||
|
||||
})
|
||||
|
||||
client.manager.on("nodeDisconnect", (node) => {
|
||||
|
||||
nodeFinder.setNodeState(node.options.identifier, false)
|
||||
nodeFinder.setNodeState(node.host, false)
|
||||
|
||||
})
|
||||
|
||||
|
||||
// THIS IS REQUIRED. Send raw events to Erela.js
|
||||
client.on("raw", d => client.manager.updateVoiceState(d));
|
||||
client.on("raw", data => {
|
||||
|
||||
client.manager.packetUpdate(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,6 +7,8 @@ const nlog = new LogType("Node-Finder")
|
||||
|
||||
const nodesState = new Map()
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
function checkAndCreate() {
|
||||
if (!fs.existsSync(__glob.NODES)) {
|
||||
try {
|
||||
@ -32,14 +34,16 @@ function saveNodesFile(data) {
|
||||
|
||||
module.exports.reloadNode = function (data) {
|
||||
const client = discord.getClient()
|
||||
|
||||
if (client.manager) {
|
||||
const nodesPresent = client.manager.nodes
|
||||
if (nodesPresent.get(data.host)) {
|
||||
client.manager.destroyNode(data.host)
|
||||
client.manager.nodes.remove(data.host)
|
||||
}
|
||||
nlog.log("Redémarrage de la node : " + data.host)
|
||||
client.manager.createNode(data)
|
||||
client.manager.nodes.add(data)
|
||||
client.manager.nodes.get(data.host).connect()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,7 +103,7 @@ module.exports.addNodes = function (data) {
|
||||
if (client.manager) {
|
||||
const nodesPresent = client.manager.nodes
|
||||
if (!nodesPresent.get(data.host)) {
|
||||
client.manager.createNode(data)
|
||||
client.manager.nodes.add(data)
|
||||
}
|
||||
client.manager.nodes.get(data.host).connect()
|
||||
}
|
||||
@ -123,7 +127,7 @@ module.exports.deleteNode = function (data) {
|
||||
if (client.manager) {
|
||||
const nodesPresent = client.manager.nodes
|
||||
if (nodesPresent.get(data.host)) {
|
||||
client.manager.destroyNode(data.host)
|
||||
client.manager.nodes.remove(data.host)
|
||||
}
|
||||
}
|
||||
saveNodesFile(nodes_data)
|
||||
|
@ -8,6 +8,7 @@ const alog = new LogType("Authentification")
|
||||
var users = new Map()
|
||||
var sessions = new Array()
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
var packageJson = JSON.parse(fs.readFileSync(__glob.PACKAGE))
|
||||
|
||||
|
@ -6,6 +6,8 @@ const fs = require('fs')
|
||||
|
||||
const dlog = new LogType("Queue-List")
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
var next = new Array()
|
||||
var current = null;
|
||||
var shuffle = false
|
||||
@ -182,7 +184,7 @@ module.exports.List = class {
|
||||
.setDescription('**Demandé par **' + interaction.member.user.username)
|
||||
.addFields({name: "Auteur", value: song.author},
|
||||
{name: "URL", value: song.uri})
|
||||
.setThumbnail(song.thumbnail)
|
||||
.setThumbnail(song.artworkUrl)
|
||||
.setTimestamp();
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
@ -323,8 +325,8 @@ module.exports.List = class {
|
||||
}
|
||||
|
||||
|
||||
player = client.manager.create({
|
||||
guild: "137291455336022018",
|
||||
player = client.manager.players.create({
|
||||
guildId: "137291455336022018",
|
||||
voiceChannel: channelId,
|
||||
textChannel: "664355637685256203",
|
||||
});
|
||||
|
@ -9,6 +9,8 @@ const { Metric } = require("webmetrik");
|
||||
|
||||
const list = new List()
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
module.exports.getSong = async function (url) {
|
||||
var client = discord.getClient()
|
||||
const songs = await client.manager.search(url)
|
||||
@ -25,8 +27,8 @@ module.exports.play = async function (client, interaction) {
|
||||
|
||||
if(!player) {
|
||||
|
||||
player = client.manager.create({
|
||||
guild: interaction.guild.id,
|
||||
player = client.manager.players.create({
|
||||
guildId: interaction.guild.id,
|
||||
voiceChannel: interaction.member.voice.channel.id,
|
||||
textChannel: interaction.channel.id,
|
||||
});
|
||||
@ -68,8 +70,8 @@ module.exports.play = async function (client, interaction) {
|
||||
.setTitle('**Lecture de : **' + songs.tracks[0].title)
|
||||
.setDescription('**Demandé par **' + interaction.member.user.username)
|
||||
.addFields({name: "Auteur", value: songs.tracks[0].author},
|
||||
{name: "URL", value: songs.tracks[0].uri})
|
||||
.setThumbnail(songs.tracks[0].thumbnail)
|
||||
{name: "URL", value: songs.tracks[0].url})
|
||||
.setThumbnail(songs.tracks[0].artworkUrl)
|
||||
.setTimestamp();
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
@ -90,7 +92,7 @@ module.exports.play = async function (client, interaction) {
|
||||
}
|
||||
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -103,7 +105,7 @@ module.exports.pause = function (client, interaction) {
|
||||
|
||||
if(player) {
|
||||
|
||||
if(player.playing) {
|
||||
if(!player.paused) {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x03ff2d)
|
||||
@ -114,7 +116,7 @@ module.exports.pause = function (client, interaction) {
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
player.pause(true)
|
||||
player.pause()
|
||||
} else {
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
@ -126,7 +128,7 @@ module.exports.pause = function (client, interaction) {
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
player.pause(false)
|
||||
player.resume()
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -145,11 +147,13 @@ module.exports.pause = function (client, interaction) {
|
||||
|
||||
if(player) {
|
||||
|
||||
if(player.playing) {
|
||||
player.pause(true)
|
||||
if(!player.paused) {
|
||||
player.pause()
|
||||
console.log("Paused")
|
||||
} else {
|
||||
|
||||
player.pause(false)
|
||||
player.resume()
|
||||
console.log("Unpaused")
|
||||
}
|
||||
|
||||
}
|
||||
@ -157,7 +161,7 @@ module.exports.pause = function (client, interaction) {
|
||||
|
||||
}
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -171,11 +175,11 @@ module.exports.getState = function(client, interaction) {
|
||||
let embed = new EmbedBuilder()
|
||||
.setColor(0x32a875)
|
||||
.setTitle('Information sur la musique')
|
||||
.addFields({name:"Titre", value: player.queue.current.title},
|
||||
{name:"Auteur", value: player.queue.current.author},
|
||||
{name:"URL", value: player.queue.current.uri})
|
||||
.addFields({name:"Titre", value: player.current.title},
|
||||
{name:"Auteur", value: player.current.author},
|
||||
{name:"URL", value: player.current.url})
|
||||
.setTimestamp()
|
||||
.setThumbnail(player.queue.current.thumbnail);
|
||||
.setThumbnail(player.current.artworkUrl);
|
||||
|
||||
interaction.reply({embeds: [embed]})
|
||||
|
||||
@ -222,8 +226,8 @@ module.exports.addSong = async function (data, userId, quick, playlist) {
|
||||
|
||||
if(!player) {
|
||||
|
||||
player = client.manager.create({
|
||||
guild: "137291455336022018",
|
||||
player = client.manager.players.create({
|
||||
guildId: "137291455336022018",
|
||||
voiceChannel: channelId,
|
||||
textChannel: "664355637685256203",
|
||||
});
|
||||
@ -240,7 +244,7 @@ module.exports.addSong = async function (data, userId, quick, playlist) {
|
||||
|
||||
} else {
|
||||
|
||||
songs = await client.manager.search(data.uri)
|
||||
songs = await client.manager.search(data.url)
|
||||
}
|
||||
|
||||
if(quick) {
|
||||
@ -266,7 +270,7 @@ module.exports.addSong = async function (data, userId, quick, playlist) {
|
||||
|
||||
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -289,7 +293,7 @@ module.exports.addSongsFromPlaylist = async function (data, userId, quick) {
|
||||
|
||||
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -318,7 +322,7 @@ module.exports.skip = function (client, interaction) {
|
||||
.setColor(0x03ff2d)
|
||||
.setTitle('On change de morceau !!!')
|
||||
.setDescription("**Ok, On est reparti avec "+ list.getNextSong().title + " et c'est demandée par " + interaction.member.user.username + "**")
|
||||
.setThumbnail(list.getNextSong().thumbnail)
|
||||
.setThumbnail(list.getNextSong().artworkUrl)
|
||||
.setTimestamp();
|
||||
|
||||
player.stop()
|
||||
@ -353,7 +357,7 @@ module.exports.skip = function (client, interaction) {
|
||||
|
||||
}
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
}
|
||||
|
||||
module.exports.seek = function (data) {
|
||||
@ -372,7 +376,7 @@ module.exports.seek = function (data) {
|
||||
}
|
||||
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
|
||||
|
||||
@ -394,7 +398,7 @@ module.exports.setVol = function (data) {
|
||||
}
|
||||
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
|
||||
|
||||
@ -421,7 +425,7 @@ module.exports.loop = function (client) {
|
||||
|
||||
}
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -447,7 +451,7 @@ module.exports.changeShuffle = function (client) {
|
||||
|
||||
}
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -483,9 +487,6 @@ module.exports.search = async function (data, client) {
|
||||
|
||||
return answer
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -511,14 +512,14 @@ module.exports.previous = function (client, interaction) {
|
||||
interaction.reply({embeds: [embed]})
|
||||
} else {
|
||||
|
||||
list.__next_add(player.queue.current)
|
||||
list.__next_add(player.current)
|
||||
player.play(list.previous())
|
||||
|
||||
|
||||
embed = new EmbedBuilder()
|
||||
.setColor(0x03ff2d)
|
||||
.setTitle('Retour vers le passé !!!')
|
||||
.setDescription("**Ok, On est reparti avec "+ player.queue.current.title +" et c'est demandée par " + interaction.member.user.username + "**")
|
||||
.setDescription("**Ok, On est reparti avec "+ player.current.title +" et c'est demandée par " + interaction.member.user.username + "**")
|
||||
.setTimestamp();
|
||||
|
||||
|
||||
@ -540,13 +541,13 @@ module.exports.previous = function (client, interaction) {
|
||||
let player = client.manager.players.get("137291455336022018")
|
||||
|
||||
if(list.havePreviousSongs()){
|
||||
list.__next_add(player.queue.current)
|
||||
list.__next_add(player.current)
|
||||
player.play(list.previous())
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
}
|
||||
|
||||
const clog = new LogType("Actualisation")
|
||||
@ -658,7 +659,7 @@ module.exports.updateMusicState = function (client, action) {
|
||||
data["shuffle"] = true
|
||||
}
|
||||
|
||||
data["current"] = player.queue.current
|
||||
data["current"] = player.current
|
||||
|
||||
if(player.queueRepeat == true) {
|
||||
|
||||
@ -668,18 +669,18 @@ module.exports.updateMusicState = function (client, action) {
|
||||
data["volume"] = player.volume * 10
|
||||
|
||||
|
||||
if(player.queue.current) {
|
||||
data["durationNow"] = player.position
|
||||
data["durationAll"] = player.queue.current.duration
|
||||
currentTitle = player.queue.current.title
|
||||
if(player.current) {
|
||||
data["durationNow"] = player.current.position
|
||||
data["durationAll"] = player.current.duration
|
||||
currentTitle = player.current.title
|
||||
}
|
||||
|
||||
console.log(player.paused)
|
||||
if(player.paused) {
|
||||
|
||||
if(player.playing == true && player.paused == false) {
|
||||
|
||||
data["playing"] = 1
|
||||
} else {
|
||||
data["playing"] = 0
|
||||
} else {
|
||||
data["playing"] = 1
|
||||
|
||||
}
|
||||
|
||||
@ -698,6 +699,7 @@ module.exports.updateMusicState = function (client, action) {
|
||||
}
|
||||
|
||||
clog.log("Actualisation Clients - Titre : " + currentTitle + " - Loop : " + data.loop + " - Shuffle : " + data.shuffle + " - Playing : " + data.playing + " - Volume : " + Math.trunc(data.volume / 10) )
|
||||
|
||||
return data
|
||||
|
||||
|
||||
@ -750,7 +752,7 @@ module.exports.leave = function (client, interaction) {
|
||||
|
||||
}
|
||||
|
||||
process.emit("MUSIC_UPDATE_STATE")
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -799,3 +801,4 @@ function playStats(username) {
|
||||
userMusicPlayed.setValue(userMusicPlayed.getValue() + 1)
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@ const { url } = require("inspector");
|
||||
var playlists = {}
|
||||
const plog = new LogType("Playlist-Manager")
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
check()
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@ const markdownit = require("markdown-it")({
|
||||
typographer: true
|
||||
})
|
||||
|
||||
|
||||
/// <reference path="./types.d.ts" />
|
||||
|
||||
module.exports.WebServer = class {
|
||||
|
||||
|
7
src/modules/types.d.ts
vendored
Normal file
7
src/modules/types.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import { MoonlinkManager } from 'moonlink.js';
|
||||
|
||||
declare module 'discord.js' {
|
||||
interface Client {
|
||||
manager: MoonlinkManager;
|
||||
}
|
||||
}
|
@ -229,7 +229,7 @@ class VideoComponent {
|
||||
this.onPlaylist = false
|
||||
this.title = data.title
|
||||
this.author = data.author
|
||||
this.thumbnail = data.thumbnail
|
||||
this.thumbnail = data.artworkUrl
|
||||
this.url = data.uri
|
||||
this.duration = data.duration
|
||||
this.identifier = data.identifier
|
||||
|
@ -94,7 +94,7 @@ AlwaysRequest("MUSIC_STATE", async (data) => {
|
||||
|
||||
|
||||
if(data.current) {
|
||||
var thumbnail = data.current.thumbnail
|
||||
var thumbnail = data.current.artworkUrl
|
||||
|
||||
if(thumbnail) {
|
||||
video_img.innerHTML = '<img class="showPicture" src="' + thumbnail + '">'
|
||||
|
@ -153,7 +153,7 @@ class VideoQueue {
|
||||
console.log(data)
|
||||
this.title = data.title
|
||||
this.author = data.author
|
||||
this.thumbnail = data.thumbnail
|
||||
this.thumbnail = data.artworkUrl
|
||||
this.url = data.uri
|
||||
this.duration = data.duration
|
||||
this.identifier = data.numList + "_" + data.identifier
|
||||
|
Loading…
Reference in New Issue
Block a user