1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 01:21:56 +00:00

Mention commands

This commit is contained in:
MatteZ02 2020-05-13 12:52:12 +03:00
parent 8810b6c01c
commit 161b88d020

View File

@ -16,26 +16,28 @@ module.exports = {
); );
if (args[2] === "=" && args[3]) return (prefix = args[3]); if (args[2] === "=" && args[3]) return (prefix = args[3]);
} }
if (args[1] === "help") { args.shift();
const command = client.commands.get("help"); getCommand(client, args, msg, Discord);
return client.funcs.exe(msg, args, client, Discord, prefix, command);
}
} }
} }
if (!msg.content.startsWith(prefix)) return; if (!msg.content.startsWith(prefix)) return;
if (!args[0]) return; getCommand(client, args, msg, Discord);
const commandName = args[0].toLowerCase();
if (commandName === "none") return;
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;
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);
client.funcs.exe(msg, args, client, Discord, command);
}, },
}; };
function getCommand(client, args, msg, Discord) {
if (!args[0]) return;
const commandName = args[0].toLowerCase();
if (commandName === "none") return;
const command =
client.commands.get(commandName) ||
client.commands.find(
(cmd) => cmd.aliases && cmd.aliases.includes(commandName)
) ||
client.commandAliases.get(commandName);
if (!command) return;
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);
client.funcs.exe(msg, args, client, Discord, command);
}