/discord-media-helper

A Discord bot to fix media embeds

Primary LanguageTypeScriptMIT LicenseMIT

MediaHelper

This bot watches chat for video links and replies to messages containing supported links with an embedded video, so you don't need to click the link to watch shared videos.

Idea and hosting by @RTCFlyer.

Click here to add MediaHelper

Supported links

  • Facebook
  • iFunny
  • Instagram
  • Reddit
  • TikTok
  • Twitter

Self-hosting

Requirements

Installation

Clone the repository:

git clone https://github.com/eartharoid/discord-media-helper.git bot && cd bot

Then create a .env file with the following contents:

DISCORD_CLIENT_ID=
DISCORD_TOKEN=
DOWNLOAD_DIR=
FFMPEG_BIN=ffmpeg
HOST=
MAX_FILE_SIZE=50M
RAPID_API_KEY=
YTDL_BIN=yt-dlp

Create a Discord application and bot with the message content privileged intent enabled and paste the token into the .env file.

Also, set the other environment variables:

  • DISCORD_CLIENT_ID: the client ID of the Discord application
  • DOWNLOAD_DIR: the directory which is served by a web server (e.g. /var/www/html/videos) where videos will be downloaded to
  • HOST: the web server URL, which must end with a / (e.g. https://example.com/videos/)

Install Node.js dependencies:

npm i

Compile:

npm run build

Download yt-dlp:

curl -o /usr/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp

And then install ffmpeg.

Finally, register the commands:

node scripts/commands