mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-09-22 23:32:04 +00:00
`cp .env.example .env` is now the documented starting point: the tracked
template carries every variable (grouped required / sites / bot behaviour /
network / webhook / reverse proxy) with the defaults the code would use
anyway, and the compose comment plus both READMEs point at it. The proxy note
is spelled out where it matters — teloxide panics on a blank `TELOXIDE_PROXY`,
and inside a container the proxy host must be `host.docker.internal`.
Two follow-ups the template exposed:
- `RUST_LOG=` (present but blank, which `.env` makes easy) silenced the log
again: "unset" was handled, "empty" was not. A blank value now falls back to
the same default. Verified: blank and unset both produce the full startup
sequence.
- `TWITTER_AUTH_TOKEN` was in the README prose but missing from the env table
(both languages).
Verified: `docker compose --env-file .env.example config -q` resolves, and a
script comparing the compose's `${VAR}` references against the template's keys
finds none missing.
77 lines
3.5 KiB
Bash
77 lines
3.5 KiB
Bash
# Copy to `.env` (gitignored) and fill in:
|
|
#
|
|
# cp .env.example .env
|
|
#
|
|
# `docker compose` reads it for the `${VAR}` substitutions in
|
|
# docker-compose.yml, and `cargo run` reads it through dotenv. Every variable is
|
|
# described in README.md ("环境变量说明" / "Environment variables") — this file
|
|
# only shows the shape, with the defaults the code would use anyway.
|
|
|
|
# --- required -------------------------------------------------------------
|
|
# Token from @BotFather. Without it the bot exits at startup.
|
|
TELOXIDE_TOKEN=
|
|
|
|
# --- sites (all optional) -------------------------------------------------
|
|
# Pixiv: refresh token. Unset = pixiv links answer "support is disabled".
|
|
PIXIV_REFRESH_TOKEN=
|
|
# Twitter/X: the `auth_token` cookie of a logged-in session, used only for
|
|
# NSFW tweets that the public syndication endpoint withholds.
|
|
TWITTER_AUTH_TOKEN=
|
|
# bilibili: the whole cookie string; only needed when the egress IP stays
|
|
# risk-controlled (device cookies are fetched automatically).
|
|
BILIBILI_COOKIE=
|
|
|
|
# --- bot behaviour --------------------------------------------------------
|
|
# Admin chat IDs, comma-separated: start/stop notices, admin-only commands.
|
|
BOT_ADMIN=
|
|
# Log level. Leave the line commented out for the default
|
|
# (`info,hyper_util=warn,reqwest=warn`); do not set it to an empty value.
|
|
# RUST_LOG=info,xmedia_bot=debug,x_media=debug
|
|
# Edit-before-forward record TTL (seconds).
|
|
EDIT_MESSAGE_TTL_SECONDS=86400
|
|
# Link-result cache TTL (seconds).
|
|
LINK_CACHE_TTL_SECONDS=604800
|
|
# Wrap a post's text in a collapsible blockquote from this many characters on;
|
|
# 0 disables the wrap.
|
|
CAPTION_QUOTE_TEXT_CHARS=200
|
|
# State directory (local runs only — the container uses /app/data).
|
|
DATA_DIR=data
|
|
|
|
# --- network --------------------------------------------------------------
|
|
# HTTP proxy for the Bot API and site fetches. Two traps: teloxide panics on a
|
|
# *blank* value, so comment the line out rather than leaving it empty; and
|
|
# inside a container the proxy must be reachable from there (use
|
|
# host.docker.internal, not 127.0.0.1 — that is the container itself).
|
|
# docker-compose.yml does not pass this variable unless you add it to the bot
|
|
# service's `environment:` block.
|
|
# TELOXIDE_PROXY=http://127.0.0.1:10808
|
|
|
|
# --- webhook deployment (docker-compose.yml) ------------------------------
|
|
# false = long polling (no public URL needed). true = webhook behind the
|
|
# bundled nginx-proxy — and then WEBHOOK_LISTEN/PORT/URL are required.
|
|
WEBHOOK=false
|
|
# WEBHOOK_LISTEN=0.0.0.0
|
|
# WEBHOOK_PORT=8443
|
|
# WEBHOOK_URL=https://your.domain/
|
|
# Validation token Telegram echoes back as X-Telegram-Bot-Api-Secret-Token.
|
|
# WEBHOOK_SECRET_TOKEN=
|
|
# Self-signed certificate path, used only for Telegram-side validation (TLS is
|
|
# terminated by the reverse proxy); unneeded with acme-companion. Not passed by
|
|
# docker-compose.yml — add the line there if this deployment needs it.
|
|
# WEBHOOK_CERT=/app/cert/cert.pem
|
|
|
|
# --- reverse proxy (docker-compose.yml) -----------------------------------
|
|
# Public domain or IP that nginx-proxy routes for; empty = do not route.
|
|
VIRTUAL_HOST=
|
|
# Port inside the bot container nginx-proxy forwards to.
|
|
VIRTUAL_PORT=8443
|
|
# Certificate notification address for acme-companion.
|
|
DEFAULT_EMAIL=
|
|
# UID the container runs as; it must be able to write ./data on the host.
|
|
LOCAL_USER_ID=1000
|
|
# Uncomment (here and the matching line in docker-compose.yml) to have
|
|
# acme-companion issue the certificate for VIRTUAL_HOST.
|
|
# ACME_HOST=
|
|
# Send requests with an unknown Host to this vhost (needed for plain-IP access).
|
|
# DEFAULT_HOST=
|