Files
redairsoft_vk_gt_max_sender/.env.example
T
exostring 20135263c4 Add multi-route donor->recipient support, fix VK hashtag truncation
Posts can now be sourced from multiple VK groups, each routed to its own
Telegram/MAX destination(s) with independent on/off switches, configured
via data/routes.json (supports // line comments). Falls back to a single
route auto-generated from the legacy VK_SOURCE/TG_CHAT_ID/MAX_CHAT_ID env
vars if routes.json doesn't exist yet, so existing deployments keep working.

Routes are processed strictly sequentially within a cycle (no concurrency)
to keep flood control on VK/TG/MAX correct, since bot tokens are shared
across routes. DB schema gains route_id in the posts uniqueness key so the
same VK donor can safely feed multiple routes without status collisions.

Also removes the trailing-hashtag-stripping logic in text_formatter, which
was silently deleting VK posts' own hashtags whenever COMMON_TAGS wasn't
configured (it always wasn't) - posts are now forwarded unchanged.
2026-08-18 14:48:22 +05:00

109 lines
4.4 KiB
Bash

# ==========================================
# Donor(VK) -> Recipient(TG/MAX) routes
# ==========================================
# Multiple VK donor groups, each with its own Telegram/MAX destination(s) and its own
# TG/MAX on-off switches, are configured in a separate JSON file (default data/routes.json),
# NOT here. See data/routes.json.example for the format.
#
# VK_SOURCE / TG_CHAT_ID / MAX_CHAT_ID below are ONLY used once, as a fallback: if
# data/routes.json doesn't exist yet, it gets auto-generated from these three values
# as a single route (id "default") on first run. After that, edit routes.json directly -
# these three env vars are then ignored.
ROUTES_CONFIG_PATH=data/routes.json
# ==========================================
# VKontakte Settings
# ==========================================
# VK User/Service access token (shared by all routes)
VK_ACCESS_TOKEN=vk1.a.your_vk_token_here
# Legacy single-route fallback - see routes.json note above
VK_SOURCE=redairsoft
# VK API Version
VK_API_VERSION=5.199
# Number of wall posts to fetch each cycle (default 10)
VK_CHECK_COUNT=10
# ==========================================
# Telegram Settings
# ==========================================
# Telegram Bot Token (from @BotFather) - shared by all routes, posts into whichever
# chat_id each route configures
TG_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrSTUvwxYZ
# Legacy single-route fallback - see routes.json note above
TG_CHAT_ID=-1001234567890
# Optional TG Media Storage Channel (e.g. for generating permanent file_ids)
TG_MEDIA_CHANNEL_ID=
# Admin Telegram ID(s) for notifications & reports (single ID or comma-separated "123456,789012")
TG_ADMIN_IDS=123456789
# Timeout (seconds) for send_photo/send_video/send_media_group. Must comfortably
# cover your largest expected video at real upload speed (default 1800 = 30min).
TG_MEDIA_UPLOAD_TIMEOUT_SEC=1800
# ==========================================
# Local Telegram Bot API (Optional)
# If TELEGRAM_API_ID & TELEGRAM_API_HASH are provided, local API server runs inside container automatically
# ==========================================
LOCAL_BOT_API_URL=
TELEGRAM_API_ID=
TELEGRAM_API_HASH=
# ==========================================
# MAX Messenger Settings
# ==========================================
# MAX Bot Token - shared by all routes, posts into whichever chat_id each route configures
MAX_BOT_TOKEN=your_max_bot_token_here
# Legacy single-route fallback - see routes.json note above
MAX_CHAT_ID=123456
# MAX API Base URL
MAX_API_BASE_URL=https://platform-api2.max.ru
# MAX's documented hard cap for a single video attachment. Videos over this are
# sent as a "watch via link" text note instead of failing the upload.
MAX_VIDEO_LIMIT_MB=250
# ==========================================
# Polling, Reporting & Maintenance
# ==========================================
# Check interval in minutes (default: 15)
CHECK_INTERVAL_MINUTES=15
# Initial start behavior on fresh DB:
# "skip_existing" (default) - ignores old history, posts only new posts published after start
# "publish_latest_one" - publishes only the 1 latest post and skips older ones
# "publish_all" - publishes all wall posts fetched
BOOTSTRAP_MODE=skip_existing
# Send report to admin even if 0 new posts were found
REPORT_EMPTY_RUNS=false
# Send report to admin if an error occurred during checking/posting
REPORT_ON_ERROR=true
# Clean stale temp files older than X minutes (default: 30)
CACHE_MAX_AGE_MINUTES=30
# ==========================================
# Media & Video Limits
# ==========================================
# Max video size for Cloud TG API in MB (limit: 49-50 MB)
VIDEO_MAX_SIZE_MB_CLOUD=49
# Max video size when using Local TG API in MB (supports up to 2000 MB)
VIDEO_MAX_SIZE_MB_LOCAL=500
# Max video duration in seconds (default: 600s / 10 min)
VIDEO_MAX_DURATION_SEC=600
# Max video resolution height (default: 720p)
VIDEO_MAX_HEIGHT=720
# ==========================================
# Post Formatting & Customization
# ==========================================
# Text to prepend before every post
HEADER_TEXT=
# Text to append after every post
FOOTER_TEXT=
# Common hashtags to attach (e.g., "#redairsoft #страйкбол")
COMMON_TAGS=#redairsoft #страйкбол
# Make the first line of the post bold
FORMAT_FIRST_LINE_BOLD=true
# Telegram auto-reaction emoji on published posts (real Bot API method, unlike MAX)
TG_AUTO_REACTION=👍
TG_AUTO_REACTION_ENABLED=true
# Logging Level (DEBUG, INFO, WARNING, ERROR)
LOG_LEVEL=INFO