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
$ https://github.com/DavidRomanovizc/DatingBot.git
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 |
---|---|---|
BOT_TOKEN | str | True |
ADMINS | list | True |
SUPPORTS | list | True |
IP | str | True |
TIMEZONE | str | True |
MODERATE_CHAT | str | True |
DB_USER | str | True |
DB_PASS | str | True |
DB_HOST | str | True |
DB_NAME | str | True |
SECRET_KEY | str | True |
API_KEY | str | True |
QIWI_KEY | str | True |
PHONE_NUMBER | str | True |
SECRET_P2 | str | True |
BOT_TOKEN
- Bot token
ADMINS
- list of admins id
SUPPORTS
- list of admins id
IP
- ip for other services
TIMEZONE
- your time zone for working with the scheduler
MODERATE_CHAT
- telegram chat where the event will be moderated
DB_USER
- username of the database owner
DB_PASS
- password from the database
DB_HOST
- IP address of the database
DB_NAME
- database name
SECRET_KEY
- secret key for django
API_KEY
- yandex api key for yandex map
QIWI_KEY
- qiwi api key for receiving payments
PHONE_NUMBER
- your phone number (need for qiwi)
SECRET_2
- public p2 key which allows you to issue an invoice and open a transfer form
Install Django
$ pip install Django
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
Add jazzmin to your INSTALLED_APPS
before django.contrib.admin.
Path to settings: DatingBot/django_project/telegrambot/telegrambot/settings.py
INSTALLED_APPS = [
'jazzmin',
'django.contrib.admin',
[...]
]
$ python django_app.py makemigrations
$ python django_app.py migrate
$ python django_app.py createsuperuser
$ 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
- There must be no buttons in handlers (only in extreme cases, but it is better to put it in a separate file)
- If we make a handler for buttons, then we use the "text='action'" in the decorator parameters
- If we are fetching data or updating data, then the function call should be like this:
await db_commands.func(...)
- If you use the "default button", you need to put them in the "keyboard/default" directories.
- If you are creating a new file, then you should add the prefix "_default" to the filename
- If you use the "inline button", you need to put them in the "keyboard/inline" directories.
- If you are creating a new file, then you should add the prefix "_inline" to the filename
- If you are creating a new keyboard, then you should add the prefix "_keyboard" in the name function
For multi languages we use i18n. All the instructions we can find here - Language guide