# shikihtm/momoi-bot architecture

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

- Interactive diagram: https://gitdiagram.com/shikihtm/momoi-bot
- Repository: https://github.com/shikihtm/momoi-bot

## Overview

Momoi-Bot is a Discord bot for Blue Archive, backed by the torikushiii API. Users request current/upcoming banners or raids through slash commands; the interaction dispatcher invokes the command, which fetches data, formats an embed and replies. Separately, scheduled checks crawl banner listings and poll the raid API, persist newly seen state, and announce changes to a configured channel. The tree and excerpts also establish a ping command and command/event loading. Other runtime assets and helpers are shown where supported; unsampled branches are linked only when the README or excerpts establish the relationship.

Main entry points: [`Database/BannerCrawler.js`](https://github.com/shikihtm/momoi-bot/blob/main/Database/BannerCrawler.js) (Banner crawler), [`cmds/Banner/banners.js`](https://github.com/shikihtm/momoi-bot/blob/main/cmds/Banner/banners.js) (Banner command), [`src/index.js`](https://github.com/shikihtm/momoi-bot/blob/main/src/index.js) (Bot client), [`events/interactionCreate.js`](https://github.com/shikihtm/momoi-bot/blob/main/events/interactionCreate.js) (Interaction dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discord["Discord runtime"]
  node_discord_client["Bot client<br/>[index.js]"]
  node_interaction_dispatch["Interaction dispatch"]
end

subgraph group_requests["User requests"]
  node_banner_command["Banner command<br/>[banners.js]"]
  node_raid_command["Raid command<br/>[boss.js]"]
  node_ping_command["Latency command<br/>[ping.js]"]
  node_banner_api["Banner API<br/>[banners.js]"]
  node_raid_api["Raid API<br/>[boss.js]"]
end

subgraph group_monitor["Change monitoring"]
  node_banner_crawler["Banner crawler<br/>[BannerCrawler.js]"]
  node_banner_state[("Banner state<br/>[bannerLink.json]")]
  node_banner_limits[("Crawl limits<br/>[limits.json]")]
  node_raid_monitor["Raid monitor<br/>[Raid.js]"]
  node_raid_state[("Upcoming raid state<br/>[Upcoming.raid.json]")]
  node_banner_alert["Banner alerts<br/>[PingWhen.Banner.js]"]
  node_raid_alert["Raid alerts<br/>[PingWhen.Boss.js]"]
end

subgraph group_data["Game data"]
  node_banner_assets["Banner assets"]
  node_raid_assets["Raid assets"]
  node_student_data["Student metadata"]
  node_asset_access["Asset access<br/>[Database.access.js]"]
end

node_sensei(("Discord user"))
node_game_api["Blue Archive API"]
node_wiki["Banner-list wiki"]
node_channel(("Configured Discord channel"))

node_sensei -->|"uses bot"| node_discord_client
node_discord_client -->|"registers events"| node_interaction_dispatch
node_interaction_dispatch -->|"dispatches"| node_banner_command
node_interaction_dispatch -->|"dispatches"| node_raid_command
node_interaction_dispatch -->|"dispatches"| node_ping_command
node_banner_command -->|"fetches"| node_banner_api
node_banner_api -->|"requests banners"| node_game_api
node_banner_command -->|"reads"| node_banner_assets
node_banner_command -->|"reads"| node_student_data
node_banner_command -->|"replies embeds"| node_sensei
node_raid_command -->|"fetches"| node_raid_api
node_raid_api -->|"requests raids"| node_game_api
node_raid_command -->|"reads"| node_raid_assets
node_raid_command -->|"replies embed"| node_sensei
node_ping_command -->|"replies latency"| node_sensei
node_discord_client -->|"starts checks"| node_banner_crawler
node_discord_client -->|"starts checks"| node_raid_monitor
node_banner_crawler -->|"scrapes listing"| node_wiki
node_banner_crawler -->|"looks up students"| node_game_api
node_banner_crawler -->|"updates links"| node_banner_state
node_banner_crawler -->|"updates limits"| node_banner_limits
node_banner_crawler -->|"announces changes"| node_banner_alert
node_banner_alert -->|"reads assets"| node_banner_assets
node_banner_alert -->|"reads school data"| node_student_data
node_banner_alert -->|"sends embed"| node_channel
node_raid_monitor -->|"polls raids"| node_game_api
node_raid_monitor -->|"stores upcoming"| node_raid_state
node_raid_monitor -->|"announces changes"| node_raid_alert
node_raid_alert -->|"reads assets"| node_raid_assets
node_raid_alert -->|"sends embed"| node_channel
node_asset_access -->|"loads assets"| node_banner_assets
node_asset_access -->|"loads assets"| node_raid_assets
node_asset_access -->|"loads metadata"| node_student_data

click node_discord_client "https://github.com/shikihtm/momoi-bot/blob/main/src/index.js"
click node_interaction_dispatch "https://github.com/shikihtm/momoi-bot/blob/main/events/interactionCreate.js"
click node_banner_command "https://github.com/shikihtm/momoi-bot/blob/main/cmds/Banner/banners.js"
click node_raid_command "https://github.com/shikihtm/momoi-bot/blob/main/cmds/Raid/boss.js"
click node_ping_command "https://github.com/shikihtm/momoi-bot/blob/main/cmds/server/ping.js"
click node_banner_api "https://github.com/shikihtm/momoi-bot/blob/main/cmds/Banner/banners.js"
click node_raid_api "https://github.com/shikihtm/momoi-bot/blob/main/cmds/Raid/boss.js"
click node_banner_assets "https://github.com/shikihtm/momoi-bot/tree/main/config/Game_Init_Config/BannerConfig"
click node_raid_assets "https://github.com/shikihtm/momoi-bot/tree/main/config/Game_Init_Config/RaidConfig"
click node_student_data "https://github.com/shikihtm/momoi-bot/tree/main/Utils/Students"
click node_asset_access "https://github.com/shikihtm/momoi-bot/blob/main/modules/Database.access.js"
click node_banner_crawler "https://github.com/shikihtm/momoi-bot/blob/main/Database/BannerCrawler.js"
click node_banner_state "https://github.com/shikihtm/momoi-bot/blob/main/config/Game_Init_Config/BannerConfig/bannerLink.json"
click node_banner_limits "https://github.com/shikihtm/momoi-bot/blob/main/config/DatabaseConfig/limits.json"
click node_raid_monitor "https://github.com/shikihtm/momoi-bot/blob/main/Database/Raid.js"
click node_raid_state "https://github.com/shikihtm/momoi-bot/blob/main/config/DatabaseConfig/Upcoming.raid.json"
click node_banner_alert "https://github.com/shikihtm/momoi-bot/blob/main/modules/PingWhen.Banner.js"
click node_raid_alert "https://github.com/shikihtm/momoi-bot/blob/main/modules/PingWhen.Boss.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_discord_client,node_interaction_dispatch,node_sensei toneBlue
class node_banner_command,node_raid_command,node_ping_command,node_banner_api,node_raid_api toneAmber
class node_banner_crawler,node_banner_state,node_banner_limits,node_raid_monitor,node_raid_state,node_banner_alert,node_raid_alert,node_game_api toneMint
class node_banner_assets,node_raid_assets,node_student_data,node_asset_access toneRose
class node_wiki,node_channel toneIndigo
```

## Components

### Discord runtime

- [Bot client](https://github.com/shikihtm/momoi-bot/blob/main/src/index.js): `src/index.js`
- [Interaction dispatch](https://github.com/shikihtm/momoi-bot/blob/main/events/interactionCreate.js): `events/interactionCreate.js`

### User requests

- [Banner command](https://github.com/shikihtm/momoi-bot/blob/main/cmds/Banner/banners.js): `cmds/Banner/banners.js`
- [Raid command](https://github.com/shikihtm/momoi-bot/blob/main/cmds/Raid/boss.js): `cmds/Raid/boss.js`
- [Latency command](https://github.com/shikihtm/momoi-bot/blob/main/cmds/server/ping.js): `cmds/server/ping.js`
- [Banner API](https://github.com/shikihtm/momoi-bot/blob/main/cmds/Banner/banners.js): `cmds/Banner/banners.js`
- [Raid API](https://github.com/shikihtm/momoi-bot/blob/main/cmds/Raid/boss.js): `cmds/Raid/boss.js`

### Change monitoring

- [Banner crawler](https://github.com/shikihtm/momoi-bot/blob/main/Database/BannerCrawler.js): `Database/BannerCrawler.js`
- [Banner state](https://github.com/shikihtm/momoi-bot/blob/main/config/Game_Init_Config/BannerConfig/bannerLink.json): `config/Game_Init_Config/BannerConfig/bannerLink.json`
- [Crawl limits](https://github.com/shikihtm/momoi-bot/blob/main/config/DatabaseConfig/limits.json): `config/DatabaseConfig/limits.json`
- [Raid monitor](https://github.com/shikihtm/momoi-bot/blob/main/Database/Raid.js): `Database/Raid.js`
- [Upcoming raid state](https://github.com/shikihtm/momoi-bot/blob/main/config/DatabaseConfig/Upcoming.raid.json): `config/DatabaseConfig/Upcoming.raid.json`
- [Banner alerts](https://github.com/shikihtm/momoi-bot/blob/main/modules/PingWhen.Banner.js): `modules/PingWhen.Banner.js`
- [Raid alerts](https://github.com/shikihtm/momoi-bot/blob/main/modules/PingWhen.Boss.js): `modules/PingWhen.Boss.js`

### Game data

- [Banner assets](https://github.com/shikihtm/momoi-bot/tree/main/config/Game_Init_Config/BannerConfig): `config/Game_Init_Config/BannerConfig`
- [Raid assets](https://github.com/shikihtm/momoi-bot/tree/main/config/Game_Init_Config/RaidConfig): `config/Game_Init_Config/RaidConfig`
- [Student metadata](https://github.com/shikihtm/momoi-bot/tree/main/Utils/Students): `Utils/Students`
- [Asset access](https://github.com/shikihtm/momoi-bot/blob/main/modules/Database.access.js): `modules/Database.access.js`

### Other components

- **Discord user**
- **Blue Archive API**
- **Banner-list wiki**
- **Configured Discord channel**

## Connections

- Discord user → Bot client: uses bot (evidence: `README.md`)
- Bot client → Interaction dispatch: registers events (evidence: `src/index.js`)
- Interaction dispatch → Banner command: dispatches (evidence: `events/interactionCreate.js`)
- Interaction dispatch → Raid command: dispatches (evidence: `events/interactionCreate.js`)
- Interaction dispatch → Latency command: dispatches (evidence: `events/interactionCreate.js`)
- Banner command → Banner API: fetches (evidence: `cmds/Banner/banners.js`)
- Banner API → Blue Archive API: requests banners (evidence: `cmds/Banner/banners.js`)
- Banner command → Banner assets: reads (evidence: `cmds/Banner/banners.js`)
- Banner command → Student metadata: reads (evidence: `cmds/Banner/banners.js`)
- Banner command → Discord user: replies embeds (evidence: `cmds/Banner/banners.js`)
- Raid command → Raid API: fetches (evidence: `cmds/Raid/boss.js`)
- Raid API → Blue Archive API: requests raids (evidence: `cmds/Raid/boss.js`)
- Raid command → Raid assets: reads (evidence: `cmds/Raid/boss.js`)
- Raid command → Discord user: replies embed (evidence: `cmds/Raid/boss.js`)
- Latency command → Discord user: replies latency (evidence: `cmds/server/ping.js`)
- Bot client → Banner crawler: starts checks (evidence: `src/index.js`)
- Bot client → Raid monitor: starts checks (evidence: `src/index.js`)
- Banner crawler → Banner-list wiki: scrapes listing (evidence: `Database/BannerCrawler.js`)
- Banner crawler → Blue Archive API: looks up students (evidence: `Database/BannerCrawler.js`)
- Banner crawler → Banner state: updates links (evidence: `Database/BannerCrawler.js`)
- Banner crawler → Crawl limits: updates limits (evidence: `Database/BannerCrawler.js`)
- Banner crawler → Banner alerts: announces changes (evidence: `Database/BannerCrawler.js`)
- Banner alerts → Banner assets: reads assets (evidence: `modules/PingWhen.Banner.js`)
- Banner alerts → Student metadata: reads school data (evidence: `modules/PingWhen.Banner.js`)
- Banner alerts → Configured Discord channel: sends embed (evidence: `modules/PingWhen.Banner.js`)
- Raid monitor → Blue Archive API: polls raids (evidence: `Database/Raid.js`)
- Raid monitor → Upcoming raid state: stores upcoming (evidence: `Database/Raid.js`)
- Raid monitor → Raid alerts: announces changes (evidence: `Database/Raid.js`)
- Raid alerts → Raid assets: reads assets (evidence: `modules/PingWhen.Boss.js`)
- Raid alerts → Configured Discord channel: sends embed (evidence: `modules/PingWhen.Boss.js`)
- Asset access → Banner assets: loads assets (evidence: `modules/Database.access.js`)
- Asset access → Raid assets: loads assets (evidence: `modules/Database.access.js`)
- Asset access → Student metadata: loads metadata (evidence: `modules/Database.access.js`)
