docs: update events structure and trigger system docs
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 4s
All checks were successful
Auto Build and Push Docker Image / build (push) Successful in 4s
This commit is contained in:
@@ -39,12 +39,14 @@ pixelpoebel/
|
||||
│ ├── events/
|
||||
│ │ ├── ready.ts
|
||||
│ │ ├── interactionCreate.ts
|
||||
│ │ ├── guildMemberAdd.ts # Welcome messages
|
||||
│ │ ├── guildMemberRemove.ts # Goodbye messages
|
||||
│ │ ├── messageCreate.ts # Auto-response triggers
|
||||
│ │ ├── messageDelete.ts # Deleted messages
|
||||
│ │ ├── messageUpdate.ts # Edited messages
|
||||
│ │ ├── guildMemberAdd.ts # Welcome messages
|
||||
│ │ ├── guildMemberRemove.ts # Goodbye messages
|
||||
│ │ ├── guildMemberUpdate.ts # Nickname/role changes
|
||||
│ │ ├── messageDelete.ts # Deleted messages
|
||||
│ │ ├── messageUpdate.ts # Edited messages
|
||||
│ │ └── channelEvent.ts # Channel create/delete
|
||||
│ │ ├── channelCreate.ts # Channel create
|
||||
│ │ └── channelDelete.ts # Channel delete
|
||||
│ └── structures/
|
||||
│ ├── ExtendedClient.ts
|
||||
│ ├── Command.ts
|
||||
@@ -285,6 +287,22 @@ async function sendModerationLog(client: any, guildId: string, event: string, em
|
||||
|
||||
### 7. Auto-Response (Trigger) System
|
||||
|
||||
**Event Handler (`messageCreate.ts`):**
|
||||
```typescript
|
||||
// Listens for messages and checks against auto_responses
|
||||
// Ignores bots and DM messages
|
||||
const triggers = DB.all('SELECT * FROM auto_responses WHERE guild_id = ?', 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;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Command (`trigger.ts`):**
|
||||
```typescript
|
||||
// Add trigger (admin only)
|
||||
DB.run('INSERT INTO auto_responses (guild_id, trigger_word, response_text) VALUES (?, ?, ?)',
|
||||
|
||||
Reference in New Issue
Block a user