Go to file
2023-01-09 00:59:52 +01:00
2023-01-09 04:25:35 +01:00
2023-01-09 04:25:20 +01:00
2022-08-02 14:57:43 +02:00
2022-08-02 14:57:43 +02:00
2023-01-09 04:25:20 +01:00
2022-04-21 16:39:20 +02:00
2022-11-14 01:39:15 +01:00
2021-05-10 23:13:11 +02:00
2023-01-09 01:31:37 +00:00

discord-embed

Discord will only create embeds for videos and images if they are smaller than 8MB. We can "abuse" this by using the twitter:image HTML meta tag.

This is useful when you send a video and want it to be playable in Discord.

How it works

This program will create a .html that you will send instead of a .mp4 file. Discord will parse the HTML and create an embed for you. The embed will be the same as the one you would get if you send a .mp4 file.

Environment variables

Variable Description
SERVE_DOMAIN Domain where we server files from, not where we upload files to.
UPLOAD_FOLDER Path to the directory where we store files.
WEBHOOK_URL Discord Webhook URL

Howto

Your webserver infront of discord-embed needs to be configured for this program to work.

Nginx:

# One subdomain that is a reverse proxy to discord-embed and one subdomain (SERVE_DOMAIN) for images
# The SERVE_DOMAIN url needs this:
root /var/www/embed; # The UPLOAD_FOLDER where our images are
location / {
    try_files $uri $uri/ $uri.html =404; # Note the $uri.html
}

Caddy:

# SERVE_DOMAIN = i.example.com
# UPLOAD_FOLDER = /var/www/embed
embed.example.com {
  reverse_proxy * http://discord-embed:5000 # The Docker container where discord-embed runs
}

i.example.com {
  root * /var/www/embed
  try_files {uri} {uri}/ {uri}.html
  file_server
}

Need help?

Description
Discord will only create embeds for videos and images if they are smaller than 10MiB. We can "abuse" this by using the twitter:image HTML meta tag.
Readme GPL-3.0 1.6 MiB
Languages
Python 93.6%
Dockerfile 6.4%