# zamatsu-liberation/kisuke-bot architecture

> Architecture diagram of the GitHub repository zamatsu-liberation/kisuke-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zamatsu-liberation/kisuke-bot
- Repository: https://github.com/zamatsu-liberation/kisuke-bot

## Overview

This is a hobby Discord bot whose main workflow is receiving a prefixed message, finding a registered command, executing it, and replying in Discord. Its command areas cover moderation and server administration, AFK and utilities, AI responses, fun and roleplay, and NSFW image lookup. SQLite holds AFK and moderation records, while the bot also integrates with Groq and external image APIs. The excerpts show the dispatcher and selected command/storage links; unsampled command internals and some event behavior are not inferred.

Main entry points: [`index.js`](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/index.js) (Command dispatcher), [`commands/config/database.js`](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/config/database.js) (SQLite data), [`commands/ping/afk.js`](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ping/afk.js) (AFK command), [`commands/fun`](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/fun) (Fun commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bot_runtime["Command dispatcher<br/>[index.js]"]
  node_database[("SQLite data<br/>[database.js]")]
end

subgraph group_moderation["Moderation and admin"]
  node_admin_commands["Server administration"]
  node_moderation_commands["Moderation commands"]
  node_warnings["Warning records<br/>[warn.js]"]
end

subgraph group_personal["AFK and utilities"]
  node_afk_command["AFK command<br/>[afk.js]"]
  node_ping_command["Ping command<br/>[ping.js]"]
  node_utility_commands["Profile utilities"]
end

subgraph group_content["Fun and roleplay"]
  node_fun_commands["Fun commands"]
  node_roleplay_commands["Roleplay commands"]
end

subgraph group_integrations["AI and image integrations"]
  node_ai_command["AI response<br/>[ai_response.js]"]
  node_nsfw_commands["NSFW image commands"]
end

node_discord_user(("Discord user"))
node_discord{{"Discord platform"}}
node_groq{{"Groq API"}}
node_image_apis{{"Image APIs"}}

node_discord_user -->|"sends message"| node_discord
node_discord -->|"delivers events"| node_bot_runtime
node_bot_runtime -->|"dispatches commands"| node_admin_commands
node_bot_runtime -->|"dispatches commands"| node_moderation_commands
node_bot_runtime -->|"dispatches commands"| node_afk_command
node_bot_runtime -->|"dispatches commands"| node_ping_command
node_bot_runtime -->|"dispatches commands"| node_utility_commands
node_bot_runtime -->|"dispatches commands"| node_ai_command
node_bot_runtime -->|"dispatches commands"| node_fun_commands
node_bot_runtime -->|"dispatches commands"| node_roleplay_commands
node_bot_runtime -->|"dispatches commands"| node_nsfw_commands
node_bot_runtime -->|"logs commands"| node_database
node_bot_runtime -->|"checks AFK"| node_database
node_afk_command -->|"sets AFK"| node_database
node_warnings -->|"stores warnings"| node_database
node_ai_command -->|"requests completion"| node_groq
node_roleplay_commands -->|"fetches GIFs"| node_image_apis
node_fun_commands -->|"fetches images"| node_image_apis
node_nsfw_commands -->|"queries image sources"| node_image_apis
node_bot_runtime -->|"replies to users"| node_discord

click node_bot_runtime "https://github.com/zamatsu-liberation/kisuke-bot/blob/main/index.js"
click node_admin_commands "https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/admin"
click node_moderation_commands "https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/moderation"
click node_warnings "https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/moderation/warn.js"
click node_database "https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/config/database.js"
click node_afk_command "https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ping/afk.js"
click node_ping_command "https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ping/ping.js"
click node_utility_commands "https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/utils"
click node_ai_command "https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ai/ai_response.js"
click node_fun_commands "https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/fun"
click node_roleplay_commands "https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/roleplay"
click node_nsfw_commands "https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/nsfw"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bot_runtime,node_database,node_discord_user toneBlue
class node_admin_commands,node_moderation_commands,node_warnings toneAmber
class node_afk_command,node_ping_command,node_utility_commands,node_groq,node_image_apis toneMint
class node_fun_commands,node_roleplay_commands toneRose
class node_ai_command,node_nsfw_commands,node_discord toneIndigo
```

## Components

### Bot runtime

- [Command dispatcher](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/index.js): `index.js`
- [SQLite data](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/config/database.js): `commands/config/database.js`

### Moderation and admin

- [Server administration](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/admin): `commands/admin`
- [Moderation commands](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/moderation): `commands/moderation`
- [Warning records](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/moderation/warn.js): `commands/moderation/warn.js`

### AFK and utilities

- [AFK command](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ping/afk.js): `commands/ping/afk.js`
- [Ping command](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ping/ping.js): `commands/ping/ping.js`
- [Profile utilities](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/utils): `commands/utils`

### Fun and roleplay

- [Fun commands](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/fun): `commands/fun`
- [Roleplay commands](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/roleplay): `commands/roleplay`

### AI and image integrations

- [AI response](https://github.com/zamatsu-liberation/kisuke-bot/blob/main/commands/ai/ai_response.js): `commands/ai/ai_response.js`
- [NSFW image commands](https://github.com/zamatsu-liberation/kisuke-bot/tree/main/commands/nsfw): `commands/nsfw`

### Other components

- **Discord user**
- **Discord platform**
- **Groq API**
- **Image APIs**

## Connections

- Discord user → Discord platform: sends message
- Discord platform → Command dispatcher: delivers events (evidence: `index.js`)
- Command dispatcher → Server administration: dispatches commands (evidence: `index.js`)
- Command dispatcher → Moderation commands: dispatches commands (evidence: `index.js`)
- Command dispatcher → AFK command: dispatches commands (evidence: `index.js`)
- Command dispatcher → Ping command: dispatches commands (evidence: `index.js`)
- Command dispatcher → Profile utilities: dispatches commands (evidence: `index.js`)
- Command dispatcher → AI response: dispatches commands (evidence: `index.js`)
- Command dispatcher → Fun commands: dispatches commands (evidence: `index.js`)
- Command dispatcher → Roleplay commands: dispatches commands (evidence: `index.js`)
- Command dispatcher → NSFW image commands: dispatches commands (evidence: `index.js`)
- Command dispatcher → SQLite data: logs commands (evidence: `index.js`)
- Command dispatcher → SQLite data: checks AFK (evidence: `index.js`)
- AFK command → SQLite data: sets AFK (evidence: `commands/ping/afk.js`)
- Warning records → SQLite data: stores warnings (evidence: `commands/moderation/warn.js`)
- AI response → Groq API: requests completion (evidence: `commands/ai/ai_response.js`)
- Roleplay commands → Image APIs: fetches GIFs (evidence: `commands/roleplay/kiss.js`)
- Fun commands → Image APIs: fetches images (evidence: `commands/fun/neko.js`)
- NSFW image commands → Image APIs: queries image sources (evidence: `commands/nsfw/r34.js`)
- Command dispatcher → Discord platform: replies to users (evidence: `index.js`)
