feat(voice): retry unrecoverable disconnects
Build Validation / build (push) Successful in 48s

This commit is contained in:
fraujulian committed 2026-09-28 13:38:14 +02:00
1 parent 2b90b2775f
commit ac20d12b13
3 files changed
+47 -6

No files matched your search

+12 -6
View File
@@ -114,6 +114,7 @@ type AudioManagerOptions = {
};
source?: { type: 'url'; url: string } | { type: 'file'; path: string };
renewIntervalMs?: number | false;
reconnectAttempts?: number;
connectTimeoutMs?: number;
onError?: (error: Error) => void;
volume?: {
@@ -124,16 +125,18 @@ type AudioManagerOptions = {
```
`connectTimeoutMs` and numeric `renewIntervalMs` values must be whole milliseconds from `1` through `2_147_483_647`.
`reconnectAttempts` must be a non-negative safe integer. URL sources must use `http:` or `https:`.
`volume.initialPercent` must be a finite number from `0` through `100` and requires `volume.enabled: true`.
### Defaults
| Option | Default |
| ------------------ | ---------- |
| `ffmpeg.mode` | `'native'` |
| `connectTimeoutMs` | `20_000` |
| `renewIntervalMs` | `false` |
| `volume.enabled` | `false` |
| Option | Default |
| ------------------- | ---------- |
| `ffmpeg.mode` | `'native'` |
| `connectTimeoutMs` | `20_000` |
| `renewIntervalMs` | `false` |
| `reconnectAttempts` | `0` |
| `volume.enabled` | `false` |
### Methods
@@ -188,6 +191,9 @@ Connection renewal is disabled by default because `@discordjs/voice` handles rec
`renewIntervalMs` only when an application has a measured need for periodic restarts. `stop()` and `dispose()` always
clear the renewal timer.
After an unrecoverable disconnect, playback stops by default. Set `reconnectAttempts` to retry joining the configured
voice channel and restarting the current source.
## Errors
The package exports these error classes: