Add message.js
Forgot to commit this with 4630cefd47
like
a fucking idiot.
This commit is contained in:
parent
6371d43358
commit
4c1a87118b
1 changed files with 30 additions and 0 deletions
30
server/message.js
Normal file
30
server/message.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
module.exports = function(client, owners, message, globalPrefix){
|
||||
|
||||
if (client.serverPrefixes.get(message.guild.id)) {
|
||||
prefix = client.serverPrefixes.get(message.guild.id)
|
||||
} else
|
||||
prefix = globalPrefix
|
||||
|
||||
let args = message.content.slice(prefix.length).split(" ")
|
||||
|
||||
const commandName = args.shift().toLowerCase();
|
||||
const command = client.commands.get(commandName);
|
||||
const netModule = client.netmodules.get(commandName);
|
||||
if (!message.guild || message.author.bot || !message.content.startsWith(prefix)) return;
|
||||
if (!command){
|
||||
if (netModule){
|
||||
try {
|
||||
netModule.execute({message: message, args: args, client: client, prefix: prefix})
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (command.admin && owners.indexOf(message.author.id.toString()) == -1) return;
|
||||
try {
|
||||
command.execute({ message: message, args: args, client: client, prefix: prefix, owners: owners})
|
||||
} catch (error) {
|
||||
console.log(`${error}\n-------`)
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue