diff --git a/packages/server-sdk/src/client.ts b/packages/server-sdk/src/client.ts index 3040b254d..372beeeb4 100644 --- a/packages/server-sdk/src/client.ts +++ b/packages/server-sdk/src/client.ts @@ -25,12 +25,12 @@ export class Client { private authenticateAttempts = 0 constructor(options: ClientOptions) { - const opts = defu, Required>[]>( + this.opts = defu, Required>[]>( options, { url: 'ws://localhost:6121/ws', possibleEvents: [] }, ) - this.websocket = new WebSocket(opts.url) + this.websocket = new WebSocket(this.opts.url) this.onEvent('module:authenticated', async (event) => { const auth = event.data.authenticated @@ -47,7 +47,7 @@ export class Client { this.websocket.onmessage = this.handleMessage.bind(this) this.websocket.onopen = () => { - if (opts.token) { + if (this.opts.token) { this.tryAuthenticate() } else { diff --git a/services/discord-bot/src/index.ts b/services/discord-bot/src/index.ts index 8d12fee17..71b92d4e0 100644 --- a/services/discord-bot/src/index.ts +++ b/services/discord-bot/src/index.ts @@ -14,7 +14,7 @@ async function main() { // await WhisperLargeV3Pipeline.getInstance() const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates] }) - const airiClient = new AiriClient({ name: 'discord-bot', possibleEvents: ['input:text', 'input:text:voice', 'input:voice'] }) + const airiClient = new AiriClient({ name: 'discord-bot', possibleEvents: ['input:text', 'input:text:voice', 'input:voice'], token: 'abcd' }) const voiceManager = new VoiceManager(client, airiClient) // When the client is ready, run this code (only once).