From eab8505889102cf99d7f82d871062de970200940 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Sat, 13 Jun 2026 13:35:41 +0700 Subject: [PATCH] chore(auto): task completed - unknown --- .../src/modules/command-handler/commandHandler.ts | 2 +- .../src/modules/command-handler/voice.handler.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/services/discord-gateway/src/modules/command-handler/commandHandler.ts b/services/discord-gateway/src/modules/command-handler/commandHandler.ts index 4a4f1f6..4c45b7a 100644 --- a/services/discord-gateway/src/modules/command-handler/commandHandler.ts +++ b/services/discord-gateway/src/modules/command-handler/commandHandler.ts @@ -69,7 +69,7 @@ export class CommandHandler { this.voiceController = voiceController; // Create domain-specific handlers with their dependencies - this.voiceHandler = new VoiceHandler(client, voiceController); + this.voiceHandler = new VoiceHandler(client, voiceController, this.redisPub); this.mediaHandler = new MediaHandler(); this.guildHandler = new GuildHandler(client); this.moderationHandler = new ModerationHandler(client); diff --git a/services/discord-gateway/src/modules/command-handler/voice.handler.ts b/services/discord-gateway/src/modules/command-handler/voice.handler.ts index 1ede355..b586864 100644 --- a/services/discord-gateway/src/modules/command-handler/voice.handler.ts +++ b/services/discord-gateway/src/modules/command-handler/voice.handler.ts @@ -1,7 +1,7 @@ import { type CommandMessage, type CommandReply } from "@bete/shared"; import { createChildLogger } from "@bete/shared/logger"; import type { Client } from "discord.js-selfbot-v13"; -import Redis from "ioredis"; +import type Redis from "ioredis"; import { config } from "../../shared/config/config.js"; import { discordPlayer } from "../voice-recording/player.js"; import { voiceTransmitter } from "../voice-recording/transmitter.js"; @@ -17,6 +17,7 @@ export class VoiceHandler { constructor( private client: Client | null, private voiceController: VoiceController | null, + private sharedRedis: Redis | null = null, ) {} setClient(client: Client): void { @@ -124,8 +125,8 @@ export class VoiceHandler { } try { - // Create a new Redis connection for the transmitter - const transmitRedis = new Redis(config.REDIS_URL); + // Reuse shared Redis connection from CommandHandler + const transmitRedis = this.sharedRedis ?? new (await import("ioredis")).default(config.REDIS_URL); await voiceTransmitter.start(transmitRedis); const status = voiceTransmitter.getStatus();