Skip to content

✨A Telegram Bot with open source code, which implemented django and a dating system

License

Notifications You must be signed in to change notification settings

nkhaldi/DatingBot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DatingBot

An open source telegram bot with which you can find new acquaintances

📚 Table of Contents

🖍 Used technology

Python Django Postgresql

📦 Installation

First check if you have Python installed

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

Then clone the DatingBot

$ 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

🚀 Usage

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

📗 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

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

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

🥅 Possible errors

$ 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

👥 Contributing

Code Style Guide

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.

1. Fork the Project

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.

2. Clone the Repository

$ git clone https://github.com/DavidRomanovizc/DatingBot.git

3. Project Setup

For instructions on deploying the project on a local computer, see above

4. Create a Branch

Create a new branch for your changes:

$ git checkout -b branch-name

5. Make Changes

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

6. Commit and Push

$ git commit -m "Description of your changes"
$ git push origin your-branch-name

7. Create a Pull Request

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.

8. Discussion and Review

Discuss your Pull Request with the community members. Make necessary changes based on the feedback.

9. Merge the Pull Request

After approval, your code will be merged into the main branch of the project.

10. Celebration 🎉

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



Works on Open Source

image

About

✨A Telegram Bot with open source code, which implemented django and a dating system

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Dockerfile 0.2%