Skip to content

M5Develop/MikuBot-Discord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 MikuBot β€” Discord AI Chatbot

Python Discord Groq License

A Hatsune Miku-themed Discord AI chatbot powered by Groq β€” with smart model routing, memory, TTS, and a web dashboard.


✨ Features

  • πŸ€– Smart Model Routing β€” Automatically picks the best AI model based on your message:
    • Llama 4 Scout β†’ Quick replies
    • GPT OSS 120B β†’ Deep reasoning & code
    • Kimi K2 β†’ Long conversations (10+ messages)
  • 🧠 Persistent Memory β€” Miku remembers facts about each user via [remember:key=value] tags
  • 🎭 Emotion-aware GIFs β€” Detects mood from responses and sends matching Hatsune Miku GIFs via Giphy
  • πŸ”Š Text-to-Speech β€” Supports ElevenLabs, Groq PlayAI (English & Arabic)
  • πŸ‘οΈ Vision Support β€” Send images and Miku will analyze them
  • πŸ“Š XP & Levelling System β€” Users earn XP from chatting
  • 🌐 Web Dashboard β€” Manage system prompt, models, memory, and activity status via browser
  • πŸ’Ύ Dual Database β€” SQLite for local hosting, Supabase for cloud deployment

πŸ› οΈ Tech Stack

Component Technology
Bot Framework discord.py
Web Dashboard Quart (async Flask)
AI Backend Groq API
Database aiosqlite / Supabase
TTS ElevenLabs / Groq PlayAI
GIFs Giphy API

πŸš€ Setup

1. Clone the repo

git clone https://github.com/M5Develop/MikuBot-Discord.git
cd MikuBot-Discord

2. Install dependencies

pip install -r requirements.txt

3. Configure environment

cp .env.example .env

Then fill in your keys in .env.

4. Run

python main.py

The bot will start and the dashboard will be available at http://localhost:8000/dashboard


πŸ”‘ Environment Variables

Variable Required Description
DISCORD_TOKEN βœ… Your Discord bot token
GROQ_API_KEY βœ… Groq API key (free at console.groq.com)
GIPHY_API_KEY ⚠️ Optional For animated Miku GIF responses
ELEVENLABS_API_KEY ⚠️ Optional For ElevenLabs TTS
ELEVENLABS_VOICE_ID ⚠️ Optional ElevenLabs voice ID
SUPABASE_URL ⚠️ Optional Supabase URL (cloud mode)
SUPABASE_KEY ⚠️ Optional Supabase anon key (cloud mode)

Note: If SUPABASE_URL and SUPABASE_KEY are not set, the bot automatically uses local SQLite β€” no setup needed!


πŸ’¬ How to Use

Mention the bot or DM it to start a conversation:

@MikuBot Hey, what's the difference between a stack and a queue?
@MikuBot [attach image] What's in this image?

Dashboard Controls

  • Update Miku's personality/system prompt
  • Switch AI models manually or set to auto-routing
  • Enable/disable TTS and choose voice engine
  • View top fans (XP leaderboard)
  • Browse and delete user memories
  • Clear chat history per user

πŸ—‚οΈ Project Structure

MikuBot-Discord/
β”œβ”€β”€ main.py              # Entry point β€” bot + Quart dashboard
β”œβ”€β”€ database.py          # MikuMemory class (SQLite + Supabase)
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .env.example
β”œβ”€β”€ cogs/
β”‚   β”œβ”€β”€ ai_chat.py       # Core AI chat, routing, TTS, GIFs, memory
β”‚   β”œβ”€β”€ levelling.py     # XP system
β”‚   └── voice.py         # Voice channel features
└── templates/
    β”œβ”€β”€ dashboard.html
    └── layout.html

🧠 Memory System

Miku can remember facts mid-conversation. Just say something like:

"My favorite color is teal"

And Miku will internally tag [remember:favorite_color=teal] and recall it in future messages.

Memories can be viewed and deleted from the dashboard.


🏠 Self-Hosting

Works great on:


πŸ“„ License

MIT β€” free to use, modify, and build on.


Made with πŸ’™ by M5Develop | HuggingFace

About

🎡 Hatsune Miku Discord AI Bot β€” Groq, memory, TTS, dashboard

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors