https://github.com/kulmajaba/visitor-bot
Telegram bot for recording visitors to a space
https://github.com/kulmajaba/visitor-bot
telegram telegram-bot
Last synced: about 1 year ago
JSON representation
Telegram bot for recording visitors to a space
- Host: GitHub
- URL: https://github.com/kulmajaba/visitor-bot
- Owner: kulmajaba
- License: mit
- Created: 2020-08-16T20:15:31.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T08:51:12.000Z (almost 6 years ago)
- Last Synced: 2025-02-15T20:41:25.491Z (over 1 year ago)
- Topics: telegram, telegram-bot
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Visitorbot
Telegram bot for recording visitors to a space.
* Easy usage through Telegram: register with your name and email, after that use the buttons to sign yourself in or out.
* Deletes records older that 30 days automatically
* Allows a single admin user to get a CSV file containing all visits from the past 30 days via Telegram.
## Setup
The backend is built using Docker and docker-compose, but should be possible to run without Docker as well. The implementation is done with Python 3.8.5 using PostgreSQL 12
Copy or rename the `.env.sample` file to the same folder as `.env` and fill in the missing information.
| Variable | Description |
| ----------------- | ----------- |
| BOT_ORGANIZATION | The name of the organization the bot belongs to, currently only used for report file names. |
| PYTZ_TIMEZONE | Timezone used by Python, use valid Pytz timezones. E.g. Europe/Helsinki. You'll probably want to match the database timezones. |
| TZ | Postgres timezone. |
| PGTZ | Postgres default timezone. |
| TG_TOKEN | Telegram API token for the bot. |
| TG_ADMIN_ID | Telegram user ID (not username) of the admin, enables the ability to fetch reports. Use e.g. [@userinfobot](https://t.me/userinfobot) to get your ID. |
| POSTGRES_DB | Postgres database name. Used by both PostgreSQL and Python code. |
| POSTGRES_USER | Postgres user for DB access. Same as above. |
| POSTGRES_PASSWORD | Postgres user password. Same as above. |
| POSTGRES_HOST | Hostname for the Python code to use when connecting to the DB, use `db` for Docker installations with the default docker-compose file |
| POSTGRES_PORT | Postgres port, used by both PostgreSQL and Python code. |
| POSTGRES_TABLE_USER | Table name for the users of the bot, use `visitor_user` for installations with the default database initialization |
| POSTGRES_TABLE_VISIT | Table name for the visits, use `visit` for installations with the default database initialization |
After that, you should be able to build and run the bot with `docker-compose up -d`. Add `--build` to rebuild images and/or `--force-recreate` to recreate the application containers.
Check logs with `docker-compose logs`, `-f` to follow, shut down with `docker-compose down`.