# istiack-29/kamla architecture

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

- Interactive diagram: https://gitdiagram.com/istiack-29/kamla
- Repository: https://github.com/istiack-29/kamla

## Overview

KAMLA is a Discord tournament-server bot. Admins invoke `/st` to build or rebuild a tournament server; participants then use role assignment, timers, polls, games, and other server tools. The graph covers documented and sampled product stages, with configuration stored in a private Discord channel and join-log updates sent through a webhook. Several cogs are indexed but not excerpted, so their capabilities are represented without speculative call edges.

Main entry points: [`main.py`](https://github.com/istiack-29/kamla/blob/main/main.py) (Bot Runtime), [`config.py`](https://github.com/istiack-29/kamla/blob/main/config.py) (Guild Configuration), [`setup_cog.py`](https://github.com/istiack-29/kamla/blob/main/setup_cog.py) (Setup Commands), [`settings_cog.py`](https://github.com/istiack-29/kamla/blob/main/settings_cog.py) (Settings Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Bot Runtime"]
  node_bot["Bot Runtime<br/>[main.py]"]
end

subgraph group_setup["Tournament Setup"]
  node_setupcmd["Setup Commands<br/>[setup_cog.py]"]
  node_builder["Server Builder<br/>[server_builder.py]"]
  node_settings["Settings Dashboard<br/>[settings_cog.py]"]
end

subgraph group_roles["Roles &amp; Access"]
  node_rolesui["Role Selection<br/>[roles_cog.py]"]
  node_assign["Role Assignment<br/>[assign_cog.py]"]
  node_inviteroles["Invite Roles"]
  node_welcome["Welcome Messages<br/>[welcome_cog.py]"]
  node_nickname["Nickname Tools<br/>[nickname_cog.py]"]
end

subgraph group_tools["Tournament Tools"]
  node_timer["Speech Timers<br/>[timer_cog.py]"]
  node_polls["Polls<br/>[polls_cog.py]"]
  node_games["Tournament Games<br/>[games_cog.py]"]
  node_allin["Push Back All<br/>[allin_cog.py]"]
  node_poi["POI Tools<br/>[poi_cog.py]"]
  node_toss["Toss Tools<br/>[toss_cog.py]"]
  node_dmnotify["DM Notifications<br/>[dm_notify_cog.py]"]
end

subgraph group_infra["State &amp; Operations"]
  node_config[("Guild Configuration<br/>[config.py]")]
  node_ratelimit["Request Pacing<br/>[ratelimit.py]"]
  node_webhook["Join Log Webhook<br/>[webhook.py]"]
  node_keepalive["Keep Alive<br/>[keep_alive.py]"]
end

node_member(("Discord Users"))
node_discord{{"Discord Platform"}}

node_member -->|"uses commands"| node_bot
node_bot -->|"connects to"| node_discord
node_bot -->|"loads extension"| node_setupcmd
node_bot -->|"loads extension"| node_rolesui
node_bot -->|"loads extension"| node_allin
node_bot -->|"loads extension"| node_settings
node_bot -->|"sends join log"| node_webhook
node_bot -->|"starts service"| node_keepalive
node_member -->|"invokes setup"| node_setupcmd
node_setupcmd -->|"builds server"| node_builder
node_settings -->|"changes structure"| node_builder
node_setupcmd -->|"reads settings"| node_config
node_builder -->|"updates state"| node_config
node_settings -->|"reads and writes"| node_config
node_builder -->|"creates resources"| node_discord
node_rolesui -->|"routes assignment"| node_assign
node_assign -->|"uses role rules"| node_config
node_inviteroles -->|"stores invite map"| node_config
node_member -->|"starts timers"| node_timer
node_timer -->|"edits timer message"| node_discord
node_member -.->|"uses polls"| node_polls
node_member -.->|"plays games"| node_games
node_allin -->|"moves members"| node_discord
node_member -.->|"uses tools"| node_poi
node_member -.->|"uses tools"| node_toss
node_dmnotify -.->|"sends notifications"| node_discord
node_welcome -.->|"welcomes members"| node_discord
node_nickname -.->|"updates nicknames"| node_discord
node_settings -->|"schedules log edit"| node_webhook
node_webhook -->|"creates invites"| node_discord
node_setupcmd -->|"uses diagnostics"| node_ratelimit
node_config -->|"uses pacing"| node_ratelimit

click node_bot "https://github.com/istiack-29/kamla/blob/main/main.py"
click node_setupcmd "https://github.com/istiack-29/kamla/blob/main/setup_cog.py"
click node_builder "https://github.com/istiack-29/kamla/blob/main/server_builder.py"
click node_settings "https://github.com/istiack-29/kamla/blob/main/settings_cog.py"
click node_rolesui "https://github.com/istiack-29/kamla/blob/main/roles_cog.py"
click node_assign "https://github.com/istiack-29/kamla/blob/main/assign_cog.py"
click node_inviteroles "https://github.com/istiack-29/kamla/blob/main/invite_roles_cog.py"
click node_welcome "https://github.com/istiack-29/kamla/blob/main/welcome_cog.py"
click node_nickname "https://github.com/istiack-29/kamla/blob/main/nickname_cog.py"
click node_timer "https://github.com/istiack-29/kamla/blob/main/timer_cog.py"
click node_polls "https://github.com/istiack-29/kamla/blob/main/polls_cog.py"
click node_games "https://github.com/istiack-29/kamla/blob/main/games_cog.py"
click node_allin "https://github.com/istiack-29/kamla/blob/main/allin_cog.py"
click node_poi "https://github.com/istiack-29/kamla/blob/main/poi_cog.py"
click node_toss "https://github.com/istiack-29/kamla/blob/main/toss_cog.py"
click node_dmnotify "https://github.com/istiack-29/kamla/blob/main/dm_notify_cog.py"
click node_config "https://github.com/istiack-29/kamla/blob/main/config.py"
click node_ratelimit "https://github.com/istiack-29/kamla/blob/main/ratelimit.py"
click node_webhook "https://github.com/istiack-29/kamla/blob/main/webhook.py"
click node_keepalive "https://github.com/istiack-29/kamla/blob/main/keep_alive.py"

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,node_member toneBlue
class node_setupcmd,node_builder,node_settings toneAmber
class node_rolesui,node_assign,node_inviteroles,node_welcome,node_nickname toneMint
class node_timer,node_polls,node_games,node_allin,node_poi,node_toss,node_dmnotify toneRose
class node_config,node_ratelimit,node_webhook,node_keepalive,node_discord toneIndigo
```

## Components

### Bot Runtime

- [Bot Runtime](https://github.com/istiack-29/kamla/blob/main/main.py): `main.py`

### Tournament Setup

- [Setup Commands](https://github.com/istiack-29/kamla/blob/main/setup_cog.py): `setup_cog.py`
- [Server Builder](https://github.com/istiack-29/kamla/blob/main/server_builder.py): `server_builder.py`
- [Settings Dashboard](https://github.com/istiack-29/kamla/blob/main/settings_cog.py): `settings_cog.py`

### Roles & Access

- [Role Selection](https://github.com/istiack-29/kamla/blob/main/roles_cog.py): `roles_cog.py`
- [Role Assignment](https://github.com/istiack-29/kamla/blob/main/assign_cog.py): `assign_cog.py`
- [Invite Roles](https://github.com/istiack-29/kamla/blob/main/invite_roles_cog.py): `invite_roles_cog.py`
- [Welcome Messages](https://github.com/istiack-29/kamla/blob/main/welcome_cog.py): `welcome_cog.py`
- [Nickname Tools](https://github.com/istiack-29/kamla/blob/main/nickname_cog.py): `nickname_cog.py`

### Tournament Tools

- [Speech Timers](https://github.com/istiack-29/kamla/blob/main/timer_cog.py): `timer_cog.py`
- [Polls](https://github.com/istiack-29/kamla/blob/main/polls_cog.py): `polls_cog.py`
- [Tournament Games](https://github.com/istiack-29/kamla/blob/main/games_cog.py): `games_cog.py`
- [Push Back All](https://github.com/istiack-29/kamla/blob/main/allin_cog.py): `allin_cog.py`
- [POI Tools](https://github.com/istiack-29/kamla/blob/main/poi_cog.py): `poi_cog.py`
- [Toss Tools](https://github.com/istiack-29/kamla/blob/main/toss_cog.py): `toss_cog.py`
- [DM Notifications](https://github.com/istiack-29/kamla/blob/main/dm_notify_cog.py): `dm_notify_cog.py`

### State & Operations

- [Guild Configuration](https://github.com/istiack-29/kamla/blob/main/config.py): `config.py`
- [Request Pacing](https://github.com/istiack-29/kamla/blob/main/ratelimit.py): `ratelimit.py`
- [Join Log Webhook](https://github.com/istiack-29/kamla/blob/main/webhook.py): `webhook.py`
- [Keep Alive](https://github.com/istiack-29/kamla/blob/main/keep_alive.py): `keep_alive.py`

### Other components

- **Discord Users**
- **Discord Platform**

## Connections

- Discord Users → Bot Runtime: uses commands (evidence: `main.py`)
- Bot Runtime → Discord Platform: connects to (evidence: `main.py`)
- Bot Runtime → Setup Commands: loads extension (evidence: `main.py`)
- Bot Runtime → Role Selection: loads extension (evidence: `main.py`)
- Bot Runtime → Push Back All: loads extension (evidence: `main.py`)
- Bot Runtime → Settings Dashboard: loads extension (evidence: `main.py`)
- Bot Runtime → Join Log Webhook: sends join log (evidence: `main.py`)
- Bot Runtime → Keep Alive: starts service (evidence: `main.py`)
- Discord Users → Setup Commands: invokes setup (evidence: `setup_cog.py`)
- Setup Commands → Server Builder: builds server (evidence: `setup_cog.py`)
- Settings Dashboard → Server Builder: changes structure (evidence: `settings_cog.py`)
- Setup Commands → Guild Configuration: reads settings (evidence: `setup_cog.py`)
- Server Builder → Guild Configuration: updates state (evidence: `server_builder.py`)
- Settings Dashboard → Guild Configuration: reads and writes (evidence: `settings_cog.py`)
- Server Builder → Discord Platform: creates resources (evidence: `server_builder.py`)
- Role Selection → Role Assignment: routes assignment (evidence: `roles_cog.py`)
- Role Assignment → Guild Configuration: uses role rules (evidence: `assign_cog.py`)
- Invite Roles → Guild Configuration: stores invite map (evidence: `invite_roles_cog.py`)
- Discord Users → Speech Timers: starts timers (evidence: `timer_cog.py`)
- Speech Timers → Discord Platform: edits timer message (evidence: `timer_cog.py`)
- Discord Users → Polls: uses polls
- Discord Users → Tournament Games: plays games
- Push Back All → Discord Platform: moves members (evidence: `allin_cog.py`)
- Discord Users → POI Tools: uses tools
- Discord Users → Toss Tools: uses tools
- DM Notifications → Discord Platform: sends notifications
- Welcome Messages → Discord Platform: welcomes members
- Nickname Tools → Discord Platform: updates nicknames
- Settings Dashboard → Join Log Webhook: schedules log edit (evidence: `settings_cog.py`)
- Join Log Webhook → Discord Platform: creates invites (evidence: `webhook.py`)
- Setup Commands → Request Pacing: uses diagnostics (evidence: `setup_cog.py`)
- Guild Configuration → Request Pacing: uses pacing (evidence: `config.py`)
