# seradotflac/nighty architecture

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

- Interactive diagram: https://gitdiagram.com/seradotflac/nighty
- Repository: https://github.com/seradotflac/nighty

## Overview

Nighty is described as a reversed source release of a Discord selfbot. Its likely user workflow is to use the Nighty application to initiate Discord actions and receive Discord state or responses. The tree shows a Discord client library, command framework, voice support, and a webview runtime, but Nighty.py and most application wiring were not sampled; links between those pieces are therefore limited. The bundled JavaScript is obfuscated, so its behavior cannot be mapped reliably.

Main entry points: [`discord/client.py`](https://github.com/seradotflac/nighty/blob/main/discord/client.py) (Discord client), [`webview/window.py`](https://github.com/seradotflac/nighty/blob/main/webview/window.py) (Webview window), [`discord/gateway.py`](https://github.com/seradotflac/nighty/blob/main/discord/gateway.py) (Gateway connection), [`discord/http.py`](https://github.com/seradotflac/nighty/blob/main/discord/http.py) (HTTP API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Nighty application"]
  node_nighty["Nighty entry<br/>[Nighty.py]"]
end

subgraph group_discord["Discord runtime"]
  node_client["Discord client<br/>[client.py]"]
  node_state["Connection state<br/>[state.py]"]
  node_gateway["Gateway connection<br/>[gateway.py]"]
  node_http["HTTP API<br/>[http.py]"]
end

subgraph group_features["Discord capabilities"]
  node_commands["Command framework<br/>[bot.py]"]
  node_context["Command context<br/>[context.py]"]
  node_message["Messages and channels<br/>[message.py]"]
  node_interactions["Interactions<br/>[interactions.py]"]
  node_voice["Voice client<br/>[voice_client.py]"]
  node_webhook["Webhook operations<br/>[async_.py]"]
  node_application["Application features<br/>[application.py]"]
end

subgraph group_ui["Webview runtime"]
  node_window["Webview window<br/>[window.py]"]
  node_backend["Native GUI backend<br/>[guilib.py]"]
  node_cocoa["Cocoa backend<br/>[cocoa.py]"]
  node_web_assets["Bundled web assets<br/>[main.js]"]
end

node_user(("User"))
node_discord_api(("Discord service"))

node_user -->|"uses"| node_nighty
node_client -->|"manages"| node_state
node_client -->|"requests"| node_http
node_client -->|"connects"| node_gateway
node_http -->|"sends requests"| node_discord_api
node_gateway -->|"opens connection"| node_discord_api
node_client -->|"supports"| node_commands
node_commands -->|"creates"| node_context
node_context -->|"accesses"| node_message
node_client -->|"exposes"| node_interactions
node_client -->|"supports"| node_voice
node_client -->|"supports"| node_webhook
node_client -->|"supports"| node_application
node_window -->|"delegates to"| node_backend
node_backend -.->|"selects platform"| node_cocoa
node_window -.->|"loads content"| node_web_assets

click node_nighty "https://github.com/seradotflac/nighty/blob/main/Nighty.py"
click node_client "https://github.com/seradotflac/nighty/blob/main/discord/client.py"
click node_state "https://github.com/seradotflac/nighty/blob/main/discord/state.py"
click node_gateway "https://github.com/seradotflac/nighty/blob/main/discord/gateway.py"
click node_http "https://github.com/seradotflac/nighty/blob/main/discord/http.py"
click node_commands "https://github.com/seradotflac/nighty/blob/main/discord/ext/commands/bot.py"
click node_context "https://github.com/seradotflac/nighty/blob/main/discord/ext/commands/context.py"
click node_message "https://github.com/seradotflac/nighty/blob/main/discord/message.py"
click node_interactions "https://github.com/seradotflac/nighty/blob/main/discord/interactions.py"
click node_voice "https://github.com/seradotflac/nighty/blob/main/discord/voice_client.py"
click node_webhook "https://github.com/seradotflac/nighty/blob/main/discord/webhook/async_.py"
click node_application "https://github.com/seradotflac/nighty/blob/main/discord/application.py"
click node_window "https://github.com/seradotflac/nighty/blob/main/webview/window.py"
click node_backend "https://github.com/seradotflac/nighty/blob/main/webview/guilib.py"
click node_cocoa "https://github.com/seradotflac/nighty/blob/main/webview/platforms/cocoa.py"
click node_web_assets "https://github.com/seradotflac/nighty/blob/main/nighty_web_files/a_data/main.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_nighty,node_user toneBlue
class node_client,node_state,node_gateway,node_http toneAmber
class node_commands,node_context,node_message,node_interactions,node_voice,node_webhook,node_application toneMint
class node_window,node_backend,node_cocoa,node_web_assets toneRose
class node_discord_api toneIndigo
```

## Components

### Nighty application

- [Nighty entry](https://github.com/seradotflac/nighty/blob/main/Nighty.py): `Nighty.py`

### Discord runtime

- [Discord client](https://github.com/seradotflac/nighty/blob/main/discord/client.py): `discord/client.py`
- [Connection state](https://github.com/seradotflac/nighty/blob/main/discord/state.py): `discord/state.py`
- [Gateway connection](https://github.com/seradotflac/nighty/blob/main/discord/gateway.py): `discord/gateway.py`
- [HTTP API](https://github.com/seradotflac/nighty/blob/main/discord/http.py): `discord/http.py`

### Discord capabilities

- [Command framework](https://github.com/seradotflac/nighty/blob/main/discord/ext/commands/bot.py): `discord/ext/commands/bot.py`
- [Command context](https://github.com/seradotflac/nighty/blob/main/discord/ext/commands/context.py): `discord/ext/commands/context.py`
- [Messages and channels](https://github.com/seradotflac/nighty/blob/main/discord/message.py): `discord/message.py`
- [Interactions](https://github.com/seradotflac/nighty/blob/main/discord/interactions.py): `discord/interactions.py`
- [Voice client](https://github.com/seradotflac/nighty/blob/main/discord/voice_client.py): `discord/voice_client.py`
- [Webhook operations](https://github.com/seradotflac/nighty/blob/main/discord/webhook/async_.py): `discord/webhook/async_.py`
- [Application features](https://github.com/seradotflac/nighty/blob/main/discord/application.py): `discord/application.py`

### Webview runtime

- [Webview window](https://github.com/seradotflac/nighty/blob/main/webview/window.py): `webview/window.py`
- [Native GUI backend](https://github.com/seradotflac/nighty/blob/main/webview/guilib.py): `webview/guilib.py`
- [Cocoa backend](https://github.com/seradotflac/nighty/blob/main/webview/platforms/cocoa.py): `webview/platforms/cocoa.py`
- [Bundled web assets](https://github.com/seradotflac/nighty/blob/main/nighty_web_files/a_data/main.js): `nighty_web_files/a_data/main.js`

### Other components

- **User**
- **Discord service**

## Connections

- User → Nighty entry: uses
- Discord client → Connection state: manages
- Discord client → HTTP API: requests
- Discord client → Gateway connection: connects
- HTTP API → Discord service: sends requests
- Gateway connection → Discord service: opens connection
- Discord client → Command framework: supports
- Command framework → Command context: creates
- Command context → Messages and channels: accesses
- Discord client → Interactions: exposes
- Discord client → Voice client: supports
- Discord client → Webhook operations: supports
- Discord client → Application features: supports
- Webview window → Native GUI backend: delegates to
- Native GUI backend → Cocoa backend: selects platform
- Webview window → Bundled web assets: loads content
