# measyasak52-ux/we-bot architecture

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

- Interactive diagram: https://gitdiagram.com/measyasak52-ux/we-bot
- Repository: https://github.com/measyasak52-ux/we-bot

## Overview

TitanBot is a multi-server Discord bot for community administration and engagement. Discord interactions and events enter the bot, which loads commands and handlers, invokes feature services, and persists guild-scoped state through a PostgreSQL-backed database layer (with memory fallback noted in the README). The map preserves the README’s major feature areas; unsampled feature internals are represented by their existing directories. Edges are limited to relationships visible in excerpts, the source index, or README statements.

Main entry points: [`src/commands`](https://github.com/measyasak52-ux/we-bot/tree/main/src/commands) (Server commands), [`src/app.js`](https://github.com/measyasak52-ux/we-bot/blob/main/src/app.js) (Bot application), [`src/events`](https://github.com/measyasak52-ux/we-bot/tree/main/src/events) (Event handling), [`src/utils/database.js`](https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/database.js) (Database access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_app["Bot application<br/>[app.js]"]
  node_event_entry["Event handling"]
  node_command_loader["Command loading<br/>[commandLoader.js]"]
  node_command_features["Server commands"]
end

subgraph group_community["Community systems"]
  node_moderation["Moderation"]
  node_tickets["Ticket system"]
  node_verification["Verification"]
  node_logging["Logging<br/>[loggingService.js]"]
end

subgraph group_engagement["Engagement features"]
  node_economy["Economy"]
  node_leveling["Leveling and XP<br/>[leveling.js]"]
  node_giveaways["Giveaways<br/>[giveawayService.js]"]
  node_birthdays["Birthday system<br/>[birthdayService.js]"]
  node_music["Music playback<br/>[playerHandler.js]"]
  node_server_features["Other server features"]
end

subgraph group_interaction["Interaction experience"]
  node_components["Interactive components"]
  node_interaction_support["Reply and error handling"]
end

subgraph group_persistence["Persistence and config"]
  node_guild_config["Guild configuration<br/>[guildConfig.js]"]
  node_storage["Database access<br/>[database.js]"]
  node_postgres[("PostgreSQL adapter")]
  node_config["Bot configuration<br/>[bot.js]"]
end

node_discord(("Discord"))

node_discord -->|"sends events"| node_event_entry
node_event_entry -->|"dispatches commands"| node_command_features
node_app -->|"loads commands"| node_command_loader
node_app -->|"initializes"| node_storage
node_app -->|"uses configuration"| node_guild_config
node_app -->|"sets up playback"| node_music
node_guild_config -->|"reads and writes"| node_storage
node_storage -->|"uses adapter"| node_postgres
node_storage -->|"reads settings"| node_config
node_event_entry -->|"handles interactions"| node_components
node_event_entry -->|"uses reply helpers"| node_interaction_support
node_command_features -->|"provides commands"| node_moderation
node_command_features -->|"provides commands"| node_tickets
node_command_features -->|"provides commands"| node_economy
node_command_features -->|"provides commands"| node_leveling
node_command_features -->|"provides commands"| node_giveaways
node_command_features -->|"provides commands"| node_birthdays
node_command_features -->|"provides commands"| node_music
node_command_features -->|"provides commands"| node_verification
node_command_features -->|"provides commands"| node_logging
node_command_features -->|"provides features"| node_server_features

click node_app "https://github.com/measyasak52-ux/we-bot/blob/main/src/app.js"
click node_event_entry "https://github.com/measyasak52-ux/we-bot/tree/main/src/events"
click node_command_loader "https://github.com/measyasak52-ux/we-bot/blob/main/src/handlers/loaders/commandLoader.js"
click node_command_features "https://github.com/measyasak52-ux/we-bot/tree/main/src/commands"
click node_moderation "https://github.com/measyasak52-ux/we-bot/tree/main/src/commands/Moderation"
click node_tickets "https://github.com/measyasak52-ux/we-bot/tree/main/src/commands/Ticket"
click node_verification "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/verificationService.js"
click node_logging "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/loggingService.js"
click node_economy "https://github.com/measyasak52-ux/we-bot/tree/main/src/commands/Economy"
click node_leveling "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/leveling/leveling.js"
click node_giveaways "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/giveawayService.js"
click node_birthdays "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/birthdayService.js"
click node_music "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/music/playerHandler.js"
click node_server_features "https://github.com/measyasak52-ux/we-bot/tree/main/src/commands"
click node_components "https://github.com/measyasak52-ux/we-bot/tree/main/src/interactions"
click node_interaction_support "https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/interactionHelper.js"
click node_guild_config "https://github.com/measyasak52-ux/we-bot/blob/main/src/services/config/guildConfig.js"
click node_storage "https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/database.js"
click node_postgres "https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/postgresDatabase.js"
click node_config "https://github.com/measyasak52-ux/we-bot/blob/main/src/config/bot.js"

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_app,node_event_entry,node_command_loader,node_command_features toneBlue
class node_moderation,node_tickets,node_verification,node_logging toneAmber
class node_economy,node_leveling,node_giveaways,node_birthdays,node_music,node_server_features toneMint
class node_components,node_interaction_support toneRose
class node_guild_config,node_storage,node_postgres,node_config,node_discord toneIndigo
```

## Components

### Bot runtime

- [Bot application](https://github.com/measyasak52-ux/we-bot/blob/main/src/app.js): `src/app.js`
- [Event handling](https://github.com/measyasak52-ux/we-bot/tree/main/src/events): `src/events`
- [Command loading](https://github.com/measyasak52-ux/we-bot/blob/main/src/handlers/loaders/commandLoader.js): `src/handlers/loaders/commandLoader.js`
- [Server commands](https://github.com/measyasak52-ux/we-bot/tree/main/src/commands): `src/commands`

### Community systems

- [Moderation](https://github.com/measyasak52-ux/we-bot/tree/main/src/commands/Moderation): `src/commands/Moderation`
- [Ticket system](https://github.com/measyasak52-ux/we-bot/tree/main/src/commands/Ticket): `src/commands/Ticket`
- [Verification](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/verificationService.js): `src/services/verificationService.js`
- [Logging](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/loggingService.js): `src/services/loggingService.js`

### Engagement features

- [Economy](https://github.com/measyasak52-ux/we-bot/tree/main/src/commands/Economy): `src/commands/Economy`
- [Leveling and XP](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/leveling/leveling.js): `src/services/leveling/leveling.js`
- [Giveaways](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/giveawayService.js): `src/services/giveawayService.js`
- [Birthday system](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/birthdayService.js): `src/services/birthdayService.js`
- [Music playback](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/music/playerHandler.js): `src/services/music/playerHandler.js`
- [Other server features](https://github.com/measyasak52-ux/we-bot/tree/main/src/commands): `src/commands`

### Interaction experience

- [Interactive components](https://github.com/measyasak52-ux/we-bot/tree/main/src/interactions): `src/interactions`
- [Reply and error handling](https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/interactionHelper.js): `src/utils/interactionHelper.js`

### Persistence and config

- [Guild configuration](https://github.com/measyasak52-ux/we-bot/blob/main/src/services/config/guildConfig.js): `src/services/config/guildConfig.js`
- [Database access](https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/database.js): `src/utils/database.js`
- [PostgreSQL adapter](https://github.com/measyasak52-ux/we-bot/blob/main/src/utils/postgresDatabase.js): `src/utils/postgresDatabase.js`
- [Bot configuration](https://github.com/measyasak52-ux/we-bot/blob/main/src/config/bot.js): `src/config/bot.js`

### Other components

- **Discord**

## Connections

- Discord → Event handling: sends events (evidence: `README.md`)
- Event handling → Server commands: dispatches commands (evidence: `src/events/interactionCreate.js`)
- Bot application → Command loading: loads commands (evidence: `src/app.js`)
- Bot application → Database access: initializes (evidence: `src/app.js`)
- Bot application → Guild configuration: uses configuration (evidence: `src/app.js`)
- Bot application → Music playback: sets up playback (evidence: `src/app.js`)
- Guild configuration → Database access: reads and writes (evidence: `src/services/config/guildConfig.js`)
- Database access → PostgreSQL adapter: uses adapter (evidence: `src/utils/database.js`)
- Database access → Bot configuration: reads settings (evidence: `src/utils/database.js`)
- Event handling → Interactive components: handles interactions (evidence: `src/events/interactionCreate.js`)
- Event handling → Reply and error handling: uses reply helpers (evidence: `src/events/interactionCreate.js`)
- Server commands → Moderation: provides commands (evidence: `README.md`)
- Server commands → Ticket system: provides commands (evidence: `README.md`)
- Server commands → Economy: provides commands (evidence: `README.md`)
- Server commands → Leveling and XP: provides commands (evidence: `README.md`)
- Server commands → Giveaways: provides commands (evidence: `README.md`)
- Server commands → Birthday system: provides commands (evidence: `README.md`)
- Server commands → Music playback: provides commands (evidence: `README.md`)
- Server commands → Verification: provides commands (evidence: `README.md`)
- Server commands → Logging: provides commands (evidence: `README.md`)
- Server commands → Other server features: provides features (evidence: `README.md`)
