New Version to add Auto Detection of User
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Subsonics - Pipeline/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Subsonics - Pipeline/pipeline/head This commit looks good
				
			This commit is contained in:
		
							
								
								
									
										22
									
								
								src/main.js
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								src/main.js
									
									
									
									
									
								
							@@ -7,6 +7,7 @@ if ("ENV" in process.env) {
 | 
				
			|||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const log = require("./sublog.js")
 | 
					const log = require("./sublog.js")
 | 
				
			||||||
 | 
					var membersVoices = new Map()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const nodes = [
 | 
					const nodes = [
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -28,10 +29,12 @@ function startDiscordBot() {
 | 
				
			|||||||
    const path = require("path")
 | 
					    const path = require("path")
 | 
				
			||||||
    const { Manager  } = require("erela.js")
 | 
					    const { Manager  } = require("erela.js")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const client = new Client({
 | 
					    const client = new Client({
 | 
				
			||||||
        intents:[GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMembers]
 | 
					        intents:[GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates, GatewayIntentBits.GuildMembers],
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    client.commands = new Collection()
 | 
					    client.commands = new Collection()
 | 
				
			||||||
    client.dictator = false;
 | 
					    client.dictator = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -80,7 +83,6 @@ function startDiscordBot() {
 | 
				
			|||||||
    client.once("ready", () => {
 | 
					    client.once("ready", () => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        log.bot("Le meilleur groupe de musique est prêt !")
 | 
					        log.bot("Le meilleur groupe de musique est prêt !")
 | 
				
			||||||
        client.user.setActivity(`beaucoup de choses !`, { type: "LISTENING" })
 | 
					 | 
				
			||||||
        client.manager.init(client.user.id);
 | 
					        client.manager.init(client.user.id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const commandManager = client.application.commands;
 | 
					        const commandManager = client.application.commands;
 | 
				
			||||||
@@ -96,6 +98,8 @@ function startDiscordBot() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    client.on("voiceStateUpdate", (oldMember, newMember) => {
 | 
					    client.on("voiceStateUpdate", (oldMember, newMember) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        membersVoices.set(newMember.id, newMember.channelId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let player = client.manager.players.get(oldMember.guild.id)
 | 
					        let player = client.manager.players.get(oldMember.guild.id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(player) {
 | 
					        if(player) {
 | 
				
			||||||
@@ -272,12 +276,21 @@ function startServer(client) {
 | 
				
			|||||||
                  
 | 
					                  
 | 
				
			||||||
                    let player = client.manager.players.get("137291455336022018")
 | 
					                    let player = client.manager.players.get("137291455336022018")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    var voiceChannel = "664355808250953739"
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    if(membersVoices.has(users.get(token).id) &&  membersVoices.get(users.get(token).id) != null) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                        voiceChannel = membersVoices.get(users.get(token).id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                      
 | 
				
			||||||
                     if(!player) { 
 | 
					                     if(!player) { 
 | 
				
			||||||
                    
 | 
					                    
 | 
				
			||||||
                        player = client.manager.create({
 | 
					                        player = client.manager.create({
 | 
				
			||||||
                        guild: "137291455336022018",
 | 
					                        guild: "137291455336022018",
 | 
				
			||||||
                        voiceChannel: "664355808250953739",
 | 
					                        voiceChannel: voiceChannel,
 | 
				
			||||||
                        textChannel: "664355808250953739",
 | 
					                        textChannel: voiceChannel,
 | 
				
			||||||
                        });
 | 
					                        });
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
                        player.connect();
 | 
					                        player.connect();
 | 
				
			||||||
@@ -362,6 +375,7 @@ function startServer(client) {
 | 
				
			|||||||
               
 | 
					               
 | 
				
			||||||
                log.server("Mise en Play / Pause demandé par " + users.get(token).username + "#" +  users.get(token).discriminator)
 | 
					                log.server("Mise en Play / Pause demandé par " + users.get(token).username + "#" +  users.get(token).discriminator)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                let player = client.manager.players.get("137291455336022018")
 | 
					                let player = client.manager.players.get("137291455336022018")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if(player && player.playing == true && player.paused == false) {
 | 
					                if(player && player.playing == true && player.paused == false) {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										187
									
								
								src/tokens.json
									
									
									
									
									
								
							
							
						
						
									
										187
									
								
								src/tokens.json
									
									
									
									
									
								
							@@ -253,5 +253,192 @@
 | 
				
			|||||||
    "mfa_enabled": true,
 | 
					    "mfa_enabled": true,
 | 
				
			||||||
    "premium_type": 0,
 | 
					    "premium_type": 0,
 | 
				
			||||||
    "avatar_decoration": null
 | 
					    "avatar_decoration": null
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "39faa9aa-e569-498b-8a7f-0dc59a871499": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "3c1e29d2-5678-4799-a658-6a4b2c928a4e": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "a4e19e96-9810-410b-a8c4-9952c334d2f0": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "af666d26-811e-4bb6-832f-aef39dec9578": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "fe83ad11-88c5-4642-96ec-d115ce3346bf": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "e9dc3b80-44d2-4caf-a688-b37af348518a": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "bcd84469-7d83-4343-ae87-5f2d28e4d2ce": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "bf7dcd93-9efe-40f4-9037-aef9dfea6a5c": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "867f8379-3927-42b2-85e8-4df3ced2eddb": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "75a3e38c-eed5-462c-bde8-067dd16ca391": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  "d35acbb8-4a3b-4286-8df6-2ab61cb2c74e": {
 | 
				
			||||||
 | 
					    "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
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user