A discord bot based on multi-modal LLM that interacts with discord through natural language
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗English | 繁體中文
PigPig is a powerful, multi-modal Discord bot powered by Large Language Models (LLMs). It's designed to interact with users through natural language, combining advanced AI capabilities with practical, fun features to enrich any Discord community.
To ensure user rights and service transparency, please refer to the following documents:
Essential Dependencies:
FFmpeg Installation:
Ubuntu/Debian: sudo apt update && sudo apt install ffmpeg
CentOS/RHEL: sudo yum install epel-release && sudo yum install ffmpeg
macOS: brew install ffmpeg
Windows: Download from FFmpeg Windows builds
Python packages listed in requirements.txt
# Clone the repository
git clone https://github.com/starpig1129/discord-LLM-bot-PigPig.git
# Navigate to the project directory
cd discord-LLM-bot-PigPig
# Install required Python packages
pip install -r requirements.txt
Follow these steps to configure your bot instance.
.env fileRename the .env Example file to .env and fill in the required values.
# .env
# --- Discord Bot Credentials ---
TOKEN=XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXX
CLIENT_ID=123456789012345678
CLIENT_SECRET_ID=XXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXX
# --- Dashboard Secret ---
# Generate with: python3 -c "import secrets; print(secrets.token_urlsafe(64))"
DASHBOARD_SECRET_KEY=<generate-a-random-64-char-secret>
# --- Bot Configuration ---
BOT_OWNER_ID=123456789012345678
BUG_REPORT_CHANNEL_ID=123456789012345678
# --- AI Model Configuration ---
MODEL_NAME=openbmb/MiniCPM-o-2_6
ANTHROPIC_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
OPENAI_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
GEMINI_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# --- Vector Database API Keys ---
VECTOR_STORE_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# --- Bot Configuration File Path ---
CONFIG_ROOT="/path/to/your/config"
| Variable | Description |
|---|---|
TOKEN | (Required) Your Discord bot token from the Discord Developer Portal. |
CLIENT_ID | (Required) Your bot's client ID from the Developer Portal. |
CLIENT_SECRET_ID | (Required) Your bot's client secret, used for Discord OAuth2 login on the dashboard. |
DASHBOARD_SECRET_KEY | (Required) A random secret for signing dashboard JWT tokens. Generate with python3 -c "import secrets; print(secrets.token_urlsafe(64))". |
BOT_OWNER_ID | (Required) Your Discord User ID. Grants owner-level privileges and is required for the auto-update system. |
BUG_REPORT_CHANNEL_ID | (Optional) A Discord channel ID where error messages and bug reports will be sent. |
MODEL_NAME | The default local multi-modal model to use. |
ANTHROPIC_API_KEY | (Optional) Your API key for Anthropic's Claude models, available on Anthropic official website. |
OPENAI_API_KEY | (Optional) Your API key for OpenAI's GPT models, available on OpenAI official website. |
GEMINI_API_KEY | (Optional) Your API key for Google's Gemini models, available on Google AI Studio. |
VECTOR_STORE_API_KEY | (Optional) Your API key for vector databases (like Qdrant), only needed if using cloud database. |
CONFIG_ROOT | (Optional) Root directory path for custom configuration files and data. Defaults to ./base_configs folder in current directory. |
configs folderThe bot's default files are in the ./base_configs folder. You can edit these JSON files to customize the bot's behavior as needed. It is recommended to copy them and set the 'CONFIG_ROOT' parameter in '.env'.
If you do not want to enable the long-term memory system, set enabled to false in base_configs/memory.yaml.
To tune cache behavior, adjust procedural_cache_ttl (seconds) in base_configs/memory.yaml; larger values reduce DB reads, smaller values refresh user data more aggressively.
If you use a cloud vector database (like Qdrant), set the VECTOR_STORE_API_KEY in the .env file.
And ensure that the vector database URL and other parameters are correctly set in base_configs/memory.yaml.
For local installation or cloud setup methods, refer to Qdrant official documentation.
Once configured, you can start the bot with the following command:
python main.py
The bot's functionality is divided into modules called "Cogs". Here are the key features available:
/memory_search, /memory_stats, /memory_config/play, /mode, /shuffle, /music, /filter, /queue, /playlist, /music_settings/story/internet_search search_type: eat/generate_image/internet_search/system_prompt/remind/upload_schedule, /query_schedule, /update_schedule/update_check, /update_now/set_server_mode, /set_channel_mode, /auto_response/userdata/set_language, /current_language/model_managementsympy library./summarize/search_gif/botinfoThe codebase is extensively documented. Below are links to the main documentation sections for developers:
| Module Category | Description | Documentation Link |
|---|---|---|
| Core GPT Engine | Handles LLM integration, response generation, and tools. | llm/ |
| Addons | Manages system-level features like auto-updates. | addons/ |
| Cogs (Features) | Core bot features and commands. | cogs/ |
| ↳ Eat System | Intelligent food recommendation module. | cogs/eat/ |
| ↳ Memory System | Manages long-term conversation memory. | cogs/memory/ |
| ↳ Music System | Handles music playback and queues. | cogs/music_lib/ |
| ↳ Story System | Interactive story generation module. | cogs/story/ |
| ↳ System Prompt | Manages server and channel system prompts. | cogs/system_prompt/ |
This project is licensed under the MIT License. See the LICENSE file for details.