Git Product home page Git Product logo

datingbot's Introduction

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 fork the DatingBot

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

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
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

📗 Django

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

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

1. Handlers

  1. There must be no buttons in handlers (only in extreme cases, but it is better to put it in a separate file)
  2. If we make a handler for buttons, then we use the "text='action'" in the decorator parameters
  3. If we are fetching data or updating data, then the function call should be like this: await db_commands.func(...)

2. Keyboards

  1. If you use the "default button", you need to put them in the "keyboard/default" directories.
  2. If you are creating a new file, then you should add the prefix "_default" to the filename
  3. If you use the "inline button", you need to put them in the "keyboard/inline" directories.
  4. If you are creating a new file, then you should add the prefix "_inline" to the filename
  5. If you are creating a new keyboard, then you should add the prefix "_keyboard" in the name function

3. Language

For multi languages we use i18n. All the instructions we can find here - Language guide



Works on Open Source

image

datingbot's People

Contributors

davidromanovizc avatar dependabot[bot] avatar jagger909 avatar kartasar avatar mary-sanders avatar qwertilus avatar serzhenko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.