fix: initialize voice encryption libs before first connection
- await sodium.ready + nacl preload (same as original jukebox) - Add generateDependencyReport() for debugging - Add type declarations for libsodium-wrappers and tweetnacl Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1d4a48cf74
commit
9ac1034e5e
2 changed files with 11 additions and 0 deletions
|
|
@ -9,8 +9,11 @@ import {
|
|||
joinVoiceChannel, createAudioPlayer, createAudioResource,
|
||||
AudioPlayerStatus, NoSubscriberBehavior, getVoiceConnection,
|
||||
VoiceConnectionStatus, StreamType, entersState,
|
||||
generateDependencyReport,
|
||||
type VoiceConnection, type AudioResource,
|
||||
} from '@discordjs/voice';
|
||||
import sodium from 'libsodium-wrappers';
|
||||
import nacl from 'tweetnacl';
|
||||
import { ChannelType, Events, type VoiceState, type Message } from 'discord.js';
|
||||
import type { Plugin, PluginContext } from '../../core/plugin.js';
|
||||
import { sseBroadcast } from '../../core/sse.js';
|
||||
|
|
@ -481,6 +484,12 @@ const soundboardPlugin: Plugin = {
|
|||
fs.mkdirSync(SOUNDS_DIR, { recursive: true });
|
||||
fs.mkdirSync(NORM_CACHE_DIR, { recursive: true });
|
||||
persistedState = readPersistedState();
|
||||
|
||||
// Voice encryption libs must be initialized before first voice connection
|
||||
await sodium.ready;
|
||||
void nacl.randomBytes(1);
|
||||
console.log(generateDependencyReport());
|
||||
|
||||
console.log(`[Soundboard] ${listAllSounds().length} sounds, ${persistedState.totalPlays ?? 0} total plays`);
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue