Skip to content

A discord bot that replaces reddit links with their image or video

License

Notifications You must be signed in to change notification settings

haveachin/reddit-bot

Repository files navigation

Reddit Bot for Discord

A discord bot that replaces image/gif, text, and video posts with a rich preview

Image Preview

image preview

Video Preview

image preview

Text Preview (1000 Character limit)

image preview

Build

Requires Go 1.21+

make all or CGO_ENABLED=0 go build -ldflags "-s -w" ./cmd/reddit-bot

Configuration

See the default configuration file for more information.

Post Processing for Videos

The Reddit Bot uses yt-dlp for downloading and processing videos. This allows you to customize the post processing args for your hardware.

Intel Hardware Accelleration with VAAPI (i965)

postProcessingArgs:
  - >-
    Merger+ffmpeg_i1:
    -vaapi_device /dev/dri/renderD128
  - >-
    Merger+ffmpeg_o:
    -vcodec h264_vaapi
    -vf 'format=nv12,hwupload,scale_vaapi=iw/2:ih/2'
    -qp 28
    -fpsmax 24
    -c:a libopus
    -b:a 64k

When using Docker Compose you need to add this:

version: '3'

services:
  reddit-bot:
    ...
    group_add:
      # Change this to match your "render" host group id.
      # Use: getent group render | cut -d: -f3
      - "989"
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128

Nvidia Hardware Accelleration with CUDA

postProcessingArgs:
  - >-
    Merger+ffmpeg_i1:
    -hwaccel cuda
    -hwaccel_output_format cuda
  - >-
    Merger+ffmpeg_o:
    -vf 'hwupload,scale_cuda=iw/2:ih/2'
    -c:v h264_nvenc
    -rc constqp
    -qp 28
    -fpsmax 24
    -c:a libopus
    -b:a 64k

Docker setup not done yet. Contributions are welcome.