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)
đ Multi-Language Support
- Traditional Chinese (įšéĢ䏿)
- Simplified Chinese (įŽäŊ䏿)
- Japanese (æĨæŦčĒ)
- English
đ§ Technical Features
- 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 |
/oais |
Real-time streaming AI response | Live response updates |
/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 |
/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 maplestorybot .
docker run -d maplestorybot
âī¸ 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
â âââ 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
đ 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, conversation content, or chat history
- No Personal Data Collection: We do not collect, store, or process any personal information from users
- Temporary Processing Only: User inputs are processed temporarily to generate responses and are immediately discarded
- No Third-Party Sharing: No user data is shared with third parties beyond the necessary API calls to provide bot functionality
Bot Permissions and Intents
This bot requests the following permissions solely for functionality purposes:
- Message Content Intent: Required to read and respond to user commands and mentions
- Slash Commands: For interactive command processing
- File Attachments: For processing images in AI vision features and downloading requested content
- Embed Links: For formatting rich responses and search results
Data Security
- All API communications use encrypted HTTPS connections
- Temporary data processing occurs in secure, ephemeral environments
- No user data persists beyond the immediate request-response cycle
Contact and Compliance
If you have privacy concerns or questions about data handling:
- Report issues via GitHub Issues
- Contact the development team through the repository
This bot is designed with privacy-by-design principles and minimal data processing to ensure user privacy protection.
Contributors
Made with contrib.rocks