# gh0zd/akame-bot-discord architecture

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

- Interactive diagram: https://gitdiagram.com/gh0zd/akame-bot-discord
- Repository: https://github.com/gh0zd/akame-bot-discord

## Overview

Akame is a Discord bot whose main workflow handles slash-command and component interactions, resolves language and persisted preferences, executes feature commands, and responds in Discord. Separate event handlers support AFK and welcome behavior; SQLite repositories retain settings and feature state. The README also documents interactive setup, invite tracking, and affection counters. Some command and event wiring is unsampled, so edges are limited to relationships evidenced by excerpts, the source index, or README statements.

Main entry points: [`src/commands`](https://github.com/gh0zd/akame-bot-discord/tree/main/src/commands) (Slash commands), [`src/events/interaction/interactionCreate.js`](https://github.com/gh0zd/akame-bot-discord/blob/main/src/events/interaction/interactionCreate.js) (Interaction events), [`src/database/repositories`](https://github.com/gh0zd/akame-bot-discord/tree/main/src/database/repositories) (Data repositories), [`index.js`](https://github.com/gh0zd/akame-bot-discord/blob/main/index.js) (Bot bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_bootstrap["Bot bootstrap<br/>[index.js]"]
  node_interaction_event["Interaction events"]
  node_command_dispatch["Command dispatch<br/>[commandRunner.js]"]
  node_command_registry["Command registry<br/>[commandHandler.js]"]
  node_component_dispatch["Component dispatch"]
end

subgraph group_features["User features"]
  node_command_features["Slash commands"]
  node_interactive_components["Interactive components"]
  node_guild_events["Guild events"]
  node_message_events["Message events"]
  node_welcome_setup["Welcome setup<br/>[welcomeSetup.js]"]
  node_welcome_service["Welcome delivery<br/>[welcome.js]"]
  node_invite_tracking["Invite tracking<br/>[inviteTracker.js]"]
end

subgraph group_state["Persistent state"]
  node_sqlite[("SQLite database<br/>[index.js]")]
  node_repositories["Data repositories"]
  node_schema["Database schema<br/>[schema.js]"]
end

subgraph group_shared["Shared services"]
  node_language["Language resolution<br/>[i18n.js]"]
  node_config["Runtime configuration<br/>[config.js]"]
  node_response["Interaction responses<br/>[respond.js]"]
  node_shared_utils["Shared utilities"]
end

node_discord_user(("Discord user"))
node_discord{{"Discord platform"}}

node_discord_user -->|"initiates interaction"| node_discord
node_discord -->|"delivers event"| node_interaction_event
node_interaction_event -->|"routes command"| node_command_dispatch
node_interaction_event -->|"routes component"| node_component_dispatch
node_command_registry -->|"loads commands"| node_command_features
node_bootstrap -->|"loads commands"| node_command_registry
node_bootstrap -->|"loads components"| node_component_dispatch
node_command_dispatch -.->|"executes command"| node_command_features
node_component_dispatch -->|"dispatches component"| node_interactive_components
node_command_features -->|"resolves translations"| node_language
node_command_features -->|"uses response helpers"| node_response
node_interaction_event -->|"resolves language"| node_language
node_interaction_event -->|"uses response helper"| node_response
node_language -->|"reads preferences"| node_repositories
node_repositories -->|"queries database"| node_sqlite
node_sqlite -->|"applies migrations"| node_schema
node_guild_events -->|"delivers welcome"| node_welcome_service
node_guild_events -->|"checks invites"| node_invite_tracking
node_welcome_setup -->|"saves settings"| node_repositories
node_welcome_setup -->|"uses tracker"| node_invite_tracking
node_welcome_setup -->|"uses welcome service"| node_welcome_service
node_message_events -->|"reads AFK state"| node_repositories
node_message_events -.->|"replies to messages"| node_discord
node_bootstrap -->|"loads configuration"| node_config
node_command_features -.->|"uses shared helpers"| node_shared_utils
node_command_features -.->|"returns feature result"| node_discord

click node_bootstrap "https://github.com/gh0zd/akame-bot-discord/blob/main/index.js"
click node_interaction_event "https://github.com/gh0zd/akame-bot-discord/blob/main/src/events/interaction/interactionCreate.js"
click node_command_dispatch "https://github.com/gh0zd/akame-bot-discord/blob/main/src/handlers/commandRunner.js"
click node_command_registry "https://github.com/gh0zd/akame-bot-discord/blob/main/src/handlers/commandHandler.js"
click node_component_dispatch "https://github.com/gh0zd/akame-bot-discord/blob/main/src/handlers/componentHandler.js"
click node_command_features "https://github.com/gh0zd/akame-bot-discord/tree/main/src/commands"
click node_interactive_components "https://github.com/gh0zd/akame-bot-discord/tree/main/src/components"
click node_guild_events "https://github.com/gh0zd/akame-bot-discord/tree/main/src/events/guild"
click node_message_events "https://github.com/gh0zd/akame-bot-discord/tree/main/src/events/message"
click node_welcome_setup "https://github.com/gh0zd/akame-bot-discord/blob/main/src/components/welcomeSetup.js"
click node_welcome_service "https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/welcome.js"
click node_invite_tracking "https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/inviteTracker.js"
click node_sqlite "https://github.com/gh0zd/akame-bot-discord/blob/main/src/database/index.js"
click node_repositories "https://github.com/gh0zd/akame-bot-discord/tree/main/src/database/repositories"
click node_schema "https://github.com/gh0zd/akame-bot-discord/blob/main/src/database/schema.js"
click node_language "https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/i18n.js"
click node_config "https://github.com/gh0zd/akame-bot-discord/blob/main/src/config.js"
click node_response "https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/respond.js"
click node_shared_utils "https://github.com/gh0zd/akame-bot-discord/tree/main/src/utils"

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_bootstrap,node_interaction_event,node_command_dispatch,node_command_registry,node_component_dispatch,node_discord_user toneBlue
class node_command_features,node_interactive_components,node_guild_events,node_message_events,node_welcome_setup,node_welcome_service,node_invite_tracking toneAmber
class node_sqlite,node_repositories,node_schema toneMint
class node_language,node_config,node_response,node_shared_utils toneRose
class node_discord toneIndigo
```

## Components

### Bot runtime

- [Bot bootstrap](https://github.com/gh0zd/akame-bot-discord/blob/main/index.js): `index.js`
- [Interaction events](https://github.com/gh0zd/akame-bot-discord/blob/main/src/events/interaction/interactionCreate.js): `src/events/interaction/interactionCreate.js`
- [Command dispatch](https://github.com/gh0zd/akame-bot-discord/blob/main/src/handlers/commandRunner.js): `src/handlers/commandRunner.js`
- [Command registry](https://github.com/gh0zd/akame-bot-discord/blob/main/src/handlers/commandHandler.js): `src/handlers/commandHandler.js`
- [Component dispatch](https://github.com/gh0zd/akame-bot-discord/blob/main/src/handlers/componentHandler.js): `src/handlers/componentHandler.js`

### User features

- [Slash commands](https://github.com/gh0zd/akame-bot-discord/tree/main/src/commands): `src/commands`
- [Interactive components](https://github.com/gh0zd/akame-bot-discord/tree/main/src/components): `src/components`
- [Guild events](https://github.com/gh0zd/akame-bot-discord/tree/main/src/events/guild): `src/events/guild`
- [Message events](https://github.com/gh0zd/akame-bot-discord/tree/main/src/events/message): `src/events/message`
- [Welcome setup](https://github.com/gh0zd/akame-bot-discord/blob/main/src/components/welcomeSetup.js): `src/components/welcomeSetup.js`
- [Welcome delivery](https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/welcome.js): `src/utils/welcome.js`
- [Invite tracking](https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/inviteTracker.js): `src/utils/inviteTracker.js`

### Persistent state

- [SQLite database](https://github.com/gh0zd/akame-bot-discord/blob/main/src/database/index.js): `src/database/index.js`
- [Data repositories](https://github.com/gh0zd/akame-bot-discord/tree/main/src/database/repositories): `src/database/repositories`
- [Database schema](https://github.com/gh0zd/akame-bot-discord/blob/main/src/database/schema.js): `src/database/schema.js`

### Shared services

- [Language resolution](https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/i18n.js): `src/utils/i18n.js`
- [Runtime configuration](https://github.com/gh0zd/akame-bot-discord/blob/main/src/config.js): `src/config.js`
- [Interaction responses](https://github.com/gh0zd/akame-bot-discord/blob/main/src/utils/respond.js): `src/utils/respond.js`
- [Shared utilities](https://github.com/gh0zd/akame-bot-discord/tree/main/src/utils): `src/utils`

### Other components

- **Discord user**
- **Discord platform**

## Connections

- Discord user → Discord platform: initiates interaction
- Discord platform → Interaction events: delivers event (evidence: `src/events/interaction/interactionCreate.js`)
- Interaction events → Command dispatch: routes command (evidence: `src/events/interaction/interactionCreate.js`)
- Interaction events → Component dispatch: routes component (evidence: `src/events/interaction/interactionCreate.js`)
- Command registry → Slash commands: loads commands (evidence: `src/handlers/commandHandler.js`)
- Bot bootstrap → Command registry: loads commands (evidence: `index.js`)
- Bot bootstrap → Component dispatch: loads components (evidence: `index.js`)
- Command dispatch → Slash commands: executes command
- Component dispatch → Interactive components: dispatches component (evidence: `src/handlers/componentHandler.js`)
- Slash commands → Language resolution: resolves translations (evidence: `src/commands/utility/language.js`)
- Slash commands → Interaction responses: uses response helpers (evidence: `src/commands/server/server.js`)
- Interaction events → Language resolution: resolves language (evidence: `src/events/interaction/interactionCreate.js`)
- Interaction events → Interaction responses: uses response helper (evidence: `src/events/interaction/interactionCreate.js`)
- Language resolution → Data repositories: reads preferences (evidence: `src/utils/i18n.js`)
- Data repositories → SQLite database: queries database (evidence: `src/database/repositories/settings.js`)
- SQLite database → Database schema: applies migrations (evidence: `src/database/index.js`)
- Guild events → Welcome delivery: delivers welcome (evidence: `src/events/guild/guildMemberAdd.js`)
- Guild events → Invite tracking: checks invites (evidence: `src/events/guild/guildMemberAdd.js`)
- Welcome setup → Data repositories: saves settings (evidence: `src/components/welcomeSetup.js`)
- Welcome setup → Invite tracking: uses tracker (evidence: `src/components/welcomeSetup.js`)
- Welcome setup → Welcome delivery: uses welcome service (evidence: `src/components/welcomeSetup.js`)
- Message events → Data repositories: reads AFK state (evidence: `src/events/message/afk.js`)
- Message events → Discord platform: replies to messages
- Bot bootstrap → Runtime configuration: loads configuration (evidence: `index.js`)
- Slash commands → Shared utilities: uses shared helpers (evidence: `src/commands/server/server.js`)
- Slash commands → Discord platform: returns feature result
