/fyysikkospeksi-taulubot

Telegram bot for adding a Fyysikkospeksi related frame to user's profile picture.

Primary LanguagePythonMIT LicenseMIT

Fyysikkospeksi Taulubot

Fyysikkospeksi logo

example workflow License: MIT Pictures: CC0-1.0

Telegram bot for adding a Fyysikkospeksi related frame to user's profile picture.

Forked from EinariTuukkanen/telegram-bots.

Code licensed under MIT license and pictures under CC0 1.0.

Deploying

Docker (recommended)

  1. Make a .env-file containing TAULUBOT_TOKEN and the corresponding token.
  2. Run Docker with
    docker run -d --restart unless-stopped --env-file .env ghcr.io/fyysikkokilta/fyysikkospeksi-taulubot:main
    Optionally, to override the frame images, you can mount a folder with your images to /taulu/taulubot/images. Mounting the current folder as read-only works as follows:
    docker run -d --volume ${pwd}:/taulu/taulubot/images:ro --env-file .env ghcr.io/fyysikkokilta/fyysikkospeksi-taulubot:main

Python

  1. Install dependencies w/
    pip install -e .
  2. Set the TAULUBOT_TOKEN environment variable
    export TAULUBOT_TOKEN=1234:abcedf
  3. Start the bot with python taulubot/main.py

Instead of 3. one can alternatively open a Python shell and run

from taulubot.main import main
main()

Development

  1. Clone the repo
  2. Install dependencies
    pip install -e .
    (optional) or the testing dependencies as well
    pip install -e .[test]
  3. Start coding!

Testing

Testing requires valid TAULUBOT_TOKEN_TEST, TELEGRAM_APP_ID, TELEGRAM_APP_HASH, and TELETHON_SESSION environment variables. Refer to this guide on how to generate them. After these are set up, tests can be run with:

pytest tests

Frames

Normal

Frame

Above (colorised)

Frame