Skip to content

schr1k/AnonChat_2.0

Repository files navigation

Readme на русском доступно здесь.

Overview:

  • Project is completely asynchronous thanks to aiogram, asyncpg and redis asyncio.
  • It's easy to test and debug because 2 levels of logging are provided.
  • The yookassa test API is integrated.

Setup:

  1. Telegram:

    • Create new bot via BotFather.
    • Create groups (not channels) for bug reports and ideas, add your bot to them and give him admin rights (to get group id forward a message from it to this bot).
  2. Create yookassa test shop.

  3. Create .env file with following structure (dotenv guide):

# Telegram
TOKEN='token from BotFather'
BUGS_GROUP_ID='group id' # starts with "-"
IDEAS_GROUP_ID='group id' # starts with "-"
RETURN_URL='link to your bot' # needed for yookassa

# Postgres
POSTGRES_USER='postgres'
POSTGRES_PASSWORD='postgres'
POSTGRES_DB='AnonChat'
POSTGRES_HOST='localhost' # change it to container name if you use docker
POSTGRES_PORT='5432'

# Redis
REDIS_DB='1'
REDIS_HOST='localhost' # change it to container name if you use docker
REDIS_PORT='6379'

# Yookassa
YOOKASSA_ACCOUNT_ID='yookassa shop id' # note that this value should be int
YOOKASSA_SECRET_KEY='yookassa api token'

Running:

The easiest way is to run project via docker.

  1. Make sure you have installed docker.

  2. Build the project (it may take some time):

docker compose build
  1. Run the project:
docker compose up

That's all! Docker compose file will install and configure everything.


Alternatively you can run it manually:

  1. Create venv:
python -m venv venv
  1. Activate venv:
  • On Windows:
venv\Scripts\activate
  • On Linux and macOS:
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Install Redis.

  2. Install Postgres (if you changed user or password during installation make sure to also change it in .env file).

  3. Run the project:

python main.py

Feel free to ask questions and share your ideas.

Plans on the project are here.