# cristianireyes/ds-bot-core architecture

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

- Interactive diagram: https://gitdiagram.com/cristianireyes/ds-bot-core
- Repository: https://github.com/cristianireyes/ds-bot-core

## Overview

This is a TypeScript Discord bot starter centered on guild-scoped slash commands. Discord interactions enter through the initialized client, which dispatches registered commands; the examples calculate arithmetic or count text and reply to the user. A message listener and two reusable message guards are also present, though the excerpts do not show the guards being registered. The README describes a configurable bot token and server allowlist. Connections below are limited to the startup and command-loading behavior shown in source; no storage layer is present.

Main entry points: [`src/index.ts`](https://github.com/cristianireyes/ds-bot-core/blob/main/src/index.ts) (Slash dispatch), [`src/config/index.ts`](https://github.com/cristianireyes/ds-bot-core/blob/main/src/config/index.ts) (Bot configuration), [`src/commands/maths.ts`](https://github.com/cristianireyes/ds-bot-core/blob/main/src/commands/maths.ts) (Math commands), [`src/commands/another-group.ts`](https://github.com/cristianireyes/ds-bot-core/blob/main/src/commands/another-group.ts) (Utility commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_main["Client startup<br/>[index.ts]"]
  node_config["Bot configuration<br/>[index.ts]"]
  node_slash["Slash dispatch<br/>[index.ts]"]
end

subgraph group_features["Bot features"]
  node_maths["Math commands<br/>[maths.ts]"]
  node_utilities["Utility commands<br/>[another-group.ts]"]
end

subgraph group_message["Message handling"]
  node_message_handler["Message listener<br/>[bot.ts]"]
  node_prefix_guard["Prefix guard<br/>[prefix.ts]"]
  node_notbot_guard["Not-bot guard<br/>[noBot.ts]"]
end

node_user(("Discord user"))
node_discord["Discord platform"]

node_user -->|"invokes commands"| node_discord
node_discord -->|"sends interactions"| node_slash
node_main -->|"reads settings"| node_config
node_main -->|"initializes dispatch"| node_slash
node_slash -->|"dispatches commands"| node_maths
node_slash -->|"dispatches commands"| node_utilities
node_maths -->|"replies to interaction"| node_discord
node_utilities -->|"replies to interaction"| node_discord
node_message_handler -->|"reads guilds"| node_config
node_maths -->|"reads guilds"| node_config
node_utilities -->|"reads guilds"| node_config

click node_main "https://github.com/cristianireyes/ds-bot-core/blob/main/src/index.ts"
click node_config "https://github.com/cristianireyes/ds-bot-core/blob/main/src/config/index.ts"
click node_slash "https://github.com/cristianireyes/ds-bot-core/blob/main/src/index.ts"
click node_maths "https://github.com/cristianireyes/ds-bot-core/blob/main/src/commands/maths.ts"
click node_utilities "https://github.com/cristianireyes/ds-bot-core/blob/main/src/commands/another-group.ts"
click node_message_handler "https://github.com/cristianireyes/ds-bot-core/blob/main/src/bot.ts"
click node_prefix_guard "https://github.com/cristianireyes/ds-bot-core/blob/main/src/guards/prefix.ts"
click node_notbot_guard "https://github.com/cristianireyes/ds-bot-core/blob/main/src/guards/noBot.ts"

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_main,node_config,node_slash,node_user toneBlue
class node_maths,node_utilities toneAmber
class node_message_handler,node_prefix_guard,node_notbot_guard toneMint
class node_discord toneIndigo
```

## Components

### Bot runtime

- [Client startup](https://github.com/cristianireyes/ds-bot-core/blob/main/src/index.ts): `src/index.ts`
- [Bot configuration](https://github.com/cristianireyes/ds-bot-core/blob/main/src/config/index.ts): `src/config/index.ts`
- [Slash dispatch](https://github.com/cristianireyes/ds-bot-core/blob/main/src/index.ts): `src/index.ts`

### Bot features

- [Math commands](https://github.com/cristianireyes/ds-bot-core/blob/main/src/commands/maths.ts): `src/commands/maths.ts`
- [Utility commands](https://github.com/cristianireyes/ds-bot-core/blob/main/src/commands/another-group.ts): `src/commands/another-group.ts`

### Message handling

- [Message listener](https://github.com/cristianireyes/ds-bot-core/blob/main/src/bot.ts): `src/bot.ts`
- [Prefix guard](https://github.com/cristianireyes/ds-bot-core/blob/main/src/guards/prefix.ts): `src/guards/prefix.ts`
- [Not-bot guard](https://github.com/cristianireyes/ds-bot-core/blob/main/src/guards/noBot.ts): `src/guards/noBot.ts`

### Other components

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

## Connections

- Discord user → Discord platform: invokes commands (evidence: `readme.md`)
- Discord platform → Slash dispatch: sends interactions (evidence: `src/index.ts`)
- Client startup → Bot configuration: reads settings (evidence: `src/index.ts`)
- Client startup → Slash dispatch: initializes dispatch (evidence: `src/index.ts`)
- Slash dispatch → Math commands: dispatches commands (evidence: `src/index.ts`)
- Slash dispatch → Utility commands: dispatches commands (evidence: `src/index.ts`)
- Math commands → Discord platform: replies to interaction (evidence: `src/commands/maths.ts`)
- Utility commands → Discord platform: replies to interaction (evidence: `src/commands/another-group.ts`)
- Message listener → Bot configuration: reads guilds (evidence: `src/bot.ts`)
- Math commands → Bot configuration: reads guilds (evidence: `src/commands/maths.ts`)
- Utility commands → Bot configuration: reads guilds (evidence: `src/commands/another-group.ts`)
