This whole repo was generated by AI, using Claude 3.7 Sonnet with Cursor.
Read llm.instructions to see all instructions (prompts) used to generate this repo.
A Discord bot that automatically converts social media links to more Discord-friendly formats, enhancing the viewing experience of shared content in your server.
This bot watches for social media links in your Discord channels and automatically converts them to better formats:
-
Twitter/X Links → vxtwitter.com
- Enables direct video playback in Discord
- Shows full images without cropping
- No need to open Twitter/X in browser
-
TikTok Links → vxtiktok.com
- Direct video playback in Discord
- No TikTok watermarks
- No app required to view
-
Instagram Links → ddinstagram.com
- View photos and videos directly in Discord
- Works with posts, reels, and stories
- No Instagram account needed
When a user sends:
https://twitter.com/username/status/123456789
The bot can either:
-
Reply with the converted link:
Here's a better link for viewing that Twitter/X video: https://vxtwitter.com/username/status/123456789 -
Or delete the original message and send:
@User enviou: https://vxtwitter.com/username/status/123456789
- Smart Link Detection: Automatically detects and converts links from multiple social media platforms
- Configurable Behavior: Customize how the bot handles each platform's links
- Clean Chat Experience: Option to delete original messages and replace with converted links
- User Attribution: Properly mentions users when replacing their messages
- Permission-Based: Commands require appropriate permissions to modify settings
/toggletwitter- Turn Twitter/X link conversion on/off/toggletiktok- Turn TikTok link conversion on/off/toggleinstagram- Turn Instagram link conversion on/off
Each platform (Twitter/X, TikTok, Instagram) has its own config command with these options:
- View Settings: Check current configuration
- Reply Message: Customize the bot's response
- Reply Behavior: Choose between replying or sending new messages
- Mention Settings: Control when users get pinged
- Message Handling: Configure deletion of original messages
- Format: Customize how replaced messages look
Example using Twitter/X commands:
/twitterconfig view
/twitterconfig replymessage "Here's a better link:"
/twitterconfig replytouser true
/twitterconfig mentionuser false
/twitterconfig deleteonlylinks true
/twitterconfig deletedmessageformat "@{username} shared:"
(Similar commands exist for TikTok and Instagram using tiktokconfig and instagramconfig)
-
Prerequisites
- Node.js v16.9.0 or higher
- A Discord bot token
- Server with "Manage Messages" permission
-
Installation
git clone <repository-url> cd <repository-name> npm install
-
Configuration Create a
.envfile:DISCORD_TOKEN=your_discord_bot_token_here CLIENT_ID=your_client_id_here GUILD_ID=your_guild_id_here NODE_ENV=development
-
Start the Bot
# Development mode with hot reloading npm run dev # Or production mode npm run build npm start
-
Deploy Commands
npm run deploy-commands
You can customize the bot's behavior in src/config.ts. Each platform has its own settings:
{
enabled: true, // Enable/disable conversion
replyMessage: "...", // Custom reply message
replyToUser: true, // Reply or send new message
mentionUser: false, // Ping user in replies
deleteOnlyLinks: true, // Delete messages with only links
deletedMessageFormat: "..." // Format for replacement messages
}- Built with TypeScript and discord.js
- Uses ES Modules for modern JavaScript features
- Includes hot reloading for development
- Proper error handling and logging
- Permission-based command system
If you encounter any issues or need help:
- Check the troubleshooting section below
- Open an issue on GitHub
- Make sure you have the required permissions in Discord
Common issues and solutions:
-
Bot not responding to links
- Check if the feature is enabled with
/toggleplatform - Verify bot has "Read Messages" and "Send Messages" permissions
- Check if the feature is enabled with
-
Can't delete messages
- Bot needs "Manage Messages" permission
- Check if
deleteOnlyLinksis enabled in config
-
Commands not working
- Run
npm run deploy-commandsto register slash commands - Ensure bot has "Use Slash Commands" permission
- Run
This project is licensed under the MIT License - see the LICENSE file for details.