2025-10-08
admin
Diperbarui 2025-10-11

Texa AI: Bot Telegram Pintar dengan Gemini 2.0 & Personality Gen Z

Texa AI hadir sebagai bot Telegram berbasis AI yang menggunakan Google Gemini 2.0 Flash. Dengan personality Gen Z yang relatable, fitur analisis media lengkap, dan perintah yang mudah digunakan, bot ini siap menghibur dan membantu Anda. Pelajari cara instalasinya dan nikmati pengalaman chat yang lebih seru!
Texa AI: Bot Telegram Pintar dengan Gemini 2.0 & Personality Gen Z

🤖 Texa AI - Telegram Bot Edition

Bot Telegram berbasis AI menggunakan Google Gemini 2.0 Flash dengan personality Gen Z/Alpha yang friendly dan relatable!

✨ Features

🎯 Core Features

  • 💬 AI Chat dengan Memory - Ingat semua percakapan sebelumnya per user
  • 🔄 Multiple API Keys - Auto-rotation untuk stability
  • Real-time Processing - Fast response time
  • 💾 Auto-save Memory - Backup setiap 5 menit

🎨 Media Support

  • 🖼️ Image Analysis - Analisis gambar dengan detail
  • 🎬 Video Analysis - Review dan deskripsi video
  • 🎵 Audio Analysis - Transkripsi dan analisis audio/voice note
  • 📍 Location Handler - Info lokasi dengan Google Maps link
  • 😄 Sticker Response - Reaksi natural terhadap sticker
  • 📄 Document Info - Info file yang dikirim

🎮 Commands

/start   - Mulai bot
/help    - Lihat semua command
/forget  - Reset chat history
/vibe    - Random vibe quote
/joke    - Random joke
/quote   - Inspirational quote
/apikey  - Status API keys
/stats   - Bot statistics

🌟 Advanced Features

  • 🔍 Inline Mode - Query AI langsung dari chat mana aja
  • 🔔 Callback Queries - Support untuk inline buttons
  • ✏️ Edit Detection - Deteksi pesan yang diedit
  • 📢 Channel Support - Bisa di channel juga
  • 🛡️ Rate Limiting - Anti-spam (2 detik cooldown)
  • 🎭 Gen Z Personality - Bahasa santai, emoji, slang

🚀 Installation

1. Prerequisites

  • Node.js 18+
  • npm atau yarn
  • Telegram Bot Token (dari @BotFather)
  • Google Gemini API Key

2. Clone & Install

# Clone repository
git clone <your-repo-url>
cd texa-telegram-bot

# Install dependencies
npm install

3. Configuration

Option A: Environment Variables (Recommended)

Buat file .env:

# Telegram Configuration
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here

# Gemini API Keys (Multiple for redundancy)
GEMINI_API_KEY_1=your_primary_gemini_key
GEMINI_API_KEY_2=your_backup_gemini_key
GEMINI_API_KEY_3=your_third_gemini_key

Option B: Edit Script Directly

Edit bot.js line 10-15:

const TELEGRAM_TOKEN = 'YOUR_TELEGRAM_BOT_TOKEN'
const GEMINI_API_KEYS = [
    'your_primary_key',
    'your_backup_key',
    'your_third_key'
]

4. Get API Keys

Telegram Bot Token:

  1. Open Telegram, cari @BotFather
  2. Kirim /newbot
  3. Ikuti instruksi (nama bot & username)
  4. Copy token yang diberikan

Google Gemini API Key:

  1. Kunjungi Google AI Studio
  2. Login dengan Google Account
  3. Klik "Create API Key"
  4. Copy key yang dibuat
  5. Ulangi untuk backup keys (recommended)

5. Run Bot

# Production
npm start

# Development (auto-restart)
npm run dev

📁 Project Structure

texa-telegram-bot/
├── bot.js                 # Main bot script
├── package.json           # Dependencies
├── .env                   # Configuration (create this)
├── .gitignore            # Git ignore file
├── README.md             # This file
├── logs/                 # Auto-created
│   ├── bot.log          # Bot activity logs
│   └── memory_backup.json # Conversation backups
└── media/               # Auto-created
    ├── images/          # Downloaded images
    ├── videos/          # Downloaded videos
    ├── audio/           # Downloaded audio
    └── documents/       # Downloaded docs

🎯 Usage Examples

Basic Chat

User: Halo!
Bot: Halooo! 👋✨ Ada yang bisa aku bantu?

User: Siapa kamu?
Bot: Aku Texa, AI bestie kamu yang siap nemenin 24/7! 💖

Image Analysis

User: [Kirim foto kucing]
Bot: Wah lucuu banget! 😍 Itu kucing orange ya? 
     Lagi tidur gitu, vibes nya santai banget! 
     Orangnya gemoy, pasti suka makan 🤣✨

Location

User: [Share location]
Bot: Oke oke, aku liat lokasinya! 📍

     📊 Koordinat:
     Latitude: -6.234567
     Longitude: 106.789012

     🗺️ Google Maps: [link]

     Fun fact: Lokasi ini keliatan keren nih! ✨

Commands

User: /vibe
Bot: ✨ Main character energy ✨
     That's the vibe for today! 💫

User: /joke
Bot: Kenapa programmer suka gelap? 
     Karena light mode = maling mode 😂💀

⚙️ Configuration Options

In bot.js:

const BOT_NAME = 'Texa'              // Bot name
const MAX_HISTORY = 50                // Max messages per user
const TYPING_DELAY = 1500             // Typing indicator delay (ms)
const MAX_KEY_ERRORS = 3              // Errors before key rotation

AI Model Settings:

generationConfig: {
    temperature: 0.95,      // Creativity (0-1)
    topK: 40,              // Token sampling
    topP: 0.95,            // Nucleus sampling
    maxOutputTokens: 1200, // Max response length
}

🔧 Troubleshooting

Bot tidak merespon

# Check logs
cat logs/bot.log

# Check if bot is running
ps aux | grep node

# Restart bot
npm start

Error: Invalid Token

  • Cek token di BotFather
  • Pastikan token di .env atau script benar
  • Jangan ada spasi atau karakter aneh

Error: API Key Invalid

Memory Issues

# Clear memory backup
rm logs/memory_backup.json

# Clear media files
rm -rf media/*

📊 Monitoring

Check Logs

# Real-time logs
tail -f logs/bot.log

# Last 100 lines
tail -n 100 logs/bot.log

# Search errors
grep "❌" logs/bot.log

Bot Statistics

Send /stats to bot untuk melihat:

  • Total users
  • Total messages
  • Active API keys
  • Uptime

🔐 Security Best Practices

  1. Never commit .env file
# Add to .gitignore
echo ".env" >> .gitignore
  1. Use environment variables in production
export TELEGRAM_BOT_TOKEN="your_token"
export GEMINI_API_KEY_1="your_key"
  1. Rotate API keys regularly
  • Set multiple keys
  • Monitor usage
  • Replace if compromised
  1. Limit bot permissions
  • Only give necessary permissions
  • Don't make bot admin unless needed

🚀 Deployment

Deploy to VPS/Server

# Install PM2 untuk process management
npm install -g pm2

# Start bot with PM2
pm2 start bot.js --name texa-bot

# Auto-start on reboot
pm2 startup
pm2 save

Deploy to Heroku

# Install Heroku CLI
# Create Procfile
echo "worker: node bot.js" > Procfile

# Deploy
heroku create your-bot-name
git push heroku main

# Set config vars
heroku config:set TELEGRAM_BOT_TOKEN=your_token
heroku config:set GEMINI_API_KEY_1=your_key

Deploy to Railway/Render

  1. Push code to GitHub
  2. Connect repository
  3. Set environment variables
  4. Deploy!

📝 Customization

Change Personality

Edit genZPhrases object di bot.js:

const genZPhrases = {
    greetings: ['Your greetings'],
    reactions: { ... },
    vibes: ['Your vibes']
}

Add New Commands

Edit handleCommand function:

case '/mycommand':
    return 'Your response here!'

Modify AI Behavior

Edit systemContext di chatWithAI function

🤝 Contributing

Contributions welcome!

  1. Fork repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

📜 License

MIT License - feel free to use for personal or commercial projects!

💖 Credits

  • Built with ❤️ for Gen Z & Gen Alpha
  • Powered by Google Gemini AI
  • Using node-telegram-bot-api

📞 Support

  • 🐛 Issues: Open GitHub issue
  • 💬 Questions: Discussion section
  • 📧 Email: [email protected]

Made with 💫 and ✨ by [Your Name]

Keep vibing! 🔥

blog teknologi artificial-intelligence programming admin

Artikel Terkait