hullcss-discord-bot/events/messageCreate.js

36 lines
894 B
JavaScript
Raw Normal View History

2022-05-10 01:17:25 +01:00
const client = require("../index");
2022-06-01 21:17:26 +01:00
require("dotenv").config();
const discord = require('discord.js');
2022-05-10 01:17:25 +01:00
client.on("messageCreate", async (message) => {
2022-06-01 21:17:26 +01:00
if(message.channel.id == "969944638498680875")
{
await message.startThread({
name: `${message.author} - ${messageArgs}`,
autoArchiveDuration: 60,
type: 'GUILD_PUBLIC_THREAD'
});
2022-05-10 01:17:25 +01:00
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-06-01 21:17:26 +01:00
}
2022-05-10 01:17:25 +01:00
});