139 lines
4.0 KiB
Markdown
139 lines
4.0 KiB
Markdown
# Discord Multimedia Bot
|
|
|
|
A powerful Discord bot that can send messages and search for multimedia files on Google with enhanced display capabilities.
|
|
|
|
## Features
|
|
|
|
- 🏓 **Ping Command** - Simple ping command to check if the bot is working
|
|
- 📨 **Message Sending** - Send messages to any channel in the server
|
|
- 🔍 **Multimedia Search** - Search for images and videos with embedded preview
|
|
- 📈 **Google Trends** - Show current trending topics by country with grouped articles
|
|
- ⬇️ **File Download** - Download and share multimedia files directly in Discord
|
|
- 🟠 **Bitcoin Monitor** - Real-time Bitcoin transaction monitoring
|
|
|
|
## Installation
|
|
|
|
1. Clone this repository
|
|
2. Install dependencies:
|
|
```bash
|
|
npm install
|
|
```
|
|
3. Create a `.env` file with your bot token:
|
|
```env
|
|
DISCORD_TOKEN=your_token_here
|
|
```
|
|
4. Run the bot:
|
|
```bash
|
|
node index.js
|
|
```
|
|
|
|
## Commands
|
|
|
|
### 🏓 Ping
|
|
```
|
|
/ping
|
|
```
|
|
Simple response to check if the bot is online.
|
|
|
|
### 📨 Send Message
|
|
```
|
|
/send channel:#channel-name message:Your message here
|
|
```
|
|
Sends a message to the specified channel.
|
|
- `channel`: The target channel (required)
|
|
- `message`: The message content (required)
|
|
|
|
### 🔍 Search Media
|
|
```
|
|
/search query:cute puppies type:image count:3
|
|
```
|
|
Searches for multimedia content on Google with enhanced display.
|
|
- `query`: What to search for (required)
|
|
- `type`: Either "image" or "video" (required)
|
|
- `count`: Number of results to show (1-5, default: 3)
|
|
|
|
**Image Search Features:**
|
|
- Displays images directly in Discord with embeds
|
|
- Shows content type information
|
|
- Validates image URLs before displaying
|
|
- Supports JPG, PNG, GIF, and WebP formats
|
|
|
|
**Video Search Features:**
|
|
- Creates rich embeds with video information
|
|
- Shows YouTube video thumbnails automatically
|
|
- Includes video descriptions when available
|
|
- Supports YouTube, Vimeo, and direct video files
|
|
|
|
### 📈 Trending Topics
|
|
```
|
|
/trends country:ES
|
|
```
|
|
Shows current trending topics from Reddit's popular posts.
|
|
- `country`: Country code (US, ES, GB, FR, DE, JP, BR, or Global) (optional, default: US)
|
|
|
|
**Trends Features:**
|
|
- **Source:** Reddit trending posts from r/popular
|
|
- Posts grouped by subreddit
|
|
- Rich embeds with clickable links to discussions
|
|
- Real-time upvote metrics and engagement data
|
|
- Direct links to Reddit discussions
|
|
|
|
### ⬇️ Download Files
|
|
```
|
|
/download url:https://example.com/image.jpg title:My Image
|
|
```
|
|
Downloads and shares multimedia files directly in Discord.
|
|
- `url`: Direct URL to the multimedia file (required)
|
|
- `title`: Optional title for the file (optional)
|
|
|
|
**Download Features:**
|
|
- Validates multimedia URLs before downloading
|
|
- Checks file size (8MB Discord limit)
|
|
- Supports images, videos, and audio files
|
|
- Automatically cleans up temporary files
|
|
- Shows file information in rich embeds
|
|
|
|
## Security Features
|
|
|
|
- ✅ Environment variables for token security
|
|
- ✅ URL validation for multimedia content
|
|
- ✅ File size checking
|
|
- ✅ Temporary file cleanup
|
|
- ✅ Error handling and user feedback
|
|
|
|
## Supported File Types
|
|
|
|
**Images:** JPG, JPEG, PNG, GIF, WebP, BMP, SVG
|
|
**Videos:** MP4, WebM, MOV, AVI, MKV, FLV
|
|
**Audio:** MP3, WAV, OGG, M4A, AAC, FLAC
|
|
|
|
## Technical Implementation
|
|
|
|
- **dotenv** for secure environment variable management
|
|
- **Enhanced fetch** with proper headers and error handling
|
|
- **Discord.js v14** with modern slash commands
|
|
- **Google-it** for search functionality
|
|
- **Stream pipeline** for efficient file downloads
|
|
- **Rich embeds** for multimedia display
|
|
|
|
## Security Note
|
|
|
|
⚠️ **Important:** Keep your bot token private and never commit it to a public repository. Always use environment variables for sensitive data.
|
|
|
|
## Error Handling
|
|
|
|
The bot includes comprehensive error handling for:
|
|
- Invalid URLs
|
|
- Network timeouts
|
|
- File size limitations
|
|
- Permission errors
|
|
- API rate limits
|
|
|
|
## Performance Features
|
|
|
|
- Efficient file streaming for downloads
|
|
- Automatic temporary file cleanup
|
|
- URL validation before processing
|
|
- Content type verification
|
|
- Background processing for long operations
|