# ihrz/ihrz architecture

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

- Interactive diagram: https://gitdiagram.com/ihrz/ihrz
- Repository: https://github.com/ihrz/ihrz

## Overview

iHorizon is a modular Discord server-management bot. The principal workflow begins with a Discord interaction, routes it through an interaction handler, and delivers a command or component response; event listeners also automate moderation, logging, and community features. The README documents broader capabilities including music, economy, backups, verification, and profiles. The excerpts support only a few concrete internal links, so other subsystem connections are omitted rather than inferred from directory names.

Main entry points: [`src/Events`](https://github.com/ihrz/ihrz/tree/dev/src/Events) (Guild events), [`src/core/modules/antiSpamEngine.ts`](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/antiSpamEngine.ts) (Anti-spam engine), [`src/Events/interaction`](https://github.com/ihrz/ihrz/tree/dev/src/Events/interaction) (Interaction handlers), [`src/Events/client/ready.ts`](https://github.com/ihrz/ihrz/blob/dev/src/Events/client/ready.ts) (Client readiness)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Bot entry"]
  node_interaction_handlers["Interaction handlers"]
  node_startup["Shard startup<br/>[index.ts]"]
  node_ready["Client readiness<br/>[ready.ts]"]
end

subgraph group_commands["Command features"]
  node_message_commands["Message commands"]
  node_hybrid_commands["Hybrid commands"]
  node_slash_commands["Slash commands"]
  node_moderation["Moderation tools"]
  node_music["Music player"]
  node_economy["Economy system"]
end

subgraph group_automation["Guild automation"]
  node_tickets["Ticket system<br/>[ticketsManager.ts]"]
  node_spam["Anti-spam engine<br/>[antiSpamEngine.ts]"]
  node_protection["Server protection"]
  node_logging["Logging engine<br/>[logsEngine.ts]"]
  node_guild_events["Guild events"]
  node_forms["Google Forms<br/>[googleForms.ts]"]
  node_transcripts["Ticket transcripts"]
end

subgraph group_shared["Shared services"]
  node_database_tables[("Database tables<br/>[tables.ts]")]
  node_card_ui["Card rendering<br/>[uiCard.ts]"]
  node_log_channel["Log channel lookup<br/>[logChannel.ts]"]
  node_log_cards["Log card sender<br/>[logCard.ts]"]
end

node_discord(("Discord users"))

node_discord -->|"sends interactions"| node_interaction_handlers
node_interaction_handlers -.->|"dispatches commands"| node_slash_commands
node_startup -.->|"starts client"| node_ready
node_ready -->|"initializes tables"| node_database_tables
node_spam -->|"looks up channel"| node_log_channel
node_spam -->|"builds card"| node_card_ui
node_logging -->|"sends cards"| node_log_cards
node_guild_events -->|"deletes guild forms"| node_forms
node_guild_events -->|"deletes transcripts"| node_transcripts
node_guild_events -->|"clears guild data"| node_database_tables
node_discord -.->|"requests moderation"| node_moderation
node_discord -.->|"requests playback"| node_music
node_discord -.->|"uses economy"| node_economy
node_discord -.->|"opens tickets"| node_tickets
node_discord -.->|"configures protection"| node_protection

click node_interaction_handlers "https://github.com/ihrz/ihrz/tree/dev/src/Events/interaction"
click node_message_commands "https://github.com/ihrz/ihrz/tree/dev/src/Interaction/MessageCommands"
click node_hybrid_commands "https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands"
click node_slash_commands "https://github.com/ihrz/ihrz/tree/dev/src/Interaction/SlashCommands"
click node_moderation "https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands/moderation"
click node_music "https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands/music"
click node_economy "https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands/economy"
click node_tickets "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/ticketsManager.ts"
click node_spam "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/antiSpamEngine.ts"
click node_protection "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/protectionEngine.ts"
click node_logging "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/logsEngine.ts"
click node_guild_events "https://github.com/ihrz/ihrz/tree/dev/src/Events"
click node_startup "https://github.com/ihrz/ihrz/blob/dev/src/index.ts"
click node_ready "https://github.com/ihrz/ihrz/blob/dev/src/Events/client/ready.ts"
click node_database_tables "https://github.com/ihrz/ihrz/blob/dev/src/core/database/tables.ts"
click node_card_ui "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/uiCard.ts"
click node_log_channel "https://github.com/ihrz/ihrz/blob/dev/src/core/functions/logChannel.ts"
click node_log_cards "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/logCard.ts"
click node_forms "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/googleForms.ts"
click node_transcripts "https://github.com/ihrz/ihrz/blob/dev/src/core/modules/ticketTranscripts.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_interaction_handlers,node_startup,node_ready,node_discord toneBlue
class node_message_commands,node_hybrid_commands,node_slash_commands,node_moderation,node_music,node_economy toneAmber
class node_tickets,node_spam,node_protection,node_logging,node_guild_events,node_forms,node_transcripts toneMint
class node_database_tables,node_card_ui,node_log_channel,node_log_cards toneRose
```

## Components

### Bot entry

- [Interaction handlers](https://github.com/ihrz/ihrz/tree/dev/src/Events/interaction): `src/Events/interaction`
- [Shard startup](https://github.com/ihrz/ihrz/blob/dev/src/index.ts): `src/index.ts`
- [Client readiness](https://github.com/ihrz/ihrz/blob/dev/src/Events/client/ready.ts): `src/Events/client/ready.ts`

### Command features

- [Message commands](https://github.com/ihrz/ihrz/tree/dev/src/Interaction/MessageCommands): `src/Interaction/MessageCommands`
- [Hybrid commands](https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands): `src/Interaction/HybridCommands`
- [Slash commands](https://github.com/ihrz/ihrz/tree/dev/src/Interaction/SlashCommands): `src/Interaction/SlashCommands`
- [Moderation tools](https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands/moderation): `src/Interaction/HybridCommands/moderation`
- [Music player](https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands/music): `src/Interaction/HybridCommands/music`
- [Economy system](https://github.com/ihrz/ihrz/tree/dev/src/Interaction/HybridCommands/economy): `src/Interaction/HybridCommands/economy`

### Guild automation

- [Ticket system](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/ticketsManager.ts): `src/core/modules/ticketsManager.ts`
- [Anti-spam engine](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/antiSpamEngine.ts): `src/core/modules/antiSpamEngine.ts`
- [Server protection](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/protectionEngine.ts): `src/core/modules/protectionEngine.ts`
- [Logging engine](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/logsEngine.ts): `src/core/modules/logsEngine.ts`
- [Guild events](https://github.com/ihrz/ihrz/tree/dev/src/Events): `src/Events`
- [Google Forms](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/googleForms.ts): `src/core/modules/googleForms.ts`
- [Ticket transcripts](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/ticketTranscripts.ts): `src/core/modules/ticketTranscripts.ts`

### Shared services

- [Database tables](https://github.com/ihrz/ihrz/blob/dev/src/core/database/tables.ts): `src/core/database/tables.ts`
- [Card rendering](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/uiCard.ts): `src/core/modules/uiCard.ts`
- [Log channel lookup](https://github.com/ihrz/ihrz/blob/dev/src/core/functions/logChannel.ts): `src/core/functions/logChannel.ts`
- [Log card sender](https://github.com/ihrz/ihrz/blob/dev/src/core/modules/logCard.ts): `src/core/modules/logCard.ts`

### Other components

- **Discord users**

## Connections

- Discord users → Interaction handlers: sends interactions (evidence: `src/Events/interaction/slashCommandHandler.ts`)
- Interaction handlers → Slash commands: dispatches commands
- Shard startup → Client readiness: starts client
- Client readiness → Database tables: initializes tables (evidence: `src/Events/client/ready.ts`)
- Anti-spam engine → Log channel lookup: looks up channel (evidence: `src/core/modules/antiSpamEngine.ts`)
- Anti-spam engine → Card rendering: builds card (evidence: `src/core/modules/antiSpamEngine.ts`)
- Logging engine → Log card sender: sends cards (evidence: `src/core/modules/logsEngine.ts`)
- Guild events → Google Forms: deletes guild forms (evidence: `src/Events/client/deleteDatabaseDataOnGuildLeave.ts`)
- Guild events → Ticket transcripts: deletes transcripts (evidence: `src/Events/client/deleteDatabaseDataOnGuildLeave.ts`)
- Guild events → Database tables: clears guild data (evidence: `src/Events/client/deleteDatabaseDataOnGuildLeave.ts`)
- Discord users → Moderation tools: requests moderation (evidence: `README.md`)
- Discord users → Music player: requests playback (evidence: `README.md`)
- Discord users → Economy system: uses economy (evidence: `README.md`)
- Discord users → Ticket system: opens tickets (evidence: `README.md`)
- Discord users → Server protection: configures protection (evidence: `README.md`)
