2019-09-15 06:18:33 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'message',
|
2019-10-10 13:43:04 +00:00
|
|
|
async execute(client, message, Discord) {
|
2019-09-15 06:18:33 +00:00
|
|
|
if (message.author.bot || !message.guild) return;
|
2019-10-31 18:29:26 +00:00
|
|
|
if (message.content === '->reset' && message.author.id === client.global.devId) {
|
2019-10-10 13:43:04 +00:00
|
|
|
client.guilds.forEach(guild => {
|
2019-10-11 08:48:50 +00:00
|
|
|
client.global.db.guilds[guild.id] = {
|
2019-10-31 18:29:26 +00:00
|
|
|
prefix: client.config.prefix,
|
2019-10-10 13:43:04 +00:00
|
|
|
defaultVolume: 5,
|
2019-10-11 08:48:50 +00:00
|
|
|
permissions: false,
|
2019-10-12 14:40:00 +00:00
|
|
|
premium: false,
|
2019-10-13 07:33:59 +00:00
|
|
|
dj: false,
|
|
|
|
djrole: null
|
2019-10-10 13:43:04 +00:00
|
|
|
};
|
2019-10-31 18:29:26 +00:00
|
|
|
return message.channel.send(':white_check_mark: Reset all guild settings for __all__ guilds!');
|
2019-10-10 13:43:04 +00:00
|
|
|
});
|
|
|
|
return message.channel.send(':white_check_mark: Reset all guild settings!')
|
2019-10-31 18:29:26 +00:00
|
|
|
} else if (message.content === '->resetguildsettings' && message.author.id === client.global.devId) {
|
2019-10-11 08:48:50 +00:00
|
|
|
client.global.db.guilds[message.guild.id] = {
|
2019-10-31 18:29:26 +00:00
|
|
|
prefix: client.config.prefix,
|
2019-10-10 13:43:04 +00:00
|
|
|
defaultVolume: 5,
|
2019-10-11 08:48:50 +00:00
|
|
|
permissions: false,
|
2019-10-12 14:40:00 +00:00
|
|
|
premium: false,
|
2019-10-13 07:33:59 +00:00
|
|
|
dj: false,
|
|
|
|
djrole: null
|
2019-10-10 13:43:04 +00:00
|
|
|
};
|
2019-10-31 18:29:26 +00:00
|
|
|
return message.channel.send(':white_check_mark: Reset all guild settings for this guild!');
|
2019-10-10 13:43:04 +00:00
|
|
|
}
|
2019-10-13 18:08:04 +00:00
|
|
|
let prefix = client.global.db.guilds[message.guild.id].prefix;
|
2019-10-10 13:43:04 +00:00
|
|
|
const args = message.content.slice(prefix.length).split(' ');
|
2019-10-31 18:29:26 +00:00
|
|
|
let commandName;
|
2019-09-15 06:18:33 +00:00
|
|
|
if (message.mentions.users.first()) {
|
2019-10-31 18:29:26 +00:00
|
|
|
if (message.mentions.users.first().id === client.config.botId) {
|
|
|
|
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);
|
|
|
|
}
|
2019-09-15 06:18:33 +00:00
|
|
|
}
|
2019-10-11 11:30:10 +00:00
|
|
|
if (!message.content.startsWith(prefix)) return;
|
2019-09-15 06:18:33 +00:00
|
|
|
if (!args[0]) return;
|
2019-10-31 18:29:26 +00:00
|
|
|
commandName = args[0].toLowerCase();
|
|
|
|
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
|
2019-09-15 06:18:33 +00:00
|
|
|
if (!command && message.content !== `${prefix}`) return;
|
2019-10-31 18:29:26 +00:00
|
|
|
client.funcs.exe(message, args, client, Discord, prefix, command);
|
2019-09-15 06:18:33 +00:00
|
|
|
}
|
2019-10-10 13:43:04 +00:00
|
|
|
}
|