To maintain anonymity in a telegram group chat.
Add the bot to the group, make the bot admin, grant all required permissions (read, edit chat/messages). That's it. Now messages are resent by bot deleting original thus partially maintaining anonymity.
DB structure can be optimized.
SQLite is used but you can customize the code to utilize PostgreSQL which is more suitable for real projects.
To send media group (10 images/videos in single message instead of 1 by 1) you need to make a middleware to collect by media_group_id, add the Middleware to the router, handle it in handler. \
Below is basic setup.
Use the project at your own risk as anonymity is double-edged sword.
Windows
python -m venv venv && venv\bin\activate && pip install -r requirements.txtLinux/Mac
python3 -m venv venv && source venv/bin/activate && pip3 install -r requirements.txt2. Create .env file and copy all variables from .env_example to it and customize your self (if needed)
Windows
python app.pyLinux/Mac
python3 app.pysudo apt install -y postgresql postgresql-contribsudo -u postres psqlCREATE DATABASE database_name WITH template = template0 ENCODING 'UTF8' LC_CTYPE 'C' LC_COLLATE 'C';CREATE USER user_name WITH PASSWORD 'password';ALTER ROLE user_name SET client_encoding TO 'utf8';ALTER ROLE user_name SET default_transaction_isolation TO 'read committed';ALTER ROLE user_name SET timezone TO 'UTC';Note: If you use another timezone in your project, replace 'UTC' with yours.
GRANT ALL PRIVILEGES ON DATABASE database_name TO user_name;\q