Bot Discord untuk latihan bahasa dengan fitur percakapan real-time, terjemahan multibahasa, dan voice chat AI menggunakan Gemini AI dan Google Cloud Speech.
- Translator Multibahasa - Terjemahan akurat dengan Gemini AI ke 5 bahasa (ID, EN, JA, KO, ZH)
- Percakapan Real-time - Chat dengan AI yang memiliki memory per user
- Mode Pembelajaran - Feedback grammar dan vocabulary dengan analisis mendalam
- Voice Chat AI - Percakapan suara real-time dengan AI menggunakan Google Cloud Speech
- Text-to-Speech AI - Konversi teks ke suara menggunakan Gemini AI (phonetic analysis)
- Pengaturan Bahasa - Preferensi bahasa per user untuk pengalaman personal
[Discord User (Text/Voice Input)]
โ
[Discord Bot (Node.js + discord.js v14)]
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Core Services โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โข Gemini AI (Chat, Translation, โ
โ Grammar Check, Learning, TTS) โ
โ โข Google Cloud Speech-to-Text โ
โ โข @discordjs/voice (Voice Handling) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
[Discord Response (Text/Audio/Embed)]
| Komponen | Teknologi |
|---|---|
| Discord Bot | discord.js v14, Node.js |
| AI Language Processing | Google Gemini AI (gemini-1.5-flash) |
| Translation | Google Gemini AI |
| Text-to-Speech | Google Gemini AI (phonetic analysis) |
| Speech-to-Text | Google Cloud Speech-to-Text |
| Voice Handling | @discordjs/voice, prism-media, ffmpeg |
- Node.js (v16 atau lebih tinggi)
- Discord Bot Token - Discord Developer Portal
- Google Gemini AI API Key - Google AI Studio
- Google Cloud Project dengan Speech API enabled - Google Cloud Console
- Google Cloud Service Account Key (JSON file)
- Clone repository
git clone <repository-url>
cd poligot-bot- Install dependencies
npm install- Setup environment variables
# Copy the example file and configure
cp .env.example.txt .env
# Edit .env file dengan konfigurasi Anda- Configure .env file
# Discord Bot Configuration
DISCORD_TOKEN=your_discord_bot_token_here
# Bot Command Prefix (dapat diubah sesuai keinginan)
# Contoh: !, >, $, &, atau karakter lain
PREFIX=>
# Gemini AI Configuration
GEMINI_API_KEY=your_gemini_api_key_here
# Google Cloud Speech Configuration
GOOGLE_CLOUD_PROJECT_ID=your_google_cloud_project_id
GOOGLE_CLOUD_KEY_FILE=./google-cloud-key.jsonNote: Prefix bisa diubah sesuai keinginan di .env. Semua contoh command di bawah menggunakan ! tapi sesuaikan dengan PREFIX yang Anda set.
-
Setup Google Cloud
- Buat project di Google Cloud Console
- Enable Speech-to-Text API
- Buat Service Account dan download JSON key
- Simpan JSON key sebagai
google-cloud-key.jsondi root folder
-
Run the bot
npm start
# atau untuk development
npm run dev!chat <pesan>- Percakapan dengan AI (ada memory)!chat clear- Hapus riwayat percakapan!chat history- Lihat riwayat percakapan
!translate <teks>- Terjemahan otomatis!translate <kode> <teks>- Terjemahan ke bahasa tertentu!tr- Alias untuk translate
!belajar <teks>- Feedback pembelajaran multibahasa!grammar <teks>- Grammar check multibahasa!learn- Alias untuk belajar
!language- Lihat/ubah bahasa preferensi!language <kode>- Set bahasa (id, en, ja, ko, zh)!lang- Alias untuk language
!voicechat start- Mulai percakapan suara dengan AI!voicechat stop- Stop voice chat!voicechat status- Status voice session!vc- Alias untuk voicechat
!join- Bot masuk voice channel!leave- Bot keluar voice channel!tts <teks>- Text-to-speech dengan Gemini AI
!ping- Cek status dan latency!help- Panduan lengkap
| Kode | Bahasa | Flag | Google Cloud Code |
|---|---|---|---|
id |
Indonesian | ๐ฎ๐ฉ | id-ID |
en |
English | ๐บ๐ธ | en-US |
ja |
Japanese | ๐ฏ๐ต | ja-JP |
ko |
Korean | ๐ฐ๐ท | ko-KR |
zh |
Chinese | ๐จ๐ณ | zh-CN |
# Ubah bahasa preferensi ke Jepang
!language ja
# Chat dalam bahasa Jepang
!chat ใใใซใกใฏ๏ผๅ
ๆฐใงใใ๏ผ
# Mulai voice chat AI
!voicechat start
# Terjemahan Korea ke Inggris
!translate en ์๋
ํ์ธ์
# Belajar bahasa Mandarin
!belajar ๆๆณๅญฆไน ไธญๆ
# Grammar check
!grammar I are happy
# TTS dengan Gemini AI
!tts ja ใใใซใกใฏใไปๆฅใฏใใๅคฉๆฐใงใใญpoligot-bot/
โโ bot/
โ โโ index.js # Main bot entry point
โ โโ commands/ # Command implementations
โ โโ help.js # Help command
โ โโ ping.js # Ping command
โ โโ chat.js # Chat with memory
โ โโ translate.js # Translation (tr alias)
โ โโ belajar.js # Learning mode (learn alias)
โ โโ grammar.js # Grammar check
โ โโ language.js # Language settings (lang alias)
โ โโ voicechat.js # Voice chat AI (vc alias)
โ โโ join.js # Join voice
โ โโ leave.js # Leave voice
โ โโ tts.js # Text-to-speech with Gemini AI
โโ services/
โ โโ gemini.js # Gemini AI service
โ โโ googleCloudSpeech.js # Google Cloud Speech service
โโ temp/ # Temporary audio files
โโ package.json
โโ .env.example.txt # Environment template
โโ .gitignore
โโ README.md
- Create new file in
bot/commands/ - Follow this template:
const { EmbedBuilder } = require('discord.js');
const GeminiAI = require('../../services/gemini');
module.exports = {
data: {
name: 'commandname',
description: 'Command description',
},
async execute(message, args, client) {
const gemini = new GeminiAI();
try {
// Command logic here
const response = await gemini.generateText(prompt);
const embed = new EmbedBuilder()
.setColor(0x4285f4)
.setTitle('Command Title')
.setDescription(response.content)
.setFooter({ text: 'Powered by Gemini AI' });
await message.reply({ embeds: [embed] });
} catch (error) {
console.error('Command error:', error);
await message.reply('โ Terjadi error.');
}
},
};| Variable | Description | Required |
|---|---|---|
DISCORD_TOKEN |
Discord bot token | โ |
PREFIX |
Command prefix (default: !) | โ |
GEMINI_API_KEY |
Google Gemini AI API key | โ |
GOOGLE_CLOUD_PROJECT_ID |
Google Cloud project ID | โ |
GOOGLE_CLOUD_KEY_FILE |
Path to service account JSON | โ |
- Create a new project in Google Cloud Console
- Enable the following APIs:
- Cloud Speech-to-Text API
- Create a service account:
- Go to IAM & Admin > Service Accounts
- Create new service account
- Grant roles: Speech Admin, Cloud Speech Client
- Download JSON key file
- Place the JSON file in project root as
google-cloud-key.json
- Auto-detect source language
- Context-aware translation
- Support for 5 major languages
- Confidence scoring
- Grammar correction with explanations
- Vocabulary suggestions
- Alternative expressions
- Natural conversation practice
- Real-time speech recognition
- AI conversation with voice
- Speech-to-text processing
- Session management
- Phonetic analysis with Gemini AI
- Multi-language support
- Context-aware speech generation
- Audio simulation
- Per-user chat history
- Context retention
- Conversation continuity
- History management
- Response Time: < 2 seconds for text commands
- Voice Latency: < 3 seconds for voice processing
- Concurrent Users: Supports multiple users simultaneously
- Memory Usage: Optimized for long-running instances
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Discord.js - Discord API library
- Google Gemini AI - AI language model
- Google Cloud Speech - Speech services
Jika Anda mengalami masalah atau memiliki pertanyaan:
- Check Issues untuk masalah yang sudah diketahui
- Buat issue baru dengan detail lengkap
- Sertakan log error dan konfigurasi (tanpa API keys)
PoligotBot v3.0 - Powered by Gemini AI & Google Cloud Speech