1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 16:13:18 +00:00
musix-oss/events/clientEvents/msg.js

29 lines
1.6 KiB
JavaScript
Raw Normal View History

2020-02-05 20:02:53 +00:00
module.exports = {
name: 'message',
async execute(client, msg, Discord) {
if (msg.author.bot || !msg.guild) return;
2020-03-13 20:31:04 +00:00
if (!client.global.db.guilds[msg.guild.id]) return;
2020-02-05 20:02:53 +00:00
let prefix = client.global.db.guilds[msg.guild.id].prefix;
2020-02-20 20:31:03 +00:00
if (client.config.devMode) prefix = client.config.devPrefix;
2020-02-05 20:02:53 +00:00
const args = msg.content.slice(prefix.length).split(' ');
if (msg.mentions.users.first()) {
if (msg.mentions.users.first().id === client.user.id) {
if (!args[1]) return;
2020-03-12 11:56:31 +00:00
if (args[1] === 'prefix') return msg.channel.send(`${client.messages.prefixHere}\`${prefix}\`.`);
2020-02-05 20:02:53 +00:00
if (args[1] === 'help') {
const command = client.commands.get("help");
return client.funcs.exe(msg, args, client, Discord, prefix, command);
}
}
}
if (!msg.content.startsWith(prefix)) return;
if (!args[0]) return;
const commandName = args[0].toLowerCase();
2020-03-11 15:37:45 +00:00
if (commandName === "none") return;
2020-02-05 20:02:53 +00:00
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
if (!command && msg.content !== `${prefix}`) return;
2020-03-14 16:38:02 +00:00
if (command.onlyDev && msg.author.id !== client.config.devId) return;
if (client.config.devMode && msg.member.id !== client.config.devId) return msg.channel.send(client.messages.devMode);
2020-02-05 20:02:53 +00:00
client.funcs.exe(msg, args, client, Discord, prefix, command);
}
2020-03-03 20:25:12 +00:00
}