# noduspanic/dishka-disnake architecture

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

- Interactive diagram: https://gitdiagram.com/noduspanic/dishka-disnake
- Repository: https://github.com/noduspanic/dishka-disnake

## Overview

dishka-disnake adapts Disnake bot handlers and UI callbacks for Dishka dependency injection. The main flow is setup, Disnake dispatch, dependency resolution, then the application handler. The README documents the broader command and component support; sampled source confirms the injection, button, string-select, setup, and patch paths, while some documented subsystems were not sampled.

Main entry points: [`dishka_disnake/injector/wrap/_async.py`](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/wrap/_async.py) (Async injection), [`dishka_disnake/commands`](https://github.com/noduspanic/dishka-disnake/tree/main/dishka_disnake/commands) (Command adapters), [`dishka_disnake/injector/__init__.py`](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/__init__.py) (Injection decorators), [`dishka_disnake/setup/__init__.py`](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/setup/__init__.py) (Dishka setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Disnake integration"]
  node_setup["Dishka setup<br/>[__init__.py]"]
  node_cog["Injected Cog<br/>[cog.py]"]
  node_patch["Parameter patch<br/>[patch.py]"]
end

subgraph group_handlers["Command handlers"]
  node_commands["Command adapters"]
  node_slash["Slash commands<br/>[slash.py]"]
  node_context_commands["Context commands<br/>[ctx_menus.py]"]
  node_prefix_commands["Prefix commands<br/>[ctx.py]"]
end

subgraph group_components["UI components"]
  node_button["Button support<br/>[button.py]"]
  node_selects["Select support"]
  node_modal["Modal support<br/>[modal.py]"]
end

subgraph group_injection["Dependency injection"]
  node_inject_api["Injection decorators<br/>[__init__.py]"]
  node_async_wrapper["Async injection<br/>[_async.py]"]
  node_sync_wrapper["Sync injection<br/>[_sync.py]"]
  node_signatures["Signature filtering<br/>[sign.py]"]
  node_state["Container state<br/>[__init__.py]"]
end

node_developer(("Bot developer"))
node_disnake["Disnake runtime"]
node_dishka["Dishka container"]
node_app_handlers["Bot handlers"]

node_developer -->|"configures"| node_setup
node_setup -->|"stores container"| node_state
node_setup -->|"patches parameters"| node_patch
node_cog -->|"checks patch"| node_patch
node_developer -->|"declares commands"| node_commands
node_commands -->|"provides"| node_slash
node_commands -->|"provides"| node_context_commands
node_commands -->|"provides"| node_prefix_commands
node_developer -->|"defines callbacks"| node_button
node_developer -->|"defines callbacks"| node_selects
node_developer -->|"defines callbacks"| node_modal
node_slash -->|"wraps callbacks"| node_async_wrapper
node_context_commands -->|"wraps callbacks"| node_async_wrapper
node_button -->|"wraps callbacks"| node_async_wrapper
node_selects -->|"wraps callbacks"| node_async_wrapper
node_modal -->|"wraps callbacks"| node_async_wrapper
node_inject_api -->|"selects async"| node_async_wrapper
node_inject_api -->|"selects sync"| node_sync_wrapper
node_async_wrapper -->|"reads container"| node_state
node_sync_wrapper -->|"reads container"| node_state
node_async_wrapper -->|"resolves dependencies"| node_dishka
node_sync_wrapper -->|"resolves dependencies"| node_dishka
node_inject_api -->|"filters annotations"| node_signatures
node_disnake -->|"dispatches callbacks"| node_async_wrapper
node_async_wrapper -->|"invokes handler"| node_app_handlers

click node_setup "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/setup/__init__.py"
click node_cog "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/cog.py"
click node_patch "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/patch.py"
click node_commands "https://github.com/noduspanic/dishka-disnake/tree/main/dishka_disnake/commands"
click node_slash "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/commands/slash.py"
click node_context_commands "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/commands/ctx_menus.py"
click node_prefix_commands "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/commands/ctx.py"
click node_inject_api "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/__init__.py"
click node_async_wrapper "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/wrap/_async.py"
click node_sync_wrapper "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/wrap/_sync.py"
click node_signatures "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/base/sign.py"
click node_state "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/state_management/__init__.py"
click node_button "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/ui/button.py"
click node_selects "https://github.com/noduspanic/dishka-disnake/tree/main/dishka_disnake/ui/select"
click node_modal "https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/ui/modal.py"

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_setup,node_cog,node_patch toneBlue
class node_commands,node_slash,node_context_commands,node_prefix_commands toneAmber
class node_button,node_selects,node_modal,node_app_handlers toneMint
class node_inject_api,node_async_wrapper,node_sync_wrapper,node_signatures,node_state toneRose
class node_developer,node_disnake,node_dishka toneIndigo
```

## Components

### Disnake integration

- [Dishka setup](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/setup/__init__.py): `dishka_disnake/setup/__init__.py`
- [Injected Cog](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/cog.py): `dishka_disnake/cog.py`
- [Parameter patch](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/patch.py): `dishka_disnake/patch.py`

### Command handlers

- [Command adapters](https://github.com/noduspanic/dishka-disnake/tree/main/dishka_disnake/commands): `dishka_disnake/commands`
- [Slash commands](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/commands/slash.py): `dishka_disnake/commands/slash.py`
- [Context commands](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/commands/ctx_menus.py): `dishka_disnake/commands/ctx_menus.py`
- [Prefix commands](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/commands/ctx.py): `dishka_disnake/commands/ctx.py`

### UI components

- [Button support](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/ui/button.py): `dishka_disnake/ui/button.py`
- [Select support](https://github.com/noduspanic/dishka-disnake/tree/main/dishka_disnake/ui/select): `dishka_disnake/ui/select`
- [Modal support](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/ui/modal.py): `dishka_disnake/ui/modal.py`

### Dependency injection

- [Injection decorators](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/__init__.py): `dishka_disnake/injector/__init__.py`
- [Async injection](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/wrap/_async.py): `dishka_disnake/injector/wrap/_async.py`
- [Sync injection](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/injector/wrap/_sync.py): `dishka_disnake/injector/wrap/_sync.py`
- [Signature filtering](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/base/sign.py): `dishka_disnake/base/sign.py`
- [Container state](https://github.com/noduspanic/dishka-disnake/blob/main/dishka_disnake/state_management/__init__.py): `dishka_disnake/state_management/__init__.py`

### Other components

- **Bot developer**
- **Disnake runtime**
- **Dishka container**
- **Bot handlers**

## Connections

- Bot developer → Dishka setup: configures
- Dishka setup → Container state: stores container
- Dishka setup → Parameter patch: patches parameters
- Injected Cog → Parameter patch: checks patch
- Bot developer → Command adapters: declares commands
- Command adapters → Slash commands: provides
- Command adapters → Context commands: provides
- Command adapters → Prefix commands: provides
- Bot developer → Button support: defines callbacks
- Bot developer → Select support: defines callbacks
- Bot developer → Modal support: defines callbacks
- Slash commands → Async injection: wraps callbacks
- Context commands → Async injection: wraps callbacks
- Button support → Async injection: wraps callbacks
- Select support → Async injection: wraps callbacks
- Modal support → Async injection: wraps callbacks
- Injection decorators → Async injection: selects async
- Injection decorators → Sync injection: selects sync
- Async injection → Container state: reads container
- Sync injection → Container state: reads container
- Async injection → Dishka container: resolves dependencies
- Sync injection → Dishka container: resolves dependencies
- Injection decorators → Signature filtering: filters annotations
- Disnake runtime → Async injection: dispatches callbacks
- Async injection → Bot handlers: invokes handler
