Compare commits

...

9 Commits

Author SHA1 Message Date
96cd60912b Version 1.2.0 - Ajout des suggestions et de paramètres
All checks were successful
Deployment Pipeline / deploy (push) Successful in 35s
2025-09-07 18:18:52 +02:00
b2aadc7c3c Version 1.1.4 - Correction de Bug
All checks were successful
Deployment Pipeline / deploy (push) Successful in 36s
2025-09-06 15:47:06 +02:00
dcc056455e Version 1.1.3 - Modfication du Proxy
All checks were successful
Deployment Pipeline / deploy (push) Successful in 36s
2025-08-31 16:57:13 +02:00
f777fb821a Version 1.1.2-rc4 - Modif erreur
All checks were successful
Deployment Pipeline / deploy (push) Successful in 37s
2025-08-29 19:44:38 +02:00
ecbda838d3 Merge branch 'main' of https://git.raphix.fr/subsonics/chopin
All checks were successful
Deployment Pipeline / deploy (push) Successful in 35s
2025-08-29 19:41:32 +02:00
5ac195fd46 Version 1.1.2-rc4 - Ajout de agent Cookie 2025-08-29 19:41:08 +02:00
914edbbf13 Version 1.1.2-rc3 - Modification Cookie
All checks were successful
Deployment Pipeline / deploy (push) Successful in 40s
2025-08-29 15:25:22 +02:00
c376e3259c Version 1.1.2-rc2 - Ajout Cookies
All checks were successful
Deployment Pipeline / deploy (push) Successful in 35s
2025-08-29 12:44:25 +02:00
f3b237b74f Version 1.1.2-rc1 - Modif Ytdl
All checks were successful
Deployment Pipeline / deploy (push) Successful in 34s
2025-08-29 12:29:02 +02:00
9 changed files with 177 additions and 219 deletions

View File

@@ -1,9 +1,29 @@
<div class="changelog-version changelog-actual"> <div class="changelog-version changelog-actual">
<h2>Chopin - Version /*1.0.0*/</h2> <h2>Chopin - Version /*1.2.0*/</h2>
<p class="changelog-date">*_Date de sortie_*: *-29/08/2025-*</p> <p class="changelog-date">*_Date de sortie_*: *-07/09/2025-*</p>
<p>VERSION /*BETA*/</p>
<ul> <ul>
<li>[FRONTEND] Sortie de la version 1.0.0 de Chopin, le bot Discord pour SubSonics. Refonte graphique et passage sur Vue JS</li> <li>/#[AJOUT][FRONTEND]#/ Suggestion de recherche, depuis Youtube</li>
<li>[BACKEND] Refonte de toute la gestion de la musique et ajout de nouvelles fonctionnalités</li> <li>/#[FIX][FRONTEND]#/ Optimisation des bouttons, avec une modification du composant</li>
<li>/#[AJOUT][DISCORD]#/ Ajout de la sécurité, permettant de restreindre l'utilisation du Bot au Rôle paramétré</li>
</ul>
</div>
<div class="changelog-version">
<h2>Chopin - Version /*1.1.0*/</h2>
<p class="changelog-date">*_Date de sortie_*: *-06/09/2025-*</p>
<ul>
<li>/#[AJOUT][FRONTEND]#/ Désormais, lorsque l'utilisateur n'est pas connecté, les bouttons de lecture sont désactivés au lieu d'être masqués</li>
<li>/#[AJOUT][FRONTEND] #/ Ajout de la prise en charge de plusieurs fichiers en même temps (Impossibilité sur Discord à cause de restriction) !</li>
<li>/#[FIX][BACKEND]#/ La source Youtube est désormais fonctionnelle</li>
<li>/#[FIX][BACKEND]#/ Le changement de channel est désormais fonctionnel.</li>
<li>/#[FIX][FRONTEND]#/ Résolution d'un problème d'affichage du changelog et de la liste de lecture</li>
<li>/#[FIX][FRONTEND]#/ Le "En ligne" est désormais resynchronisé sur le Bot</li>
</ul>
</div>
<div class="changelog-version">
<h2>Chopin - Version /*1.0.0*/</h2>
<p class="changelog-date">*_Date de sortie_*: *-29/08/2025-*</p>
<ul>
<li>/#[FRONTEND]#/ Sortie de la version 1.0.0 de Chopin, le bot Discord pour SubSonics. Refonte graphique et passage sur Vue JS</li>
<li>/#[BACKEND]#/ Refonte de toute la gestion de la musique et ajout de nouvelles fonctionnalités</li>
</ul> </ul>
</div> </div>

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "chopin-backend", "name": "chopin-backend",
"version": "1.1.1", "version": "1.1.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "chopin-backend", "name": "chopin-backend",
"version": "1.1.1", "version": "1.1.2",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@discordjs/voice": "^0.18.0", "@discordjs/voice": "^0.18.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "chopin-backend", "name": "chopin-backend",
"version": "1.1.2", "version": "1.2.0",
"description": "Discord Bot for music - Fetching everywhere !", "description": "Discord Bot for music - Fetching everywhere !",
"main": "src/main.js", "main": "src/main.js",
"nodemonConfig": { "nodemonConfig": {

View File

@@ -7,6 +7,8 @@ const config = require("../utils/Database/Configuration")
const metric = require("webmetrik") const metric = require("webmetrik")
const { Player } = require("../player/Player") const { Player } = require("../player/Player")
const {refreshAllUserInformation} = require("../server/auth/User") const {refreshAllUserInformation} = require("../server/auth/User")
const serverSettings = require("./ServerSettings")
const { Embed, EmbedError } = require("./Embed")
const dlog = new LogType("Discord") const dlog = new LogType("Discord")
const glog = new LogType("GuildUpdater") const glog = new LogType("GuildUpdater")
@@ -49,6 +51,29 @@ function getGuildMembers(guildId) {
return guild.members.cache.map(member => member.user.id) return guild.members.cache.map(member => member.user.id)
} }
function getGuildMember(guildId, memberId) {
const guild = client.guilds.cache.get(guildId)
if(!guild) {
dlog.error("Guild not found: " + guildId)
return null
}
return guild.members.cache.get(memberId) || null
}
function getGuildRoles(guildId) {
const guild = client.guilds.cache.get(guildId)
if(!guild) {
dlog.error("Guild not found: " + guildId)
return []
}
return guild.roles.cache.map(role => ({
id: role.id,
name: role.name,
color: role.color,
position: role.position
}))
}
function getChannel(guildId, channelId) { function getChannel(guildId, channelId) {
return client.guilds.cache.get(guildId).channels.cache.get(channelId) return client.guilds.cache.get(guildId).channels.cache.get(channelId)
} }
@@ -77,7 +102,7 @@ function init() {
operational = true operational = true
}) })
client.on("interactionCreate", (interaction) => { client.on("interactionCreate", async (interaction) => {
if(!interaction.isCommand()) return; if(!interaction.isCommand()) return;
@@ -87,13 +112,27 @@ function init() {
numberOfCommandsServer.setValue(numberOfCommandsServer.getValue() + 1) numberOfCommandsServer.setValue(numberOfCommandsServer.getValue() + 1)
const command = client.commands.get(interaction.commandName) const command = client.commands.get(interaction.commandName)
const roleProtected = await serverSettings.getSecureRole(interaction.guild.id) || false
var havePermission = true;
if(roleProtected) {
await interaction.member.fetch()
if(!interaction.member.roles.cache.has(roleProtected.id)) {
havePermission = false;
}
}
try { try {
// Create a metric to count the number of commands executed by each user // Create a metric to count the number of commands executed by each user
const userCommand = new metric.Metric("userCommand_" + interaction.member.user.username, "Nombre de commandes éxécutées par l'utilisateur : " + interaction.member.user.username) const userCommand = new metric.Metric("userCommand_" + interaction.member.user.username, "Nombre de commandes éxécutées par l'utilisateur : " + interaction.member.user.username)
userCommand.setValue(userCommand.getValue() + 1) userCommand.setValue(userCommand.getValue() + 1)
dlog.log(interaction.member.user.username + "-> /" + interaction.commandName) dlog.log(interaction.member.user.username + "-> /" + interaction.commandName)
command.execute(client, interaction) if(havePermission) {
command.execute(client, interaction)
} else {
const embed = new EmbedError(`L'utilisation du Bot est réservée aux membres ayant le rôle "${roleProtected.name}"`, interaction, true)
embed.setTitle("Accès refusé")
embed.send()
}
} catch(error) { } catch(error) {
dlog.error(interaction.member.user.username + "-> /" + interaction.commandName + " : ERREUR RENCONTRE") dlog.error(interaction.member.user.username + "-> /" + interaction.commandName + " : ERREUR RENCONTRE")
@@ -219,6 +258,6 @@ function checkRequiredPermission(guildMember) {
return requiredPermissions.filter(permission => !guildMember.permissions.has(permission)); return requiredPermissions.filter(permission => !guildMember.permissions.has(permission));
} }
module.exports = {init, getClient, getGuilds, getMembersVoices, getChannel, getGuildMembers, isReady} module.exports = {init, getClient, getGuilds, getMembersVoices, getChannel, getGuildMembers, getGuildMember, isReady, getGuildRoles}

View File

@@ -0,0 +1,38 @@
const { LogType } = require('loguix');
const clog = new LogType('ServerSettings');
const { __glob } = require('../utils/GlobalVars');
const { Database } = require('../utils/Database/Database');
const ServerDB = new Database("server_settings", __glob.SERVER_DB, {});
function getSecureRole(guildId) {
checkKey(guildId);
var role = ServerDB.getData()[guildId].secureRole || null;
if(role) {
if(role.name === "@everyone") {
return null;
}
}
return role;
}
function setSecureRole(guildId, roleId) {
checkKey(guildId);
ServerDB.getData()[guildId].secureRole = roleId;
ServerDB.save();
process.emit("USERS_UPDATE")
return true;
}
async function checkKey(guildId) {
const data = ServerDB.getData();
if (!data[guildId]) {
data[guildId] = { secureRole: null };
ServerDB.save();
}
}
module.exports = {
getSecureRole,
setSecureRole
};

View File

@@ -2,198 +2,13 @@ const {createAudioResource, VoiceConnectionStatus, createAudioPlayer, StreamType
const {LogType} = require('loguix') const {LogType} = require('loguix')
const clog = new LogType("Youtube-Stream") const clog = new LogType("Youtube-Stream")
const ytdl = require('@distube/ytdl-core') const ytdl = require('@distube/ytdl-core')
const ffmpeg = require('fluent-ffmpeg')
const { getRandomIPv6 } = require("@distube/ytdl-core/lib/utils");
const { __glob } = require('../../utils/GlobalVars'); const { __glob } = require('../../utils/GlobalVars');
const fs = require('fs');
async function getStream(song) { async function getStream(song) {
//FIXME: Change youtube provider // FIXME: Change youtube provider
const cookies = [
{
"domain": ".youtube.com",
"expirationDate": 1787997552.154245,
"hostOnly": false,
"httpOnly": true,
"name": "__Secure-1PSIDTS",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"session": false,
"storeId": "0",
"value": "sidts-CjUB5H03P1eFzyOjf7iFS9S6yN4AqceShfkIkvPkpZwOW5LQeQV067Xii6ZWiTxoXL2dOIlB0xAA",
"id": 1
},
{
"domain": ".youtube.com",
"expirationDate": 1791021552.154345,
"hostOnly": false,
"httpOnly": false,
"name": "__Secure-3PAPISID",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "fOTsHsOxnWoXhiUB/AqEIhO8nncInuR8rz",
"id": 2
},
{
"domain": ".youtube.com",
"expirationDate": 1791021552.154362,
"hostOnly": false,
"httpOnly": true,
"name": "__Secure-3PSID",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "g.a0000whlgE5u02Gic-y3Xv79fKiY_rEYP3D1Epg_nHe_sq4rB3cPqYwTtWZ03wl6ezyiyQAU9gACgYKAWcSARQSFQHGX2MibBW35YRzvbQffZKHV9um3hoVAUF8yKqUL4kb3nKQdUHrCv97ORRV0076",
"id": 3
},
{
"domain": ".youtube.com",
"expirationDate": 1787997603.866,
"hostOnly": false,
"httpOnly": true,
"name": "__Secure-3PSIDCC",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "AKEyXzVrFCvitebcHpnaI5cEG4zP7KuLMuUu0aGQFmNSbAjqCoY1_zeT545QE7hHdATGBpO7Pw",
"id": 4
},
{
"domain": ".youtube.com",
"expirationDate": 1787997552.154322,
"hostOnly": false,
"httpOnly": true,
"name": "__Secure-3PSIDTS",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "sidts-CjUB5H03P1eFzyOjf7iFS9S6yN4AqceShfkIkvPkpZwOW5LQeQV067Xii6ZWiTxoXL2dOIlB0xAA",
"id": 5
},
{
"domain": ".youtube.com",
"expirationDate": 1790589574.430833,
"hostOnly": false,
"httpOnly": true,
"name": "__Secure-YEC",
"path": "/",
"sameSite": "lax",
"secure": true,
"session": false,
"storeId": "0",
"value": "CgtVb1BOdEIxbDhqbyiH9MXFBjInCgJGUhIhEh0SGwsMDg8QERITFBUWFxgZGhscHR4fICEiIyQlJiAo",
"id": 6
},
{
"domain": ".youtube.com",
"expirationDate": 1756462164,
"hostOnly": false,
"httpOnly": false,
"name": "CONSISTENCY",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"session": false,
"storeId": "0",
"value": "AKreu9vapsE-D9riK0YUXwAAz5qE-UybsBcvUp7LAVHoItqgMjtsFcTEXhLW_lkTdGZDln9ND2iB9PxrkhJPH-MWxATGhPTky1fYgQmMnPxDaqiQkzJQ4rZ8FjpPMUxANloGziFufRcNzSHkCkVd6oBj",
"id": 7
},
{
"domain": ".youtube.com",
"expirationDate": 1756463354.608961,
"hostOnly": false,
"httpOnly": true,
"name": "GPS",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"session": false,
"storeId": "0",
"value": "1",
"id": 8
},
{
"domain": ".youtube.com",
"expirationDate": 1791021554.511376,
"hostOnly": false,
"httpOnly": true,
"name": "LOGIN_INFO",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "AFmmF2swRAIgemYDi5tgUKdwVnd3jPFEQNKzUGVkWUn0K_Aevsp3CWYCIG01E_bNLSV8_vdOZ6S2rHO2vs8EQS2xm0eGU7Xr3ktp:QUQ3MjNmeUt0SG1kdWsyVVJWUmkzbU0tNFp4VEJRNnZEZWRJNmF3VUpvNVpzSGc0aWdUN3ZrVGt6eFFVMnF0UVNXZGlPSjdBY2d3ZDVhOHN0VmphU3J1VWk2WFRHWUVGZnE3RHZqNWdQdlE0QmltbW52aHlSUWJLYmdXOVNZazV5UEZpTmtSUkNwT0hCVFZVWHhIYUNMVktKQ1JpVmYxazZn",
"id": 9
},
{
"domain": ".youtube.com",
"expirationDate": 1791021560.804764,
"hostOnly": false,
"httpOnly": false,
"name": "PREF",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"session": false,
"storeId": "0",
"value": "f6=40000000&tz=Europe.Paris",
"id": 10
},
{
"domain": ".youtube.com",
"expirationDate": 1790412568.984102,
"hostOnly": false,
"httpOnly": false,
"name": "SOCS",
"path": "/",
"sameSite": "lax",
"secure": true,
"session": false,
"storeId": "0",
"value": "CAAaBgiAlbnFBg",
"id": 11
},
{
"domain": ".youtube.com",
"expirationDate": 1772013603.865942,
"hostOnly": false,
"httpOnly": true,
"name": "VISITOR_PRIVACY_METADATA",
"path": "/",
"sameSite": "no_restriction",
"secure": true,
"session": false,
"storeId": "0",
"value": "CgJGUhIhEh0SGwsMDg8QERITFBUWFxgZGhscHR4fICEiIyQlJiAo",
"id": 12
},
{
"domain": ".youtube.com",
"expirationDate": 1756461674.511457,
"hostOnly": false,
"httpOnly": true,
"name": "YTSESSION-js1wlf",
"path": "/",
"sameSite": "unspecified",
"secure": true,
"session": false,
"storeId": "0",
"value": "ANPz9Kig405ZS6xB8yYm7gwWVAJKCUOYanC3MQXUsI24o1blDFAG9/PHFjygZMcrF52DuumKq6oyePMMl4Tp/CGLCWGCiNcFDW5IU6S0g7mgJOl9",
"id": 13
}
]
ytdl.createAgent(cookies)
try { try {
const headers = { const headers = {
@@ -202,16 +17,10 @@ async function getStream(song) {
'Chrome/116.0.5845.97 Safari/537.36', 'Chrome/116.0.5845.97 Safari/537.36',
'Accept-Language': 'en-US,en;q=0.9' 'Accept-Language': 'en-US,en;q=0.9'
}; };
// let cookies = null;
// try {
// cookies = JSON.parse(fs.readFileSync(__glob.COOKIES, 'utf-8'));
// } catch (error) {
// clog.error("Erreur lors de la lecture des cookies : " + error);
// }
// ytdl.createAgent({ var cookies = await JSON.parse(await fs.readFileSync(__glob.COOKIES, 'utf-8'));
// cookies const proxy = await JSON.parse(await fs.readFileSync(__glob.PROXY, 'utf-8'));
// }); const agent = ytdl.createProxyAgent(proxy, cookies)
let stream = ytdl(song.url, { let stream = ytdl(song.url, {
quality: 'highestaudio', quality: 'highestaudio',
highWaterMark: 1 << 30, highWaterMark: 1 << 30,
@@ -219,8 +28,9 @@ async function getStream(song) {
dlChunkSize: 0, dlChunkSize: 0,
bitrate: 128, bitrate: 128,
requestOptions: { requestOptions: {
headers: headers, headers: headers,
} },
agent: agent,
}); });
return stream return stream

View File

@@ -127,7 +127,7 @@ class Player {
checkConnection() { checkConnection() {
if(this.connection === null) { if(this.connection === null) {
clog.error(`GUILD : ${this.guildId} - La connection n'est pas définie`) // clog.error(`GUILD : ${this.guildId} - La connection n'est pas définie`)
return true return true
} }
if(this.player === null) { if(this.player === null) {

View File

@@ -19,6 +19,7 @@ const {__glob} = require("../utils/GlobalVars")
const playlists = require("../playlists/PlaylistManager") const playlists = require("../playlists/PlaylistManager")
const history = require("../playlists/History") const history = require("../playlists/History")
const lyrics = require("../lyrics/Lyrics") const lyrics = require("../lyrics/Lyrics")
const serverSettings = require("../discord/ServerSettings")
const mediaBase = require("../discord/MediaBase") const mediaBase = require("../discord/MediaBase")
const googleApis = require("../playlists/Google/OAuth2") const googleApis = require("../playlists/Google/OAuth2")
const youtubeApi = require("../playlists/Google/YoutubeList") const youtubeApi = require("../playlists/Google/YoutubeList")
@@ -34,8 +35,6 @@ const allConnectedUsers = new Array()
const guildConnectedUsers = new Map() const guildConnectedUsers = new Map()
const UsersBySocket = new Map() const UsersBySocket = new Map()
//TODO: Separate all request in separate files
function init() { function init() {
wlog.step.init("server_init", "Initialisation du serveur Socket.IO") wlog.step.init("server_init", "Initialisation du serveur Socket.IO")
@@ -419,7 +418,7 @@ function init() {
// CHECKED : 03/05/2025 // CHECKED : 03/05/2025
IORequest("/PLAYER/CHANNEL/CHANGE", () => { IORequest("/PLAYER/CHANNEL/CHANGE", () => {
handlePlayerAction(actualGuildId, (player) => { handlePlayerAction(actualGuildId, (player) => {
const channel = getUserChannel() const channel = getUserChannel(false, true)
if(!channel) { if(!channel) {
IOAnswer("/PLAYER/CHANNEL/CHANGE", false) IOAnswer("/PLAYER/CHANNEL/CHANGE", false)
return return
@@ -793,6 +792,35 @@ function init() {
IOAnswer("/OWNER/USERS/SWITCH_MOD", true) IOAnswer("/OWNER/USERS/SWITCH_MOD", true)
}) })
IORequest("/OWNER/ROLES/GET", async () => {
if(!actualGuildId) return IOAnswer("/OWNER/ROLES/GET", false)
const guild = discordBot.getGuilds().get(actualGuildId)
if(!socketUser.identity.id === guild.owner) return IOAnswer("/OWNER/ROLES/GET", false)
const rolesSecure = discordBot.getGuildRoles(actualGuildId)
const actualRole = await serverSettings.getSecureRole(actualGuildId)
// Move the actual role at the start of the array
if(actualRole) {
const index = rolesSecure.findIndex(r => r.id === actualRole.id)
if(index > -1) {
rolesSecure.unshift(rolesSecure.splice(index, 1)[0])
}
} else {
// Find the @everyone role and put it at the start of the array
const index = rolesSecure.findIndex(r => r.name === "@everyone")
if(index > -1) {
rolesSecure.unshift(rolesSecure.splice(index, 1)[0])
}
}
IOAnswer("/OWNER/ROLES/GET", await rolesSecure)
})
IORequest("/OWNER/ROLES/SET", async (data) => {
if(!actualGuildId) return IOAnswer("/OWNER/ROLES/SET", false)
const guild = discordBot.getGuilds().get(actualGuildId)
if(!socketUser.identity.id === guild.owner) return IOAnswer("/OWNER/ROLES/SET", false)
await serverSettings.setSecureRole(actualGuildId, data)
IOAnswer("/OWNER/ROLES/SET", true)
})
// CHECKED : 24/04/2025 // CHECKED : 24/04/2025
IORequest("/MOD/USERS/BAN", async (userId) => { IORequest("/MOD/USERS/BAN", async (userId) => {
@@ -873,9 +901,9 @@ function init() {
// Functions // Functions
function getUserChannel(usual) { function getUserChannel(usual, force) {
const botChannel = getBotChannel() const botChannel = getBotChannel()
if(botChannel) { if(botChannel && !force) {
return botChannel return botChannel
} }
const membersVoices = discordBot.getMembersVoices() const membersVoices = discordBot.getMembersVoices()
@@ -907,6 +935,18 @@ function init() {
const guildData = guild[1] const guildData = guild[1]
guildData['members'] = new Array() guildData['members'] = new Array()
guildData.serverMember = guild[1].allMembers.length guildData.serverMember = guild[1].allMembers.length
guildData.restricted = false
const secureRole = serverSettings.getSecureRole(guild[0])
if(secureRole && socketUser.identity.id !== discordBot.getGuilds().get(guild[0]).owner) {
const member = discordBot.getGuildMember(guild[0], socketUser.identity.id)
if(!member.roles.cache.has(secureRole.id) && socketUser.identity.id !== guild[1].owner && !socketUser.isAdmin()) {
guildData.restricted = true
} else {
guildData.restricted = false
}
}
guildData.allowed = true
for(var user of guildConnectedUsers.get(guild[0]) || []) { for(var user of guildConnectedUsers.get(guild[0]) || []) {
const userData = users.getUserById(user.id) const userData = users.getUserById(user.id)
if(userData && userData.identity.id != socketUser.identity.id) { if(userData && userData.identity.id != socketUser.identity.id) {
@@ -986,6 +1026,15 @@ function init() {
wlog.warn("Aucun guildId n'est actif pour l'utilisateur : " + socketUser.identity.username) wlog.warn("Aucun guildId n'est actif pour l'utilisateur : " + socketUser.identity.username)
return false return false
} }
// Check role if secure role is set
const secureRole = serverSettings.getSecureRole(guildId)
if(secureRole && socketUser.identity.id !== discordBot.getGuilds().get(guildId).owner) {
const member = discordBot.getGuildMember(guildId, socketUser.identity.id)
if(member.roles.cache.has(secureRole.id) == false) {
wlog.warn("L'utilisateur '" + socketUser.identity.username + "' n'a pas le rôle requis pour accéder à la guilde : " + guildId)
return false
}
}
// Check if the guildId is referenced in the bot guilds // Check if the guildId is referenced in the bot guilds
if(!discordBot.getGuilds().has(guildId)) { if(!discordBot.getGuilds().has(guildId)) {
wlog.warn("La guilde : " + guildId + " n'est pas référencée dans le bot") wlog.warn("La guilde : " + guildId + " n'est pas référencée dans le bot")

View File

@@ -15,9 +15,11 @@ const __glob = {
PLAYLISTFILE: root + path.sep + "data" + path.sep + "playlists.json", PLAYLISTFILE: root + path.sep + "data" + path.sep + "playlists.json",
HISTORY_DB: root + path.sep + "data" + path.sep + "history.json", HISTORY_DB: root + path.sep + "data" + path.sep + "history.json",
MEDIA_DB: root + path.sep + "data" + path.sep + "media.json", MEDIA_DB: root + path.sep + "data" + path.sep + "media.json",
SERVER_DB: root + path.sep + "data" + path.sep + "servers.json",
VERSION: version, VERSION: version,
CHANGELOG_PATH: root + path.sep + "CHANGELOG.html", CHANGELOG_PATH: root + path.sep + "CHANGELOG.html",
COOKIES: root + path.sep + "data" + path.sep + "cookies.json" COOKIES: root + path.sep + "data" + path.sep + "cookies.json",
PROXY: root + path.sep + "data" + path.sep + "proxy.json"
} }
module.exports = {__glob} module.exports = {__glob}