Skip to content

DarkTankist/govd

 
 

Repository files navigation

govd

a telegram bot for downloading media from various platforms.

this project draws significant inspiration from yt-dlp.


dependencies

  • ffmpeg >= 7.x
    • with shared libraries
  • libheif >= 1.19.7
  • pkg-config
  • sql database
    • mysql or mariadb

installation

build

Note

there's no official support for windows yet. if you want to run the bot on it, please follow docker installation.

  1. clone the repository:

    git clone https://github.com/govdbot/govd.git && cd govd
  2. create or update the .env file to set the database properties.
    for enhanced security, it is recommended to change the DB_PASSWORD property.

  3. make sure your database is up and running.

  4. build and run the bot:

    sh build.sh && ./govd

docker (recommended)

  1. clone the repository:

    git clone https://github.com/govdbot/govd.git && cd govd
  2. create or update the .env file to ensure the database properties match the environment variables defined for the mariadb service in the docker-compose.yml file.
    for enhanced security, it is recommended to change the MARIADB_PASSWORD property in docker-compose.yaml and ensure DB_PASSWORD in .env matches it.

    the following line in the .env file must be set as:

    DB_HOST=db
    
  3. run the compose to start all services:

    docker compose up -d

Tip

after updating your .env file, rebuilding the image is not necessary. simply restart the containers with the docker compose restart command to apply the changes.

configuration

you can configure the bot using the .env file. here are the available options:

database

variable description default
DB_HOST database host localhost
DB_PORT database port 3306
DB_NAME database name govd
DB_USER database user govd
DB_PASSWORD database password none

telegram

variable description default
BOT_API_URL telegram bot api url https://api.telegram.org
BOT_TOKEN telegram bot token none
CONCURRENT_UPDATES max concurrent updates handled 50

media & files

variable description default
DOWNLOADS_DIR directory for downloaded files downloads
MAX_DURATION max duration (parsed string) 1h
MAX_FILE_SIZE max file size in mb 1000
CACHING whether to enable media caching true

proxying

variable description default
HTTP_PROXY http proxy none (disabled)
HTTPS_PROXY https proxy none (disabled)
NO_PROXY no proxy domains none (disabled)

security

variable description default
WHITELIST list of allowed ids separated by commas none (disabled)

default groups settings

variable description default
DEFAULT_ENABLE_CAPTIONS show original captions on messages false
DEFAULT_ENABLE_SILENT omit error messages in groups (silent fail) false
DEFAULT_ENABLE_NSFW enable nsfw content in groups false
DEFAULT_MEDIA_LIMIT max media files in a single message 10

messages

variable description default
CAPTION_HEADER customizable caption's header -
CAPTION_DESCRIPTION customizable caption's description -

development

variable description default
REPO_URL project repository url https://github.com/govdbot/govd
PROFILER_PORT port for profiler http server (pprof) 0 (disabled)
LOG_LEVEL log level (debug, info, warn, error) info
LOG_FILE whether to enable file logging false

extractors

you can configure specific extractors options with config.yaml file (learn more).

Important

to avoid limits on files, you should host your own telegram botapi and set BOT_API_URL variable according. public bot instance is currently running under a botapi fork, tdlight-telegram-bot-api, but you can use the official botapi client too.

proxying

there are two types of proxying available:

  • http proxy: this is a standard http proxy that can be used to route requests through a proxy server. you can set the HTTP_PROXY and HTTPS_PROXY environment variables to use this feature. (SOCKS5 is supported too)
  • edge proxy: this is a custom proxy that is used to route requests through a specific url. currenrly, you can only set this proxy with config.yaml file (learn more).

Tip

by settings NO_PROXY environment variable, you can specify domains that should not be proxied.

authentication

some extractors require cookies to access the content. please refer to this page for more information on how to set up authentication for each extractor.

todo

  • add tests
  • add support for telegram webhooks
  • switch to pgsql (maybe)
  • better api
  • better docs

About

a telegram bot for downloading media from various platforms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.8%
  • Dockerfile 1.1%
  • Shell 0.1%