Discord.js Add to Discord GitHub

a discord bot that downloads media from social media platforms and urls, then converts it to gifs.

what it does

gronka downloads videos and images from social media platforms or direct urls, stores them, and can convert them to gifs.

downloading media

download media from social platforms using the /download command:

you can also download media from direct urls using /convert with a url parameter. the bot handles videos and images from most common sources.

converting media

convert downloaded media or files you upload to gifs:

gifs can also be converted to gifs with different quality settings or optimizations.

how it works

gronka consists of three components:

  1. discord bot - the part that lives in your server, downloads media, and does the converting
  2. r2 storage - stores and serves videos, images, and gifs via cloudflare r2 (optional, falls back to local storage)
  3. webui (optional) - a simple dashboard if you want to see stats

getting started

running it locally

you’ll need node.js 20+ and ffmpeg installed. then:

git clone https://github.com/thedorekaczynski/gronka.git
cd gronka
npm install
cp .env.example .env

edit .env and add your discord token and client id. then:

npm run register-commands
npm run local

using docker

# create your .env file first
docker compose up -d

# register discord commands (only need to do this once)
docker compose run --rm app npm run register-commands

configuration

you need these two things in your .env:

everything else is optional. check .env.example for additional configuration options including output quality, file size limits, and storage settings.

r2 storage

gronka can use cloudflare r2 for storing and serving gifs, videos, and images. when configured, files are uploaded to r2 and served via your public domain. if not configured, it falls back to local filesystem storage.

to enable r2, add these to your .env:

r2 is optional but recommended for production deployments. files are automatically uploaded to r2 when configured, and the bot will check r2 first before downloading or converting to avoid duplicates.

cobalt integration

gronka uses cobalt.tools, a self-hosted api for downloading media from social platforms. when enabled, the /download command automatically detects social media urls and downloads the media directly to your storage.

supported platforms: twitter/x, tiktok, instagram, youtube, reddit, facebook, threads.

to enable cobalt, add these to your .env:

downloaded media is stored in your configured storage (r2 or local). you can then convert it to gifs using /convert, or download without conversion using /download.

using gronka

commands

storage

gronka stores all downloaded media: videos, images, and gifs. when using r2, files are served directly from your r2 public domain. when using local storage, files are stored on disk and can be served via the local server endpoints:

dashboard

if you want to see pretty stats:

docker compose --profile webui up -d webui

then go to http://localhost:3001

development

useful commands:

npm start              # start the bot
npm run server         # start the local server (only needed if not using r2)
npm run local          # run both at once
npm run dev            # bot with hot reload
npm run lint           # check code style
npm run format         # auto-format code

the project uses eslint and prettier. run npm run validate before committing to ensure code quality.

built with

gronka uses a mix of open-source tools and services.

core:

media processing:

storage and database:

frontend:

infrastructure:

license

MIT