Add messageCreate event for trigger auto-responses
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 23s

This commit is contained in:
2026-03-28 19:30:22 +00:00
parent 3da019b8c7
commit 9fbd8e6d51

View File

@@ -0,0 +1,23 @@
import { Events } from 'discord.js';
export default {
name: Events.MessageCreate,
async execute(message: any, client: any) {
if (message.author.bot) return;
if (!message.guildId) return;
const triggers: any[] = client.DB.all(
'SELECT * FROM auto_responses WHERE guild_id = ?',
message.guildId
);
const contentLower = message.content.toLowerCase();
for (const trigger of triggers) {
if (contentLower.includes(trigger.trigger_word.toLowerCase())) {
await message.channel.send(trigger.response_text);
return;
}
}
},
};