hullcss-discord-bot/events/messageCreate.js

22 lines
610 B
JavaScript
Raw Normal View History

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 ||
!message.content.toLowerCase().startsWith(config.prefix)
)
return;
const [cmd, ...args] = message.content
.slice(config.prefix.length)
.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
});