Version 2.1.3 - Ajout de la sécurité du Bot pour se déconnecter à partir de 10 minutes
All checks were successful
Subsonics - Web/pipeline/head This commit looks good

This commit is contained in:
Raphael 2024-07-03 10:19:20 +02:00
parent 30c46ba38f
commit 0cc40b443a
6 changed files with 35 additions and 12 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "subsonics-web", "name": "subsonics-web",
"author": "Raphix", "author": "Raphix",
"version": "2.1.2", "version": "2.1.3",
"nodemonConfig": { "nodemonConfig": {
"ext": "js, html", "ext": "js, html",
"ignore": [ "ignore": [

View File

@ -9,6 +9,8 @@ const metric = require("webmetrik")
const { MoonlinkManager } = require("moonlink.js") const { MoonlinkManager } = require("moonlink.js")
const { Lyrics } = require("moonlink.js-lyrics"); const { Lyrics } = require("moonlink.js-lyrics");
var endTime = 0
/// <reference path="./types.d.ts" /> /// <reference path="./types.d.ts" />
const client = new Client({ const client = new Client({
@ -144,14 +146,14 @@ function init(dlog, config) {
} }
}) })
startErelaManager(dlog, config) startManager(dlog, config)
client.login(config.token) client.login(config.token)
} }
function startErelaManager(dlog, config) { function startManager(dlog, config) {
const elog = new LogType("Lavalink-Manager") const elog = new LogType("Lavalink-Manager")
const nodes = nodeFinder.getNodes() const nodes = nodeFinder.getNodes()
@ -174,24 +176,42 @@ function startErelaManager(dlog, config) {
membersVoices.set(newMember.id, newMember.channelId) membersVoices.set(newMember.id, newMember.channelId)
/* SECURITY DISABLED
let player = client.manager.players.get(oldMember.guild.id) let player = client.manager.players.get(oldMember.guild.id)
if(player) { if(player) {
client.channels.fetch(player.options.voiceChannel).then(channel => {
client.channels.fetch(player.voiceChannel).then(channel => {
if(channel.members.size <= 1) { if(channel.members.size <= 1) {
player.destroy() // If the player is alone in the channel, we will destroy it in 10 minutes
plog.log("[Automatic Task] Player supprimé dans : " + channel.name) endTime = new Date().getTime() + 600000
plog.log("[Automatic Task] Player supprimé dans 10 minutess : " + channel.name)
} else {
plog.log("[Automatic Task] Player n'est pas seul dans le channel : " + channel.name)
endTime = 0
} }
}) })
}*/ }
}) })
// Set Interval to check endTime is equal to the current time and destroy the player
setInterval(() => {
let player = client.manager.players.get("137291455336022018")
if(player) {
if(endTime != 0 && endTime <= new Date().getTime()) {
player.destroy()
plog.log("[Automatic Task] Player détruit automatiquement")
endTime = 0
}
}
}, 1000)
const list = new List() const list = new List()

View File

@ -112,6 +112,8 @@ module.exports.addNodes = function (data) {
} }
} }
module.exports.deleteNode = function (data) { module.exports.deleteNode = function (data) {
nlog.step.init("deleteNodes", "Supression d'un noeud dans la base de donnée de nodes : " + data.host) nlog.step.init("deleteNodes", "Supression d'un noeud dans la base de donnée de nodes : " + data.host)
try { try {

View File

@ -235,8 +235,8 @@ module.exports.List = class {
previousList.unshift(song) previousList.unshift(song)
savePreviousFile(previousList) savePreviousFile(previousList)
} }
} }
__previous_remove(song) { __previous_remove(song) {

View File

@ -67,6 +67,7 @@ class User {
var ActualDroppableMenu = null var ActualDroppableMenu = null
class DroppableMenu { class DroppableMenu {
options = new Array() options = new Array()
id = null id = null

View File

@ -143,7 +143,7 @@
<!-- Scripts --> <!-- Scripts -->
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<script src="/javascript/IO.js"></script> <script src="/javascript/IO.js"></script>
<script src="/javascript/basics.js"></script> <script src="/javascript/basics.js"></script>