mirror of
				https://github.com/musix-org/musix-oss
				synced 2025-10-31 21:01:36 +00:00 
			
		
		
		
	Fixed after christer. Updated dev only commands.
This commit is contained in:
		| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'Report a bug', | ||||
|     alias: 'bug', | ||||
|     cooldown: 5, | ||||
|     onlyDev: false, | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         const embed = new Discord.RichEmbed() | ||||
|             .setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`) | ||||
|   | ||||
| @@ -3,13 +3,13 @@ module.exports = { | ||||
|     description: 'Evaluation command', | ||||
|     alias: 'eval', | ||||
|     cooldown: 5, | ||||
|     onlyDev: true, | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         const ytdl = require('ytdl-core'); | ||||
|         const serverQueue = client.queue.get(message.guild.id); | ||||
|         if (serverQueue) { | ||||
|             let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); | ||||
|         } | ||||
|         if (message.author.id !== client.config.devId) return message.channel.send(':x: You are not allowed to do that!'); | ||||
|         const input = message.content.slice(prefix.length + 4); | ||||
|         let output; | ||||
|         try { | ||||
|   | ||||
| @@ -3,8 +3,8 @@ module.exports = { | ||||
|     description: 'force stop command.', | ||||
|     alias: 'fs', | ||||
|     cooldown: 5, | ||||
|     onlyDev: true, | ||||
|     execute(message, args, client, Discord, prefix) { | ||||
|         if (message.author.id !== client.config.devId) return message.channel.send(':x: You are not allowed to do that!') | ||||
|         client.queue.delete(message.guild.id); | ||||
|         message.channel.send('queue deleted') | ||||
|     } | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'Help command.', | ||||
|     alias: 'help', | ||||
|     cooldown: 5, | ||||
|     onlyDev: false, | ||||
|     execute(message, args, client, Discord, prefix) { | ||||
|         const embed = new Discord.RichEmbed() | ||||
|             .setTitle('Commands for Musix!') | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'Invite command.', | ||||
|     alias: 'invite', | ||||
|     cooldown: 5, | ||||
|     onlyDev: false, | ||||
|     execute(message, args, client, Discord, prefix) { | ||||
|         const embed = new Discord.RichEmbed() | ||||
|             .setTitle('Invite Musix to your Discord server!') | ||||
|   | ||||
| @@ -3,12 +3,13 @@ module.exports = { | ||||
|     description: 'loop command.', | ||||
|     alias: 'loop', | ||||
|     cooldown: 10, | ||||
|     onlyDev: false, | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         const serverQueue = client.queue.get(message.guild.id); | ||||
|         const permissions = message.channel.permissionsFor(message.author); | ||||
|         const { voiceChannel } = message.member; | ||||
|         if (serverQueue) { | ||||
|             if (message.author.id !== client.config.devId) { | ||||
|             if (message.author.id !== client.config.dev) { | ||||
|                 if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!'); | ||||
|                 if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
|                     if (client.global.db.guilds[message.guild.id].dj) { | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'Now playing command.', | ||||
|     alias: 'np', | ||||
|     cooldown: 5, | ||||
|     onlyDev: false, | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         const ytdl = require('ytdl-core'); | ||||
|         const serverQueue = client.queue.get(message.guild.id); | ||||
|   | ||||
| @@ -3,13 +3,14 @@ module.exports = { | ||||
| 	description: 'Pause command.', | ||||
| 	alias: 'pause', | ||||
| 	cooldown: 5, | ||||
| 	onlyDev: false, | ||||
| 	execute(message, args, client, Discord, prefix) { | ||||
| 		const serverQueue = client.queue.get(message.guild.id); | ||||
| 		const permissions = message.channel.permissionsFor(message.author); | ||||
| 		const { voiceChannel } = message.member; | ||||
| 		if (serverQueue && serverQueue.playing === true) { | ||||
| 			if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to pause the music!'); | ||||
| 			if (message.author.id !== client.config.devId) { | ||||
| 			if (message.author.id !== client.config.dev) { | ||||
| 				if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
| 					if (client.global.db.guilds[message.guild.id].dj) { | ||||
| 						if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to pause the music!'); | ||||
|   | ||||
| @@ -8,6 +8,7 @@ module.exports = { | ||||
| 	alias: 'p', | ||||
| 	args: true, | ||||
| 	cooldown: 3, | ||||
| 	onlyDev: false, | ||||
| 	async execute(message, args, client, Discord, prefix) { | ||||
| 		const youtube = new YouTube(client.config.apikey); | ||||
| 		const searchString = args.slice(1).join(" "); | ||||
|   | ||||
| @@ -7,6 +7,7 @@ module.exports = { | ||||
|     description: 'Save and load queues', | ||||
|     alias: 'pl', | ||||
|     cooldown: 10, | ||||
|     onlyDev: false, | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         const embed = new Discord.RichEmbed() | ||||
|             .setTitle('Options for playlist!') | ||||
| @@ -19,7 +20,7 @@ module.exports = { | ||||
|             .setAuthor(client.user.username, client.user.displayAvatarURL) | ||||
|             .setColor('#b50002') | ||||
|         const permissions = message.channel.permissionsFor(message.author); | ||||
|         if (message.author.id !== client.config.devId) { | ||||
|         if (message.author.id !== client.config.dev) { | ||||
|             if (client.global.db.guilds[message.guild.id].dj) { | ||||
|                 if (!message.member.roles.has(client.global.db.guilds[message.guild.id].djrole)) return message.channel.send(':x: You need the `DJ` role to modify or play the playlist!'); | ||||
|             } else if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!'); | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
| 	description: 'Queue command.', | ||||
| 	alias: 'q', | ||||
| 	cooldown: 5, | ||||
| 	onlyDev: false, | ||||
| 	async execute(message, args, client, Discord, prefix) { | ||||
| 		const serverQueue = client.queue.get(message.guild.id); | ||||
| 		if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'Remove command.', | ||||
|     alias: 'rm', | ||||
|     cooldown: 5, | ||||
|     onlyDev: false, | ||||
|     execute(message, args, client, Discord, prefix) { | ||||
|         const { voiceChannel } = message.member; | ||||
|         const serverQueue = client.queue.get(message.guild.id); | ||||
| @@ -13,7 +14,7 @@ module.exports = { | ||||
|         if (isNaN(pos)) return message.channel.send(':x: You need to enter a number!'); | ||||
|         if (pos === 0) return message.channel.send(':x: You can not remove the currently playing song!'); | ||||
|         if (pos > serverQueue.songs.size) return message.channel.send(`:x: There is only ${serverQueue.songs.size} amount of songs in the queue!`); | ||||
|         if (message.author.id !== client.config.devId) { | ||||
|         if (message.author.id !== client.config.dev) { | ||||
|             if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to remove songs!'); | ||||
|             if (client.global.db.guilds[message.guild.id].dj) { | ||||
|                 if (serverQueue.songs[pos].author !== message.author) { | ||||
|   | ||||
| @@ -3,12 +3,13 @@ module.exports = { | ||||
| 	description: 'Resume command.', | ||||
| 	alias: 'resume', | ||||
| 	cooldown: 5, | ||||
| 	onlyDev: false, | ||||
| 	execute(message, args, client, Discord, prefix) { | ||||
| 		const serverQueue = client.queue.get(message.guild.id); | ||||
| 		const permissions = message.channel.permissionsFor(message.author); | ||||
| 		const { voiceChannel } = message.member; | ||||
| 		if (serverQueue && !serverQueue.playing) { | ||||
| 			if (message.author.id !== client.config.devId) { | ||||
| 			if (message.author.id !== client.config.dev) { | ||||
| 				if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to loop the queue!'); | ||||
| 				if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
| 					if (client.global.db.guilds[message.guild.id].dj) { | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'seek command.', | ||||
|     alias: 'seek', | ||||
|     cooldown: 10, | ||||
|     onlyDev: false, | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         const ytdl = require('ytdl-core'); | ||||
|         const serverQueue = client.queue.get(message.guild.id); | ||||
| @@ -10,7 +11,7 @@ module.exports = { | ||||
|         const { voiceChannel } = message.member; | ||||
|         let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); | ||||
|         if (serverQueue) { | ||||
|             if (message.author.id !== client.config.devId) { | ||||
|             if (message.author.id !== client.config.dev) { | ||||
|                 return message.channel.send(':x: This command is currently disabled!'); | ||||
|                 if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to seek the song!'); | ||||
|                 if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
|   | ||||
| @@ -4,6 +4,7 @@ module.exports = { | ||||
|   description: 'Change the settings', | ||||
|   alias: 'settings', | ||||
|   cooldown: 10, | ||||
|   onlyDev: false, | ||||
|   async execute(message, args, client, Discord, prefix) { | ||||
|     const embed = new Discord.RichEmbed() | ||||
|       .setTitle('Guild settings for Musix') | ||||
| @@ -16,7 +17,7 @@ module.exports = { | ||||
|       .setAuthor(client.user.username, client.user.displayAvatarURL) | ||||
|       .setColor('#b50002') | ||||
|     const permissions = message.channel.permissionsFor(message.author); | ||||
|     if (message.author.id !== client.config.devId) { | ||||
|     if (message.author.id !== client.config.dev) { | ||||
|       if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to change the settings!'); | ||||
|     } | ||||
|     if (args[1]) { | ||||
|   | ||||
							
								
								
									
										14
									
								
								commands/settings/reset.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								commands/settings/reset.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,14 @@ | ||||
| module.exports = { | ||||
|     name: 'reset', | ||||
|     async execute(message, args, client, Discord, prefix) { | ||||
|         client.global.db.guilds[message.guild.id] = { | ||||
|             prefix: client.config.prefix, | ||||
|             defaultVolume: 5, | ||||
|             permissions: false, | ||||
|             premium: false, | ||||
|             dj: false, | ||||
|             djrole: null | ||||
|         }; | ||||
|         message.channel.send(':white_check_mark: Reset __all__ guild settings!'); | ||||
|     } | ||||
| }; | ||||
| @@ -3,12 +3,13 @@ module.exports = { | ||||
| 	description: 'Skip command.', | ||||
| 	alias: 'skip', | ||||
| 	cooldown: 5, | ||||
| 	onlyDev: false, | ||||
| 	execute(message, args, client, Discord, prefix) { | ||||
| 		const { voiceChannel } = message.member; | ||||
| 		const serverQueue = client.queue.get(message.guild.id); | ||||
| 		const permissions = message.channel.permissionsFor(message.author); | ||||
| 		if (!serverQueue) return message.channel.send(':x: There is nothing playing that I could skip for you.'); | ||||
| 		if (message.author.id !== client.config.devId) { | ||||
| 		if (message.author.id !== client.config.dev) { | ||||
| 			if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to skip the song!'); | ||||
| 			if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
| 				if (client.global.db.guilds[message.guild.id].dj) { | ||||
|   | ||||
| @@ -3,6 +3,7 @@ module.exports = { | ||||
|     description: 'Status command.', | ||||
|     alias: 'status', | ||||
|     cooldown: 5, | ||||
|     onlyDev: false, | ||||
|     execute(message, args, client, Discord, prefix) { | ||||
|         let rawUptime = client.uptime; | ||||
|         let uptime = {}; | ||||
|   | ||||
| @@ -3,11 +3,12 @@ module.exports = { | ||||
| 	description: 'Stop command.', | ||||
| 	alias: 'stop', | ||||
| 	cooldown: 5, | ||||
| 	onlyDev: false, | ||||
| 	execute(message, args, client, Discord, prefix) { | ||||
| 		const { voiceChannel } = message.member; | ||||
| 		const serverQueue = client.queue.get(message.guild.id); | ||||
| 		const permissions = message.channel.permissionsFor(message.author); | ||||
| 		if (message.author.id !== client.config.devId) { | ||||
| 		if (message.author.id !== client.config.dev) { | ||||
| 			if (!serverQueue) return message.channel.send(':x: There is nothing playing that I could stop for you.'); | ||||
| 			if (voiceChannel !== serverQueue.voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in the same voice channel as Musix to stop the music!'); | ||||
| 			if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
|   | ||||
| @@ -3,15 +3,15 @@ module.exports = { | ||||
| 	description: 'Volume command.', | ||||
| 	alias: 'volume', | ||||
| 	cooldown: 5, | ||||
| 	onlyDev: false, | ||||
| 	execute(message, args, client, Discord, prefix) { | ||||
| 		const { voiceChannel } = message.member; | ||||
| 		const serverQueue = client.queue.get(message.guild.id); | ||||
| 		const permissions = message.channel.permissionsFor(message.author); | ||||
| 		if (message.author.id === '384002606621655040') return message.channel.send('You are not doying that!'); | ||||
| 		if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); | ||||
| 		if (!args[1]) return message.channel.send(`:loud_sound: The current volume is: **${serverQueue.volume}**`); | ||||
| 		const volume = parseFloat(args[1]); | ||||
| 		if (message.author.id !== client.config.devId) { | ||||
| 		if (message.author.id !== client.config.dev) { | ||||
| 			if (!voiceChannel) return message.channel.send(':x: I\'m sorry but you need to be in a voice channel to change the volume!'); | ||||
| 			if (client.global.db.guilds[message.guild.id].permissions === true) { | ||||
| 				if (client.global.db.guilds[message.guild.id].dj) { | ||||
|   | ||||
							
								
								
									
										7
									
								
								config/config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								config/config.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| module.exports = { | ||||
|     token: process.env.TOKEN, | ||||
|     api_key: process.env.API_KEY, | ||||
|     debug_channel: "634718645188034560", | ||||
|     dev: "360363051792203779", | ||||
|     prefix: ">" | ||||
| } | ||||
| @@ -2,47 +2,24 @@ module.exports = { | ||||
|     name: 'message', | ||||
|     async execute(client, message, Discord) { | ||||
|         if (message.author.bot || !message.guild) return; | ||||
|         if (message.content === '->reset' && message.author.id === client.config.devId) { | ||||
|             client.guilds.forEach(guild => { | ||||
|                 client.global.db.guilds[guild.id] = { | ||||
|                     prefix: client.config.prefix, | ||||
|                     defaultVolume: 5, | ||||
|                     permissions: false, | ||||
|                     premium: false, | ||||
|                     dj: false, | ||||
|                     djrole: null | ||||
|                 }; | ||||
|                 return message.channel.send(':white_check_mark: Reset all guild settings for __all__ guilds!'); | ||||
|             }); | ||||
|             return message.channel.send(':white_check_mark: Reset all guild settings!') | ||||
|         } else if (message.content === '->resetguildsettings' && message.author.id === client.config.devId) { | ||||
|             client.global.db.guilds[message.guild.id] = { | ||||
|                 prefix: client.config.prefix, | ||||
|                 defaultVolume: 5, | ||||
|                 permissions: false, | ||||
|                 premium: false, | ||||
|                 dj: false, | ||||
|                 djrole: null | ||||
|             }; | ||||
|             return message.channel.send(':white_check_mark: Reset all guild settings for this guild!'); | ||||
|         } | ||||
|         let prefix = client.global.db.guilds[message.guild.id].prefix; | ||||
|         const args = message.content.slice(prefix.length).split(' '); | ||||
|         let commandName; | ||||
|         if (message.mentions.users.first()) { | ||||
|             if (message.mentions.users.first().id === client.user.id) { | ||||
|                 if (!args[1]) return; | ||||
|                 if (args[1] === 'prefix') return message.channel.send(`My prefix here is: \`${prefix}\`.`); | ||||
|                 commandName = args[1].toLowerCase(); | ||||
|                 const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName); | ||||
|                 client.funcs.exe(message, args, client, Discord, prefix, command); | ||||
|                 if (args[1] === 'help') { | ||||
|                     const command = client.commands.get("help"); | ||||
|                     return client.funcs.exe(message, args, client, Discord, prefix, command); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         if (!message.content.startsWith(prefix)) return; | ||||
|         if (!args[0]) return; | ||||
|         commandName = args[0].toLowerCase(); | ||||
|         const commandName = args[0].toLowerCase(); | ||||
|         const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName); | ||||
|         if (!command && message.content !== `${prefix}`) return; | ||||
|         if (command.onlyDev && message.author.id !== client.config.dev) return message.channel.send(':x: You are not allowed to do that!'); | ||||
|         client.funcs.exe(message, args, client, Discord, prefix, command); | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										8
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								index.js
									
									
									
									
									
								
							| @@ -37,13 +37,7 @@ client.funcs.msToTime = require('./funcs/msToTime.js'); | ||||
| client.funcs.dbget = require('./funcs/dbget.js'); | ||||
| client.funcs.exe = require('./funcs/exe.js'); | ||||
|  | ||||
| client.config = { | ||||
|   token: process.env.DISCORD_TOKEN, | ||||
|   debug_channel: process.env.DISCORD_DEBUG_CHANNEL_ID, | ||||
|   apikey: process.env.YOUTUBE_KEY, | ||||
|   devId: process.env.DISCORD_DEV_UID, | ||||
|   prefix: process.env.PREFIX | ||||
| }; | ||||
| client.config = require('./config/config.js'); | ||||
|  | ||||
| const commandFiles = fs.readdirSync('./commands/').filter(f => f.endsWith('.js')); | ||||
| for (const file of commandFiles) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MatteZ02
					MatteZ02