Go to file
Clarth 4d802eb4ec Update README.md 2024-03-06 19:52:01 -05:00
README.md Update README.md 2024-03-06 19:52:01 -05:00
marvin.jpg Bot Avatar 2023-11-14 17:24:53 -05:00
tg_print.py Now prints image files. 2024-01-02 17:20:51 -05:00

README.md

Centered Image

Set Up Guide

  1. Install cups

sudo apt install cups

  1. Create a python virtual environment

python3 -m venv /absolute/path/to/venv

  1. Install depends in venv

/absolute/path/to/venv/bin/pip3 install pyTelegramBotAPI or /absolute/path/to/venv/bin/pip install pyTelegramBotAPI==4.14.0

  1. Edit tg_print.py with correct telegram API token and change directories variables.

  2. Start the script /absolute/path/to/venv/bin/python tg_print.py

Unit file

[Unit]
Description=tg_print_bot
After=network-online.target

[Service]
User=nobody #must be run as user with printer permissions.
ExecStart=/absolute/path/to/venv/bin/python /absolute/path/to/start.py
Restart=always
RestartSec=5s
RuntimeMaxSec=12h

[Install]
WantedBy=multi-user.target

Start Script

Recommend running in a screen or tmux.

#!/bin/bash
/absolute/path/to/venv/bin/python /absolute/path/to/start.py
exit

Usage

  1. Send a file to the chat or directly to the bot in a PM.
  2. Collect paper from the printer.

https://github.com/eternnoir/pyTelegramBotAPI