MythEclipse 0060c4a097 feat: batch AI analysis messages for faster processing
- Change runLLMAnalysis to accept array of texts instead of single text
- Batch up to 5 messages per AI request instead of 1 message per request
- drainQueue now collects batch before sending to AI API
- Reduces API calls by 5x and speeds up analysis significantly
- System prompt updated to handle batch JSON array responses

This resolves:
- Slow AI analysis (3 messages every 15 seconds)
- Too many API calls (one per message)
- Long queue backlog

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 04:08:41 +07:00
2026-05-13 15:28:25 +07:00
2026-05-12 19:38:23 +07:00

🎙️ Discord Voice Recorder Bot

Bot Discord yang otomatis join ke voice channel saat startup dan merekam suara semua pengguna yang bicara. File audio disimpan secara lokal dalam format .ogg.

Dibangun dengan Bun + discord.js + @discordjs/voice.


📋 Prasyarat

  • Bun >= 1.0
  • FFmpeg (untuk encoding audio)
    # Ubuntu/Debian
    sudo apt install ffmpeg
    
    # Arch
    sudo pacman -S ffmpeg
    
  • Discord Bot dengan permission:
    • Connect (join voice channel)
    • Use Voice Activity
    • Read Messages/View Channels
    • Privileged Intents: Server Members Intent (aktifkan di Developer Portal)

⚙️ Setup

1. Clone & Install

cd /path/to/bot
bun install

2. Konfigurasi .env

cp .env.example .env

Edit .env:

DISCORD_TOKEN=your_bot_token_here
VOICE_CHANNEL_ID=your_voice_channel_id_here
GUILD_ID=your_guild_id_here
RECORDINGS_DIR=./recordings

Cara mendapatkan ID:

  • Aktifkan Developer Mode di Discord (Settings → Advanced → Developer Mode)
  • Klik kanan pada voice channel → Copy Channel ID → paste ke VOICE_CHANNEL_ID
  • Klik kanan pada server/guild → Copy Server ID → paste ke GUILD_ID
  • Token bot dari Discord Developer Portal → Bot → Reset Token

3. Invite Bot ke Server

Di Developer Portal → OAuth2 → URL Generator:

  • Scopes: bot
  • Bot Permissions: Connect, Use Voice Activity, View Channels

Copy URL, buka di browser, pilih server.


🚀 Menjalankan Bot

# Development (auto-restart saat file berubah)
bun run dev

# Production
bun run start

Bot akan langsung join ke voice channel yang ditentukan dalam .env.


📁 Struktur File Rekaman

recordings/
  ├── 123456789-1709900000000.ogg   # <user-id>-<timestamp>.ogg
  ├── 987654321-1709900001234.ogg
  └── ...

Setiap kali user bicara dan berhenti (>1 detik diam), satu file .ogg baru dibuat.


📁 Struktur Proyek

bot/
├── src/
│   ├── index.ts       # Entry point — login & auto-join
│   └── recorder.ts    # Core recording logic
├── recordings/        # File audio tersimpan (otomatis dibuat)
├── .env               # Konfigurasi (buat dari .env.example)
├── .env.example
├── package.json
└── tsconfig.json
Description
No description provided
Readme 16 MiB
Languages
Squirrel 96.6%
TypeScript 3.3%