AI-Powered Discord Bot ๐ค
English | ็น้ซไธญๆ
A comprehensive Discord Bot built with nextcord that provides AI-powered interactions, content processing, and utility features. Features multi-language support and real-time streaming responses. ๐โก๐ฅ
Suggestions and contributions are always welcome!
โจ Features
๐ค AI-Powered Interactions
- Text Generation: Support for multiple OpenAI models (GPT-4o, o1, o3-mini) with real-time streaming
- Image Processing: Vision model support with automatic image conversion
- Web Search: Integrated Perplexity API for real-time web search and summarization
๐ Content Processing
- Message Summarization: Smart channel conversation summaries with user filtering
- Video Downloading: Multi-platform support (YouTube, TikTok, Instagram, X, Facebook)
- MapleStory Database: Search monsters and items with drop information
๐ Multi-Language Support
- Traditional Chinese (็น้ซไธญๆ)
- Simplified Chinese (็ฎไฝไธญๆ)
- Japanese (ๆฅๆฌ่ช)
- English
๐ง Technical Features
- Main Bot Implementation: The core bot class
DiscordBot
is implemented insrc/bot.py
, extendingnextcord.ext.commands.Bot
with comprehensive initialization, cog loading, and event handling - Modular Cog-based architecture
- Async/await patterns with nextcord
- Pydantic-based configuration management
- Comprehensive error handling and logging
- Docker support with development containers
๐ฏ Core Commands
Command | Description | Features |
---|---|---|
/oai |
Generate AI text response | Multi-model support, image input, optional streaming |
/search |
Web search with AI summary | Perplexity API integration |
/sum |
Interactive message summarization | User filtering, configurable count |
/download_video |
Multi-platform video downloader | Quality options, size validation |
/maple_monster |
Search MapleStory monster drops | Detailed monster information |
/maple_item |
Search MapleStory item sources | Drop source tracking |
/maple_stats |
MapleStory database statistics | Data overview and popular items |
/ping |
Bot performance testing | Latency measurement |
๐ Quick Start
Prerequisites
- Python 3.10 or higher
- Discord Bot Token
- OpenAI API Key
- Perplexity API Key (for search)
Installation
-
Clone the repository
-
Install dependencies using uv
-
Set up environment variables
-
Run the bot
Docker Setup
# Using Docker Compose
docker-compose up -d
# Or build manually
docker build -t discordbot .
docker run -d discordbot
โ๏ธ Configuration
Required Environment Variables
# Discord Configuration
DISCORD_BOT_TOKEN=your_discord_bot_token
DISCORD_TEST_SERVER_ID=your_test_server_id # Optional
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key
OPENAI_BASE_URL=https://api.openai.com/v1
OPENAI_API_TYPE=openai # or "azure"
# Azure OpenAI (if using Azure)
AZURE_OPENAI_API_KEY=your_azure_key
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
# Perplexity API (for search)
PERPLEXITY_API_KEY=your_perplexity_api_key
๐ Project Structure
src/
โโโ bot.py # Main bot entry point
โโโ cogs/ # Command modules
โ โโโ gen_reply.py # AI text generation
โ โโโ gen_search.py # Web search integration
โ โโโ summary.py # Message summarization
โ โโโ video.py # Video downloading
โ โโโ maplestory.py # MapleStory database queries
โ โโโ gen_image.py # Image generation (placeholder)
โ โโโ template.py # System utilities
โโโ sdk/ # Core business logic
โ โโโ llm.py # LLM integration
โ โโโ asst.py # Assistant API wrapper
โโโ types/ # Configuration models
โโโ utils/ # Utility functions
๐ Key Features Deep Dive
Multi-Modal AI Support
- Text and image input processing
- Automatic image-to-base64 conversion
- Model-specific constraint handling
- Streaming response capabilities
Video Download Engine
- Support for 10+ platforms
- Quality selection (4K to audio-only)
- File size validation for Discord limits
- Progress tracking and error handling
MapleStory Database System
- Comprehensive monster and item database (192+ monsters)
- Interactive search with fuzzy matching
- Multi-language support (Traditional Chinese, Simplified Chinese, Japanese, English)
- Detailed monster statistics and drop information
- Item source tracking with visual displays
- Cached search results for optimal performance
๐ Privacy Policy
This Discord bot is committed to protecting user privacy and complies with Discordโs Terms of Service and Developer Policy.
๐ฆ Data Collection and Usage
- No Message Storage: This bot does NOT store, log, or retain any user messages, message content, or chat history beyond the immediate processing needed for a response.
- No Personal Data Collection: We do not collect, store, or process any personal identifying information (PII) from users.
- Temporary Processing Only: All inputs are processed in memory only and discarded immediately after the response is generated.
- No Third-Party Sharing: No user data is shared with any third parties, other than trusted APIs (e.g., OpenAI) for processing the specific user request.
โ๏ธ Bot Permissions and Intents
This bot uses certain Discord intents solely to provide its core features:
- Message Content Intent: Required to read and respond to natural-language commands without slash syntax (e.g., keyword detection like "ๆฅๆช", "ๆ่ฝ", etc.).
- Slash Commands: Used for interactive and explicit command triggers.
- Embed Links / File Attachments: Used to display structured output and allow interaction with visual content.
- Presence Intent (if applicable): May be used to improve responsiveness based on online status; not stored.
Users may opt out of interactions via commands like !optout
(planned) or by muting the bot.
๐ Data Security
- All API requests are made via secure HTTPS connections.
- Data is processed only temporarily in memory and never stored on disk or external databases.
- No long-term logs or analytics based on message or user content are maintained.
๐ฌ Contact and Compliance
If you have privacy concerns or questions about this policy, feel free to:
- Submit an issue via GitHub
- Contact the developer through the repository's listed channels
This bot is designed using privacy-by-design principles with a strict minimal-data-handling approach to protect all users.
Last updated: 2025/05/29
Contributors
Made with contrib.rocks