2022-05-10 01:17:25 +01:00
|
|
|
const client = require("../index");
|
|
|
|
const config = require("../config.json");
|
|
|
|
|
|
|
|
client.on("messageCreate", async (message) => {
|
|
|
|
if (
|
|
|
|
message.author.bot ||
|
|
|
|
!message.guild ||
|
2022-05-24 00:38:47 +01:00
|
|
|
!message.content.toLowerCase().startsWith(process.env.PREFIX)
|
2022-05-10 01:17:25 +01:00
|
|
|
)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const [cmd, ...args] = message.content
|
2022-05-24 00:38:47 +01:00
|
|
|
.slice(process.env.PREFIX.length)
|
2022-05-10 01:17:25 +01:00
|
|
|
.trim()
|
|
|
|
.split(/ +/g);
|
|
|
|
|
|
|
|
const command = client.commands.get(cmd.toLowerCase()) || client.commands.find(c => c.aliases?.includes(cmd.toLowerCase()));
|
|
|
|
|
|
|
|
if (!command) return;
|
|
|
|
await command.run(client, message, args);
|
2022-05-14 19:17:06 +01:00
|
|
|
|
2022-05-10 01:17:25 +01:00
|
|
|
});
|