# palopil/discord-jarbot architecture

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

- Interactive diagram: https://gitdiagram.com/palopil/discord-jarbot
- Repository: https://github.com/palopil/discord-jarbot
- Video tour (about a minute): https://gitdiagram.com/palopil/discord-jarbot/video

## Overview

JARBot is a Discord bot whose main workflow is receiving a slash-command or modal interaction, checking guild and user state, dispatching a command, and replying in Discord. Its commands span moderation and guild settings, playful utilities, image transformations, and suggestions; localization and guild persistence support several of these. The excerpts show interaction dispatch and selected command/helper relationships. Other command behavior and startup wiring are not detailed here, so those links are limited or omitted.

Main entry points: [`utils/Guild.js`](https://github.com/palopil/discord-jarbot/blob/main/utils/Guild.js) (Guild records), [`events/InteractionCreate.js`](https://github.com/palopil/discord-jarbot/blob/main/events/InteractionCreate.js) (Interaction handler), [`utils/language.js`](https://github.com/palopil/discord-jarbot/blob/main/utils/language.js) (Localization), [`commands/beautify.js`](https://github.com/palopil/discord-jarbot/blob/main/commands/beautify.js) (Avatar image commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Discord runtime"]
  node_interaction_handler["Interaction handler"]
  node_guild_events["Guild lifecycle events"]
end

subgraph group_commands["Command features"]
  node_command_suite["Command suite"]
  node_image_commands["Avatar image commands<br/>[beautify.js]"]
  node_ratio_command["RATIO command<br/>[ratio.js]"]
  node_suggestion_command["Suggestion workflow<br/>[suggestion.js]"]
end

subgraph group_support["Shared support"]
  node_language_helper["Localization<br/>[language.js]"]
  node_logger["Error logging<br/>[Logger.js]"]
  node_image_download["Image download<br/>[imageDownload.js]"]
  node_translations["Translation data"]
end

subgraph group_state["Persistence and integrations"]
  node_guild_model[("Guild records<br/>[Guild.js]")]
  node_beta_model[("Beta tester records<br/>[BetaTester.js]")]
end

node_discord_user(("Discord user"))
node_discord{{"Discord platform"}}
node_mongodb[("MongoDB")]
node_discord_suggestions{{"Suggestion channels"}}
node_external_apis{{"Configured APIs"}}

node_discord_user -->|"submits interaction"| node_discord
node_discord -.->|"delivers interaction"| node_interaction_handler
node_interaction_handler -->|"dispatches command"| node_command_suite
node_interaction_handler -->|"reads and updates"| node_guild_model
node_interaction_handler -->|"checks tester"| node_beta_model
node_interaction_handler -->|"logs errors"| node_logger
node_command_suite -.->|"replies to"| node_discord
node_image_commands -->|"reads guild settings"| node_guild_model
node_image_commands -->|"gets localized text"| node_language_helper
node_image_commands -->|"downloads avatar"| node_image_download
node_ratio_command -->|"reads guild settings"| node_guild_model
node_ratio_command -->|"gets localized text"| node_language_helper
node_suggestion_command -->|"reads guild settings"| node_guild_model
node_suggestion_command -->|"gets localized text"| node_language_helper
node_guild_events -->|"updates guild records"| node_guild_model
node_guild_model -.->|"stores records"| node_mongodb
node_beta_model -.->|"stores records"| node_mongodb
node_language_helper -->|"reads translations"| node_translations
node_suggestion_command -->|"posts suggestions"| node_discord_suggestions
node_external_apis -.->|"supports bot features"| node_discord

click node_interaction_handler "https://github.com/palopil/discord-jarbot/blob/main/events/InteractionCreate.js"
click node_guild_events "https://github.com/palopil/discord-jarbot/tree/main/events"
click node_command_suite "https://github.com/palopil/discord-jarbot/tree/main/commands"
click node_image_commands "https://github.com/palopil/discord-jarbot/blob/main/commands/beautify.js"
click node_ratio_command "https://github.com/palopil/discord-jarbot/blob/main/commands/ratio.js"
click node_suggestion_command "https://github.com/palopil/discord-jarbot/blob/main/commands/suggestion.js"
click node_guild_model "https://github.com/palopil/discord-jarbot/blob/main/utils/Guild.js"
click node_beta_model "https://github.com/palopil/discord-jarbot/blob/main/utils/BetaTester.js"
click node_language_helper "https://github.com/palopil/discord-jarbot/blob/main/utils/language.js"
click node_logger "https://github.com/palopil/discord-jarbot/blob/main/utils/Logger.js"
click node_image_download "https://github.com/palopil/discord-jarbot/blob/main/utils/imageDownload.js"
click node_translations "https://github.com/palopil/discord-jarbot/tree/main/langs"

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_interaction_handler,node_guild_events,node_discord_user toneBlue
class node_command_suite,node_image_commands,node_ratio_command,node_suggestion_command,node_mongodb toneAmber
class node_language_helper,node_logger,node_image_download,node_translations,node_external_apis toneMint
class node_guild_model,node_beta_model toneRose
class node_discord,node_discord_suggestions toneIndigo
```

## Components

### Discord runtime

- [Interaction handler](https://github.com/palopil/discord-jarbot/blob/main/events/InteractionCreate.js): `events/InteractionCreate.js`
- [Guild lifecycle events](https://github.com/palopil/discord-jarbot/tree/main/events): `events`

### Command features

- [Command suite](https://github.com/palopil/discord-jarbot/tree/main/commands): `commands`
- [Avatar image commands](https://github.com/palopil/discord-jarbot/blob/main/commands/beautify.js): `commands/beautify.js`
- [RATIO command](https://github.com/palopil/discord-jarbot/blob/main/commands/ratio.js): `commands/ratio.js`
- [Suggestion workflow](https://github.com/palopil/discord-jarbot/blob/main/commands/suggestion.js): `commands/suggestion.js`

### Shared support

- [Localization](https://github.com/palopil/discord-jarbot/blob/main/utils/language.js): `utils/language.js`
- [Error logging](https://github.com/palopil/discord-jarbot/blob/main/utils/Logger.js): `utils/Logger.js`
- [Image download](https://github.com/palopil/discord-jarbot/blob/main/utils/imageDownload.js): `utils/imageDownload.js`
- [Translation data](https://github.com/palopil/discord-jarbot/tree/main/langs): `langs`

### Persistence and integrations

- [Guild records](https://github.com/palopil/discord-jarbot/blob/main/utils/Guild.js): `utils/Guild.js`
- [Beta tester records](https://github.com/palopil/discord-jarbot/blob/main/utils/BetaTester.js): `utils/BetaTester.js`

### Other components

- **Discord user**
- **Discord platform**
- **MongoDB**
- **Suggestion channels**
- **Configured APIs**

## Connections

- Discord user → Discord platform: submits interaction
- Discord platform → Interaction handler: delivers interaction
- Interaction handler → Command suite: dispatches command (evidence: `events/InteractionCreate.js`)
- Interaction handler → Guild records: reads and updates (evidence: `events/InteractionCreate.js`)
- Interaction handler → Beta tester records: checks tester (evidence: `events/InteractionCreate.js`)
- Interaction handler → Error logging: logs errors (evidence: `events/InteractionCreate.js`)
- Command suite → Discord platform: replies to
- Avatar image commands → Guild records: reads guild settings (evidence: `commands/beautify.js`)
- Avatar image commands → Localization: gets localized text (evidence: `commands/beautify.js`)
- Avatar image commands → Image download: downloads avatar (evidence: `commands/beautify.js`)
- RATIO command → Guild records: reads guild settings (evidence: `commands/ratio.js`)
- RATIO command → Localization: gets localized text (evidence: `commands/ratio.js`)
- Suggestion workflow → Guild records: reads guild settings (evidence: `commands/suggestion.js`)
- Suggestion workflow → Localization: gets localized text (evidence: `commands/suggestion.js`)
- Guild lifecycle events → Guild records: updates guild records (evidence: `events/GuildCreate.js`)
- Guild records → MongoDB: stores records
- Beta tester records → MongoDB: stores records
- Localization → Translation data: reads translations (evidence: `utils/language.js`)
- Suggestion workflow → Suggestion channels: posts suggestions (evidence: `commands/suggestion.js`)
- Configured APIs → Discord platform: supports bot features
