1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 00:23:17 +00:00

Fixed after christer. Updated dev only commands.

This commit is contained in:
MatteZ02 2019-11-01 13:39:04 +02:00
parent ac96a99e1c
commit 2d8143cea5
23 changed files with 57 additions and 49 deletions

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Report a bug', description: 'Report a bug',
alias: 'bug', alias: 'bug',
cooldown: 5, cooldown: 5,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`) .setTitle(`Found a bug with ${client.user.username}?\nDM the core developer:`)

View File

@ -3,13 +3,13 @@ module.exports = {
description: 'Evaluation command', description: 'Evaluation command',
alias: 'eval', alias: 'eval',
cooldown: 5, cooldown: 5,
onlyDev: true,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
if (serverQueue) { if (serverQueue) {
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); 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); const input = message.content.slice(prefix.length + 4);
let output; let output;
try { try {

View File

@ -3,8 +3,8 @@ module.exports = {
description: 'force stop command.', description: 'force stop command.',
alias: 'fs', alias: 'fs',
cooldown: 5, cooldown: 5,
onlyDev: true,
execute(message, args, client, Discord, prefix) { 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); client.queue.delete(message.guild.id);
message.channel.send('queue deleted') message.channel.send('queue deleted')
} }

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Help command.', description: 'Help command.',
alias: 'help', alias: 'help',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle('Commands for Musix!') .setTitle('Commands for Musix!')

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Invite command.', description: 'Invite command.',
alias: 'invite', alias: 'invite',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle('Invite Musix to your Discord server!') .setTitle('Invite Musix to your Discord server!')

View File

@ -3,12 +3,13 @@ module.exports = {
description: 'loop command.', description: 'loop command.',
alias: 'loop', alias: 'loop',
cooldown: 10, cooldown: 10,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
const permissions = message.channel.permissionsFor(message.author); const permissions = message.channel.permissionsFor(message.author);
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
if (serverQueue) { 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 (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].permissions === true) {
if (client.global.db.guilds[message.guild.id].dj) { if (client.global.db.guilds[message.guild.id].dj) {

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Now playing command.', description: 'Now playing command.',
alias: 'np', alias: 'np',
cooldown: 5, cooldown: 5,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);

View File

@ -3,13 +3,14 @@ module.exports = {
description: 'Pause command.', description: 'Pause command.',
alias: 'pause', alias: 'pause',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
const permissions = message.channel.permissionsFor(message.author); const permissions = message.channel.permissionsFor(message.author);
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
if (serverQueue && serverQueue.playing === true) { 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 (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].permissions === true) {
if (client.global.db.guilds[message.guild.id].dj) { 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!'); 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!');

View File

@ -8,6 +8,7 @@ module.exports = {
alias: 'p', alias: 'p',
args: true, args: true,
cooldown: 3, cooldown: 3,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const youtube = new YouTube(client.config.apikey); const youtube = new YouTube(client.config.apikey);
const searchString = args.slice(1).join(" "); const searchString = args.slice(1).join(" ");

View File

@ -7,6 +7,7 @@ module.exports = {
description: 'Save and load queues', description: 'Save and load queues',
alias: 'pl', alias: 'pl',
cooldown: 10, cooldown: 10,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle('Options for playlist!') .setTitle('Options for playlist!')
@ -19,7 +20,7 @@ module.exports = {
.setAuthor(client.user.username, client.user.displayAvatarURL) .setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor('#b50002') .setColor('#b50002')
const permissions = message.channel.permissionsFor(message.author); 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 (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!'); 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!'); } else if (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to modify the playlist!');

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Queue command.', description: 'Queue command.',
alias: 'q', alias: 'q',
cooldown: 5, cooldown: 5,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
if (!serverQueue) return message.channel.send(':x: There is nothing playing.'); if (!serverQueue) return message.channel.send(':x: There is nothing playing.');

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Remove command.', description: 'Remove command.',
alias: 'rm', alias: 'rm',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
const serverQueue = client.queue.get(message.guild.id); 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 (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 === 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 (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 (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 (client.global.db.guilds[message.guild.id].dj) {
if (serverQueue.songs[pos].author !== message.author) { if (serverQueue.songs[pos].author !== message.author) {

View File

@ -3,12 +3,13 @@ module.exports = {
description: 'Resume command.', description: 'Resume command.',
alias: 'resume', alias: 'resume',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
const permissions = message.channel.permissionsFor(message.author); const permissions = message.channel.permissionsFor(message.author);
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
if (serverQueue && !serverQueue.playing) { 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 (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].permissions === true) {
if (client.global.db.guilds[message.guild.id].dj) { if (client.global.db.guilds[message.guild.id].dj) {

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'seek command.', description: 'seek command.',
alias: 'seek', alias: 'seek',
cooldown: 10, cooldown: 10,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const ytdl = require('ytdl-core'); const ytdl = require('ytdl-core');
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
@ -10,7 +11,7 @@ module.exports = {
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url)); let data = await Promise.resolve(ytdl.getInfo(serverQueue.songs[0].url));
if (serverQueue) { 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!'); 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 (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) { if (client.global.db.guilds[message.guild.id].permissions === true) {

View File

@ -4,6 +4,7 @@ module.exports = {
description: 'Change the settings', description: 'Change the settings',
alias: 'settings', alias: 'settings',
cooldown: 10, cooldown: 10,
onlyDev: false,
async execute(message, args, client, Discord, prefix) { async execute(message, args, client, Discord, prefix) {
const embed = new Discord.RichEmbed() const embed = new Discord.RichEmbed()
.setTitle('Guild settings for Musix') .setTitle('Guild settings for Musix')
@ -16,7 +17,7 @@ module.exports = {
.setAuthor(client.user.username, client.user.displayAvatarURL) .setAuthor(client.user.username, client.user.displayAvatarURL)
.setColor('#b50002') .setColor('#b50002')
const permissions = message.channel.permissionsFor(message.author); 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 (!permissions.has('MANAGE_GUILD')) return message.channel.send(':x: You need the `MANAGE_SERVER` permission to change the settings!');
} }
if (args[1]) { if (args[1]) {

View 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!');
}
};

View File

@ -3,12 +3,13 @@ module.exports = {
description: 'Skip command.', description: 'Skip command.',
alias: 'skip', alias: 'skip',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
const permissions = message.channel.permissionsFor(message.author); 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 (!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 (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].permissions === true) {
if (client.global.db.guilds[message.guild.id].dj) { if (client.global.db.guilds[message.guild.id].dj) {

View File

@ -3,6 +3,7 @@ module.exports = {
description: 'Status command.', description: 'Status command.',
alias: 'status', alias: 'status',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
let rawUptime = client.uptime; let rawUptime = client.uptime;
let uptime = {}; let uptime = {};

View File

@ -3,11 +3,12 @@ module.exports = {
description: 'Stop command.', description: 'Stop command.',
alias: 'stop', alias: 'stop',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
const permissions = message.channel.permissionsFor(message.author); 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 (!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 (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) { if (client.global.db.guilds[message.guild.id].permissions === true) {

View File

@ -3,15 +3,15 @@ module.exports = {
description: 'Volume command.', description: 'Volume command.',
alias: 'volume', alias: 'volume',
cooldown: 5, cooldown: 5,
onlyDev: false,
execute(message, args, client, Discord, prefix) { execute(message, args, client, Discord, prefix) {
const { voiceChannel } = message.member; const { voiceChannel } = message.member;
const serverQueue = client.queue.get(message.guild.id); const serverQueue = client.queue.get(message.guild.id);
const permissions = message.channel.permissionsFor(message.author); 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 (!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}**`); if (!args[1]) return message.channel.send(`:loud_sound: The current volume is: **${serverQueue.volume}**`);
const volume = parseFloat(args[1]); 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 (!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].permissions === true) {
if (client.global.db.guilds[message.guild.id].dj) { if (client.global.db.guilds[message.guild.id].dj) {

7
config/config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
token: process.env.TOKEN,
api_key: process.env.API_KEY,
debug_channel: "634718645188034560",
dev: "360363051792203779",
prefix: ">"
}

View File

@ -2,47 +2,24 @@ module.exports = {
name: 'message', name: 'message',
async execute(client, message, Discord) { async execute(client, message, Discord) {
if (message.author.bot || !message.guild) return; 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; let prefix = client.global.db.guilds[message.guild.id].prefix;
const args = message.content.slice(prefix.length).split(' '); const args = message.content.slice(prefix.length).split(' ');
let commandName;
if (message.mentions.users.first()) { if (message.mentions.users.first()) {
if (message.mentions.users.first().id === client.user.id) { if (message.mentions.users.first().id === client.user.id) {
if (!args[1]) return; if (!args[1]) return;
if (args[1] === 'prefix') return message.channel.send(`My prefix here is: \`${prefix}\`.`); if (args[1] === 'prefix') return message.channel.send(`My prefix here is: \`${prefix}\`.`);
commandName = args[1].toLowerCase(); if (args[1] === 'help') {
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName); const command = client.commands.get("help");
client.funcs.exe(message, args, client, Discord, prefix, command); return client.funcs.exe(message, args, client, Discord, prefix, command);
}
} }
} }
if (!message.content.startsWith(prefix)) return; if (!message.content.startsWith(prefix)) return;
if (!args[0]) 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); 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 && 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); client.funcs.exe(message, args, client, Discord, prefix, command);
} }
} }

View File

@ -37,13 +37,7 @@ client.funcs.msToTime = require('./funcs/msToTime.js');
client.funcs.dbget = require('./funcs/dbget.js'); client.funcs.dbget = require('./funcs/dbget.js');
client.funcs.exe = require('./funcs/exe.js'); client.funcs.exe = require('./funcs/exe.js');
client.config = { client.config = require('./config/config.js');
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
};
const commandFiles = fs.readdirSync('./commands/').filter(f => f.endsWith('.js')); const commandFiles = fs.readdirSync('./commands/').filter(f => f.endsWith('.js'));
for (const file of commandFiles) { for (const file of commandFiles) {