feat: Add more base component to UI

This commit is contained in:
deytenit committed 2026-02-01 16:24:45 +03:00
1 parent ca20310460
commit df2abc06f2
116 files changed
+10379 -3473

No files matched your search

@@ -3,33 +3,36 @@ title: Interactive Voice Features
weight: 1
---
**Goal:** Implement sophisticated voice interactions that respect guild boundaries and manage ephemeral resources.
## 1. Resource Scoping Strategy
Voice features **MUST** be scoped to the Guild.
* **Pattern:** The Controller maintains a `Map<GuildID, Player>`.
* **Behavior:**
* **Join:** Create a Player for `Guild A` if none exists.
* **Leave:** Destroy the Player and release connections.
* **Isolation:** Commands in `Guild B` never affect `Guild A`.
- **Pattern:** The Controller maintains a `Map<GuildID, Player>`.
- **Behavior:**
- **Join:** Create a Player for `Guild A` if none exists.
- **Leave:** Destroy the Player and release connections.
- **Isolation:** Commands in `Guild B` never affect `Guild A`.
## 2. Command Orchestration
Voice features require a suite of commands coordinated via the Controller.
| Command | Action | Controller Logic |
| :--- | :--- | :--- |
| `/join` | Connect to channel | `createPlayer(guildId, channelId)` |
| Command | Action | Controller Logic |
| :------ | :----------------- | :---------------------------------- |
| `/join` | Connect to channel | `createPlayer(guildId, channelId)` |
| `/play` | Add track to queue | `getPlayer(guildId).enqueue(track)` |
| `/stop` | Disconnect | `destroyPlayer(guildId)` |
| `/stop` | Disconnect | `destroyPlayer(guildId)` |
## 3. State Persistence
Audio sessions are ephemeral.
* **Transient State:** Active audio stream (Lost on disconnect).
* **Durable State:** Queue/Playlist (Persisted in Controller until restart).
> [!TIP]
> **Resilience:** Separate the *Queue* logic from the *Voice Connection* logic. This allows the bot to reconnect without losing the user's playlist.
Audio sessions are ephemeral.
- **Transient State:** Active audio stream (Lost on disconnect).
- **Durable State:** Queue/Playlist (Persisted in Controller until restart).
> [!TIP] > **Resilience:** Separate the _Queue_ logic from the _Voice Connection_ logic. This allows the bot to reconnect without losing the user's playlist.
## 4. Implementation Sketch
@@ -55,4 +58,5 @@ class MusicController {
---
**See also:**
- [Discord.js Voice Guide](https://discordjs.guide/voice/)