Version 0.9.3 - Ajout du drag&drop sur la liste de lecture

This commit is contained in:
Raphix
2023-09-15 21:08:43 +02:00
parent 36500a1979
commit 83bfafb5c6
6 changed files with 158 additions and 13 deletions

View File

@ -178,6 +178,22 @@ module.exports.List = class {
}
async replaceList(data) {
var newOrder = new Array()
for(var numOrder of data) {
parseInt(numOrder)
newOrder.push(next[numOrder])
}
next = newOrder
process.emit("MUSIC_UPDATE_STATE")
}
async fpPlaylistAdd(playlist, client) {
let player = client.manager.players.get("137291455336022018")
@ -252,10 +268,18 @@ module.exports.List = class {
let player = client.manager.players.get("137291455336022018")
if(!player) {
var channelId = discord.getMemberVoices().get(userId)
if(!channelId) {
channelId = "664355808250953739"
}
player = client.manager.create({
guild: "137291455336022018",
voiceChannel: discord.getMemberVoices().get(userId),
voiceChannel: channelId,
textChannel: "664355637685256203",
});
@ -280,4 +304,5 @@ module.exports.List = class {
}
}
}

View File

@ -790,10 +790,38 @@ function IOConnection(io) {
} else {
io.emit("ANSWER/SEND/DELETE_QUEUE", {"error":"USER_DONT_EXIST"})
io.emit("ANSWER/SEND/MOVE_QUEUE", {"error":"USER_DONT_EXIST"})
}
} else {
io.emit("ANSWER/SEND/DELETE_QUEUE", {"error":"TOKEN_NOT_FINDED"})
io.emit("ANSWER/SEND/MOVE_QUEUE", {"error":"TOKEN_NOT_FINDED"})
}
})
socket.on("SEND/MOVE_QUEUE_BY_ENTIRE", (data) => {
var cookies = socket.handshake.headers.cookie
if(cookies) {
cookies = cook.parse(cookies)
var token = cookies.token
if(auth.checkUser(token)) {
var sublist = new List()
sublist.replaceList(data)
} else {
io.emit("ANSWER/SEND/MOVE_QUEUE_BY_ENTIRE", {"error":"USER_DONT_EXIST"})
}
} else {
io.emit("ANSWER/SEND/MOVE_QUEUE_BY_ENTIRE", {"error":"TOKEN_NOT_FINDED"})
}