Sign inSign up

epicmorg/telegram

By epicmorg

•Updated about 16 hours ago

Telegram bot that replies with random quotes from a text file (python-telegram-bot)

Image
0

1.2K

epicmorg/telegram repository overview

⁠epicmorg/telegram

Small Telegram bots. Currently one: bot-quotes — answers /say (and inline queries) with a random quote from quotes.txt. Python 3 from epicmorg/debian:trixie, python-telegram-bot⁠ 22.

⁠What's inside

  • the bot in /usr/local/share/epicmorg/telegram/bot/quotes: bot.py, a sample quotes.txt and translations.json (sources⁠)
  • commands: /start, /say, /help, /version; all texts and command descriptions come from translations.json
  • quotes.txt and translations.json are re-read when they change on disk — no restart needed

⁠Tags

TagsDockerfile
bot-quotes.⁠

Every tag is pushed to docker.io, quay.io and ghcr.io (epicmorg/telegram:<tag> on each) - same digest everywhere.

⁠Usage

  1. Copy and edit quotes.txt (one quote per line) and translations.json.
  2. Run with your bot token:
services:
  quotes:
    image: epicmorg/telegram:bot-quotes
    restart: unless-stopped
    environment:
      TELEGRAM_BOT_TOKEN: "<bot_id>:<secret>"
    volumes:
      - ./quotes.txt:/usr/local/share/epicmorg/telegram/bot/quotes/quotes.txt:ro
      - ./translations.json:/usr/local/share/epicmorg/telegram/bot/quotes/translations.json:ro
VariableDefaultMeaning
TELEGRAM_BOT_TOKEN—bot token
TELEGRAM_BOT_TOKEN_FILE—path to a file with the token (e.g. a Docker secret); wins over TELEGRAM_BOT_TOKEN. Without both, token.txt in the data dir is used if present
BOT_DATA_DIRthe bot directorywhere quotes.txt, translations.json, token.txt are looked up
BOT_QUOTES_FILE / BOT_TRANSLATIONS_FILE<data dir>/…explicit file paths
BOT_PARSE_MODEplain textHTML or MarkdownV2 if quotes contain markup
BOT_INLINE_RESULTS20inline answers per query (1–50)
BOT_SAY_IN_GROUPSofftrue — answer a bare /say in groups without an @mention
BOT_VERSION—reply to /version (otherwise version_message from translations.json)
BOT_LOG_LEVELINFOlog level

Tag summary

Content type

Image

Digest

sha256:53139ba8a…

Size

696.4 MB

Last updated

about 16 hours ago

docker pull epicmorg/telegram:bot-quotes