All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 23s
23 lines
667 B
TypeScript
23 lines
667 B
TypeScript
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;
|
|
}
|
|
}
|
|
},
|
|
}; |