Skip to content
/ vxer Public

A discord bot that replaces social media video links to players with better viewing support on text channels

Notifications You must be signed in to change notification settings

ja1code/vxer

Repository files navigation

[AI GENERATED]

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.

Social Media Link Converter Bot

A Discord bot that automatically converts social media links to more Discord-friendly formats, enhancing the viewing experience of shared content in your server.

What it Does

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

Example

When a user sends:

https://twitter.com/username/status/123456789

The bot can either:

  1. Reply with the converted link:

    Here's a better link for viewing that Twitter/X video:
    https://vxtwitter.com/username/status/123456789
    
  2. Or delete the original message and send:

    @User enviou: https://vxtwitter.com/username/status/123456789
    

Key Features

  • 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

Commands

Quick Toggle Commands

  • /toggletwitter - Turn Twitter/X link conversion on/off
  • /toggletiktok - Turn TikTok link conversion on/off
  • /toggleinstagram - Turn Instagram link conversion on/off

Detailed Configuration

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)

Setup

  1. Prerequisites

    • Node.js v16.9.0 or higher
    • A Discord bot token
    • Server with "Manage Messages" permission
  2. Installation

    git clone <repository-url>
    cd <repository-name>
    npm install
  3. Configuration Create a .env file:

    DISCORD_TOKEN=your_discord_bot_token_here
    CLIENT_ID=your_client_id_here
    GUILD_ID=your_guild_id_here
    NODE_ENV=development
  4. Start the Bot

    # Development mode with hot reloading
    npm run dev
    
    # Or production mode
    npm run build
    npm start
  5. Deploy Commands

    npm run deploy-commands

Customization

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
}

Technical Details

  • 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

Support

If you encounter any issues or need help:

  1. Check the troubleshooting section below
  2. Open an issue on GitHub
  3. Make sure you have the required permissions in Discord

Troubleshooting

Common issues and solutions:

  1. Bot not responding to links

    • Check if the feature is enabled with /toggleplatform
    • Verify bot has "Read Messages" and "Send Messages" permissions
  2. Can't delete messages

    • Bot needs "Manage Messages" permission
    • Check if deleteOnlyLinks is enabled in config
  3. Commands not working

    • Run npm run deploy-commands to register slash commands
    • Ensure bot has "Use Slash Commands" permission

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A discord bot that replaces social media video links to players with better viewing support on text channels

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published