Skip to content

Latest commit

 

History

History
100 lines (77 loc) · 1.58 KB

README.md

File metadata and controls

100 lines (77 loc) · 1.58 KB

Official 1580 school telegram bot

Plain setup:

  1. Create virtual environment.
python -m venv venv
  1. Activate it.
  • On windows:
venv/Scripts/activate
  • On linux:
source venv/bin/activate
  1. Install requirements.
pip install -r requirements.txt
  1. Download poppler, postgres and redis.

  2. Change credentials in .env.

cp .env.example .env
# Telegram
TOKEN='Bot token'
IDEAS_GROUP_ID='id of ideas group'
APPROVED_IDEAS_GROUP_ID='id of approved ideas group'
BUGS_GROUP_ID='id of bugs group'

# Paths
POPPLER_PATH='Absolute path to bin directory of poppler'

# Postgres
POSTGRES_HOST='localhost'
POSTGRES_PORT=5432
POSTGRES_DB='1580'
POSTGRES_USER='postgres'
POSTGRES_PASSWORD='postgres'

# Redis
REDIS_HOST='localhost'
REDIS_PORT=6379
REDIS_DB=0
  1. Create tables.
CREATE TABLE users (
    id SERIAL,
    tg VARCHAR,
    username VARCHAR,
    class VARCHAR,
    building VARCHAR,
    teacher VARCHAR
);

CREATE TABLE staff (
    id SERIAL,
    tg VARCHAR,
    username VARCHAR,
    role VARCHAR
);
  1. Run main.py
python main.py

Docker setup:

  1. Install docker.

  2. Run app.

docker compose up --build

Contributing

  1. Create fork on GitHub.

  2. Clone it locally.

  3. Push changes to fork.

  4. Create pull request to master branch.