# nhqdung/gettoken architecture

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

- Interactive diagram: https://gitdiagram.com/nhqdung/gettoken
- Repository: https://github.com/nhqdung/gettoken

## Overview

GetToken is a small Vencord plugin for viewing and copying the current Discord account’s token. The user invokes `/token`; the command retrieves the token and opens a dialog, where the user can reveal it, view account identity, or copy it to the system clipboard. The dialog also reports copy failures, while invalid or unavailable tokens produce a toast. The plugin provides a separate author/about panel. The implementation is concentrated in `index.tsx`; `style.css` is imported there. Host services are shown as external because their implementations are not in this repository.

Main entry points: [`index.tsx`](https://github.com/nhqdung/gettoken/blob/main/index.tsx) (Token dialog), [`style.css`](https://github.com/nhqdung/gettoken/blob/main/style.css) (Plugin styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Plugin entry"]
  node_plugin_config["Plugin registration<br/>[index.tsx]"]
  node_token_command["&#96;/token&#96; command<br/>[index.tsx]"]
end

subgraph group_token["Token workflow"]
  node_token_manager["Token manager"]
  node_account_store[("Current-user store")]
  node_clipboard["Clipboard utility"]
end

subgraph group_presentation["User interface"]
  node_token_dialog["Token dialog<br/>[index.tsx]"]
  node_modal_api["Modal UI"]
  node_button["Button UI"]
  node_toast_api["Toast notifications"]
  node_error_boundary["Error boundary"]
  node_plugin_info["Author panel<br/>[index.tsx]"]
  node_styles["Plugin styles<br/>[style.css]"]
end

node_discord_user(("Discord user"))

node_discord_user -->|"invokes"| node_token_command
node_plugin_config -->|"registers"| node_token_command
node_token_command -->|"retrieves token"| node_token_manager
node_token_command -->|"opens"| node_token_dialog
node_token_command -->|"reports errors"| node_toast_api
node_token_dialog -->|"reads current user"| node_account_store
node_token_dialog -->|"copies token"| node_clipboard
node_token_dialog -->|"renders"| node_modal_api
node_token_dialog -->|"renders"| node_button
node_plugin_config -->|"provides about panel"| node_plugin_info
node_plugin_config -->|"wraps UI"| node_error_boundary
node_plugin_info -->|"is wrapped by"| node_error_boundary
node_token_dialog -->|"is wrapped by"| node_error_boundary
node_plugin_config -->|"imports"| node_styles

click node_plugin_config "https://github.com/nhqdung/gettoken/blob/main/index.tsx"
click node_token_command "https://github.com/nhqdung/gettoken/blob/main/index.tsx"
click node_token_dialog "https://github.com/nhqdung/gettoken/blob/main/index.tsx"
click node_plugin_info "https://github.com/nhqdung/gettoken/blob/main/index.tsx"
click node_styles "https://github.com/nhqdung/gettoken/blob/main/style.css"

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_plugin_config,node_token_command,node_discord_user toneBlue
class node_token_manager,node_account_store,node_clipboard toneAmber
class node_token_dialog,node_modal_api,node_button,node_toast_api,node_error_boundary,node_plugin_info,node_styles toneMint
```

## Components

### Plugin entry

- [Plugin registration](https://github.com/nhqdung/gettoken/blob/main/index.tsx): `index.tsx`
- [`/token` command](https://github.com/nhqdung/gettoken/blob/main/index.tsx): `index.tsx`

### Token workflow

- **Token manager**
- **Current-user store**
- **Clipboard utility**

### User interface

- [Token dialog](https://github.com/nhqdung/gettoken/blob/main/index.tsx): `index.tsx`
- **Modal UI**
- **Button UI**
- **Toast notifications**
- **Error boundary**
- [Author panel](https://github.com/nhqdung/gettoken/blob/main/index.tsx): `index.tsx`
- [Plugin styles](https://github.com/nhqdung/gettoken/blob/main/style.css): `style.css`

### Other components

- **Discord user**

## Connections

- Discord user → `/token` command: invokes (evidence: `README.md`)
- Plugin registration → `/token` command: registers (evidence: `index.tsx`)
- `/token` command → Token manager: retrieves token (evidence: `index.tsx`)
- `/token` command → Token dialog: opens (evidence: `index.tsx`)
- `/token` command → Toast notifications: reports errors (evidence: `index.tsx`)
- Token dialog → Current-user store: reads current user (evidence: `index.tsx`)
- Token dialog → Clipboard utility: copies token (evidence: `index.tsx`)
- Token dialog → Modal UI: renders (evidence: `index.tsx`)
- Token dialog → Button UI: renders (evidence: `index.tsx`)
- Plugin registration → Author panel: provides about panel (evidence: `index.tsx`)
- Plugin registration → Error boundary: wraps UI (evidence: `index.tsx`)
- Author panel → Error boundary: is wrapped by (evidence: `index.tsx`)
- Token dialog → Error boundary: is wrapped by (evidence: `index.tsx`)
- Plugin registration → Plugin styles: imports (evidence: `index.tsx`)
