# orange-juice-tech/inforanger-bot-oficial-da-orange architecture

> Architecture diagram of the GitHub repository orange-juice-tech/inforanger-bot-oficial-da-orange, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/orange-juice-tech/inforanger-bot-oficial-da-orange
- Repository: https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange

## Overview

##### Project type and purpose
- InfOranger is a Node.js/TypeScript Discord bot. Its primary purpose is to automate community tasks on a Discord server (sending messages, responding to slash commands, scheduling jobs) and to serve as an open-source reference for contributors.

##### File structure
- Top‐level:
- configs/ – constants and secrets loaded from environment
- loaders/ – modules that discover & register commands, events, jobs
- commands/ – individual slash and user commands (with params)
- events/ – event handlers, organized under system (ready, load*)
- jobs/ – scheduled tasks (e.g. hello.ts)
- shared/utils – generic helpers (e.g. getEnv)
- storage/ – placeholder for persistence (currently empty)
- src/client.ts & src/index.ts – bot initialization and entrypoint
- Patterns: loader pattern (scan folders, auto‐register), modular separation of commands vs events vs jobs.

##### README for additional insights
- Uses TypeScript for static typing.
- It’s open source, expects contributions following clear conventions.

##### Detailed elements
- Labels: e.g. “Slash Command Loader”, “Event Listener: ready”, “Job Scheduler”
- Configuration sources (env files, configs/*.ts) feeding into the entrypoint

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry & Config Loader
    subgraph "Entry & Config Loader"
        direction TB
        IDX["index.ts"]:::yellow
        GETENV["getEnv.ts"]:::yellow
        CHANNELS["channels.ts"]:::yellow
        GENERAL["general.ts"]:::yellow
        SECRETS["secrets.ts"]:::yellow
    end

    %% Bot Client
    subgraph "Bot Client"
        direction TB
        CLIENT["client.ts"]:::blue
    end

    %% Loader Modules
    subgraph "Loader Modules"
        direction TB
        CMDLDR["commandsLoader.ts"]:::blue
        EVTLDR["eventsLoader.ts"]:::blue
        JOBLDR["jobsLoader.ts"]:::blue
    end

    %% Command Handlers
    subgraph "Command Handlers"
        direction TB
        PINGCMD["Ping.ts"]:::green
        SAYCMD["say.command.ts"]:::green
        SAYP["say.params.ts"]:::green
        PINGMENU["pingUserMenu.ts"]:::green
    end

    %% Event Handlers
    subgraph "Event Handlers"
        direction TB
        LOADCOMP["loadComponents.ts"]:::green
        LOADSLASH["loadSlashCommand.ts"]:::green
        LOADUSER["loadUserCommand.ts"]:::green
        READY["ready.ts"]:::green
    end

    %% Job Scheduler & Jobs
    subgraph "Jobs"
        direction TB
        HELLO["hello.ts"]:::green
    end

    %% Storage
    subgraph "Storage"
        direction TB
        STOR["Storage (placeholder)"]:::gray
    end

    %% Interfaces
    subgraph "Interfaces"
        direction TB
        ICMD["commands.ts"]:::yellow
        IEVT["events.ts"]:::yellow
        IJOB["jobs.ts"]:::yellow
    end

    %% External Service
    DISCORD["Discord API"]:::external

    %% Relationships
    IDX -->|reads env| GETENV
    GETENV -->|loads configs| CHANNELS
    GETENV --> GENERAL
    GETENV --> SECRETS
    IDX -->|instantiates client| CLIENT

    CLIENT -->|uses loader| CMDLDR
    CLIENT -->|uses loader| EVTLDR
    CLIENT -->|uses loader| JOBLDR

    CMDLDR -->|scans| PINGCMD
    CMDLDR --> SAYCMD
    CMDLDR --> SAYP
    CMDLDR --> PINGMENU

    EVTLDR --> LOADCOMP
    EVTLDR --> LOADSLASH
    EVTLDR --> LOADUSER
    EVTLDR --> READY

    JOBLDR --> HELLO
    HELLO -->|schedules jobs| CLIENT

    CLIENT -->|sends/receives| DISCORD
    DISCORD -->|events| CLIENT

    %% Click Events
    click IDX "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/index.ts"
    click GETENV "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/shared/utils/getEnv.ts"
    click CHANNELS "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/configs/channels.ts"
    click GENERAL "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/configs/general.ts"
    click SECRETS "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/configs/secrets.ts"
    click CLIENT "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/client.ts"
    click CMDLDR "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/loaders/commandsLoader.ts"
    click EVTLDR "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/loaders/eventsLoader.ts"
    click JOBLDR "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/loaders/jobsLoader.ts"
    click PINGCMD "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/commands/dev/Ping.ts"
    click SAYCMD "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/commands/dev/Say/say.command.ts"
    click SAYP "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/commands/dev/Say/say.params.ts"
    click PINGMENU "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/commands/dev/pingUserMenu.ts"
    click LOADCOMP "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/events/system/loadComponents.ts"
    click LOADSLASH "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/events/system/loadSlashCommand.ts"
    click LOADUSER "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/events/system/loadUserCommand.ts"
    click READY "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/events/system/ready.ts"
    click HELLO "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/jobs/hello.ts"
    click STOR "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/tree/main/src/storage/"
    click ICMD "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/interfaces/commands.ts"
    click IEVT "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/interfaces/events.ts"
    click IJOB "https://github.com/orange-juice-tech/inforanger-bot-oficial-da-orange/blob/main/src/interfaces/jobs.ts"

    %% Styles
    classDef blue fill:#cce5ff,stroke:#3399ff,stroke-width:1px;
    classDef green fill:#d4edda,stroke:#28a745,stroke-width:1px;
    classDef yellow fill:#fff3cd,stroke:#ffc107,stroke-width:1px;
    classDef gray fill:#e2e3e5,stroke:#6c757d,stroke-width:1px;
    classDef external fill:#f8d7da,stroke:#dc3545,stroke-width:1px;
```
