An open source telegram bot with which you can find new acquaintances
Before installing this DatingBot-project you need to check if you have python
To check if you have python installed, run this command in your terminal:
$ python -V
If you get an answer like this, it means that Python
is installed.
$ Python 3.9.5
$ git clone https://github.com/DavidRomanovizc/DatingBot.git
and create a Virtual Environment
$ python -m venv venv
Activate the virtual environment:
On Windows:
$ venv\Scripts\activate
On macOS and Linux:
$ source venv/bin/activate
and install requirements
$ pip install -r requirements.txt
First you need to rename the file .env.dist
to .env
.
After that, you need to fill it with data.
Variable | Type | Importance | Description |
---|---|---|---|
BOT_TOKEN | str | True | Bot token |
ADMINS | list | True | list of admins id |
SUPPORTS | list | True | list of supports id |
IP | str | True | ip for other services |
TIMEZONE | str | True | your time zone for working with the scheduler |
MODERATE_CHAT | str | True | telegram chat where the event will be moderated |
DB_USER | str | True | username of the database owner |
DB_PASS | str | True | password from the database |
DB_HOST | str | True | IP address of the database |
DB_PORT | str | True | the database port. Usually the db running on port 5432 |
DB_NAME | str | True | database name |
SECRET_KEY | str | True | secret key for django |
API_KEY | str | True | yandex api key for yandex map |
QIWI_KEY | str | True | qiwi api key for receiving payments |
PHONE_NUMBER | str | True | your phone number (need for qiwi) |
SECRET_P2 | str | True | public p2 key which allows you to issue an invoice and open a transfer form |
USE_REDIS | bool | False | Optional parameter |
To create a SECRET_KEY
you can use the site to generate secret keys
And then paste it into the .env
file
SECRET_KEY=jjv@^0qv^=aydunfjo$qpd_66j+)egm1#-c1iwt%mtjinm)ftj
Install the jazzmin
$ pip install -U django-jazzmin
To create required database tables and an admin user, use the following commands
$ python django_app.py makemigrations
$ python django_app.py migrate
$ python django_app.py createsuperuser
$ python django_app.py makemigrations usersmanage
$ python django_app.py migrate usersmanage
$ python django_app.py runserver
NudeNet is a collection of pre-classification and recognition models for nudity detection and censorship. This project supports three different ways:
- Classification
- Detection
- Censoring images
In our case we use censoring images. For more information about this library, please visit the official repository at GitHub here.
Install TensorFlow
If you have a GPU available, install the GPU based version of TensorFlow with the following command:
$ python -m pip install tensorflow-gpu==1.15
When using TensorFlow with support for GPU, be sure to have CUDA v10.0 installed on your system. Otherwise, use the CPU based package:
$ python -m pip install tensorflow==1.15
Install NudeNet
You can install this module with the following command:
$ pip install --upgrade nudenet
The code that generates the censored image can be found on this path
$ DatingBot/utils/NudeNet/
And after that you need to run the file app.py
$ ImportError: cannot import name '_registerMatType' from 'cv2.cv2' (...)
To solve this problem, you can install the previous version of opencv-python-headless
$ InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from ./NudeNet/detector_v2_default_checkpoint.onnx failed:Protobuf parsing failed.
When running the first time, it will download the default checkpoint
Downloading the checkpoint to:
- Windows
C:/Users/username/.NudeNet/default/detector_v2_default_checkpoint.onnx
- MacOS
/Users/username/.NudeNet/detector_v2_default_checkpoint.onnx
- Linux
/root/.NudeNet/detector_v2_default_checkpoint.onnx
To solve this problem, first, you need to download checkpoint manually. You can find it in Releases
After you have downloaded the checkpoint you need, drag it to the NudeNet folder
We try to stick to PEP 8
Thank you for your interest in contributing to our Python project! Below are the steps to help you become a part of our developer community.
Go to the repository page on GitHub and click the "Fork" button in the upper right corner. This will create a copy of the project in your account.
$ git clone https://github.com/DavidRomanovizc/DatingBot.git
For instructions on deploying the project on a local computer, see above
Create a new branch for your changes:
$ git checkout -b branch-name
Make the necessary changes to the project code. Follow the project's structure, coding style, and development guidelines.
And run the flake8
$ flake8 --config=.flake8
$ git commit -m "Description of your changes"
$ git push origin your-branch-name
Go to your repository on GitHub and click the "New Pull Request" button. Specify the base branch of the project (
usually main
or master
) and the branch with your changes.
Discuss your Pull Request with the community members. Make necessary changes based on the feedback.
After approval, your code will be merged into the main branch of the project.
Congratulations! You have successfully contributed to the Python project. Thank you for your help!
For multi languages we use i18n. All the instructions we can find here - Language guide