feat: add web interface and WebSocket server for real-time audio transmission to Discord

This commit is contained in:
baharsah
2026-05-13 00:32:27 +07:00
parent 1a5449f16d
commit 18cf941da0
7 changed files with 405 additions and 2 deletions
+13
View File
@@ -1,6 +1,9 @@
import { Client } from "discord.js-selfbot-v13";
import { startRecording } from "./recorder";
import { config } from "./config";
import { startWebserver } from "./webserver";
import { discordPlayer } from "./player";
import { getVoiceConnection } from "@discordjs/voice";
// Validasi environment variables
const token = process.env.DISCORD_TOKEN;
@@ -42,6 +45,16 @@ client.on("ready", async () => {
console.log(`[bot] Joining voice channel: #${channel.name} (${channel.id})`);
}
await startRecording(client, channel as any);
// Set up player connection
const connection = getVoiceConnection(guildId!);
if (connection) {
discordPlayer.setConnection(connection);
console.log("[bot] Player connected to voice channel");
}
// Start Webserver
startWebserver(3000);
});
client.on("error", (err) => {