/BookingBot

Telegram bot for booking auditorium

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

BookingBot

Codacy Badge

Telegram bot for booking auditorium

See help.txt for information about commands (it is in russian, not trasnslated into english yet).

You can also see documentation in python code.

Configuration

Bot settings should be set as environment variables.

Token

Environment variable TOKEN should be set to token for Telegram API.

Important notice: this data should be kept private for security reasons.

Contact list file

Environment variable CONTACTLIST_FILE should be set to name of contact list file, default value is ../BookingBot-data/contacts.txt.

This is text file, its content will be displayed to users who type /contactlist command.

Proxy file

Environment variable TELEGRAM_PROXY should be set to proxy configuration.

It should contain proxy type, space character and proxy URL.

Example:

export TELEGRAM_PROXY="https https://192.168.0.228:8080"

Or, if no proxy should be used:

export TELEGRAM_PROXY=none

Database

Environment variable DATABASE_URL should be set to database URL (see playhouse.db_url.connect documentation), default value is sqlite:/../BookingBot-data/data.db.

Example:

export DATABASE_URL="postgresql://bookingbot:password@localhost:5432/bookingbot"

Or:

export DATABASE_URL="sqlite:/../BookingBot-data/data.db"

Log file

Environment variable BOT_LOG should be set to log file name, default value is ../BookingBot-data/log.log.

Log will be appended to this file.

Calendar locale

Environment variable BOT_CALENDAR_LOCALE should be set to locale used for rendering calendar, if it is not set, system locale is used.

Example:

export BOT_CALENDAR_LOCALE=ru_RU.UTF-8

Thread count

Environment variable THREAD_NUMBER should be set to thread count for bot, default value is 2.

Example:

export THREAD_NUMBER=8

Management

Management script is named manage.py.

Loading whitelist file

Whitelist can be added to database from file using following command:

python ./manage.py load-whitelist FILENAME

Each line of file should contain either user ID of user, or comment, begining with the # character.

Example:

#This is whitelist
252070907
#124889533

Loading administrator list file

Administrators can be added from file using following command:

python ./manage.py load-admins FILENAME

Each line of file should contain either user ID of amdministrator, or comment, begining with the # character.

Example:

#This is admin list
252070907
#124889533

Adding administrator

User can be made administator using following command:

python ./manage.py op-username USERNAME

Removing administrator

User can be made not administator using following command:

python ./manage.py deop-username USERNAME