Giter Site home page Giter Site logo

brainboxdotcc / beholder Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 510 KB

The Beholder Bot - Block Bad Images on Discord!

Home Page: https://dpp.dev/

License: Apache License 2.0

CMake 1.73% C++ 98.09% Shell 0.18%
image-processing image-recognition ocr bot cpp cpp17 discord discord-bot discord-moderation discord-moderation-bot

beholder's Introduction

Social

This is a bot powered by the D++ library which scans images posted on public channels through OCR and AI Image Recognition and uses pattern matching to determine what is in the images. If they match the admin's defined ruleset, it deletes the message and tells the user off with a customisable message.

Compilation

mkdir build
cd build
cmake ..
make -j

Configuring the bot

Create a config.json in the directory above the build directory:

{
	"token": "token goes here", 
	"tunnel_interface": "GRE tunnel interface IP",
	"log": "log path goes here",
	"environment": "environment name",
	"sentry_dsn": "sentry dsn",
	"sentry_sample_rate": 0.2,
	"ir": {
		"host": "image recognition endpoint",
		"path": "image recognition endpoint",
		"credentials": {
			"username": "username",
			"password": "password"
		},
		"fields": [],
		"label_runner": "resnet-50 endpoint url",
		"label_key": "resnet key"
	},
	"database": {
		"host": "localhost",
		"username": "mysql username",
		"password": "mysql password",
		"database": "mysql database",
		"port": 3306
	}
	,
	"botlists": {
		"top.gg": {
			"token": "top.gg bot list token"
		},
		"other compatible bot list": {
			"token": "their token..."
		}
	}
}

Note: Leave the values under the ir key as empty strings. Self-hosting the premium image recognition API is not supported at this time.

Import the base mysql schema:

mysql -u <database-user> -p <database-name> < database/schema.sql
Enter password:

Insert data into database for your guild and patterns

Software Dependencies

  • D++ v10.0.28 or later
  • sentry-native
  • libcrypto/libssl
  • libtesseract-dev
  • libleptonica-dev
  • ImageMagick Convert
  • libmysqlclient 8.x
  • g++ 11.4 or later
  • cmake
  • fmtlib
  • spdlog
  • CxxUrl
  • screen
  • Beholder NSFW Scanning container:
    • Docker
    • Docker Compose
    • node.js 20.x
    • Tensorflow
    • tfjs-node
    • express

Other Dependencies

To offer premium services, various paid subscription APIs are required. These are configured in the ir tag in config.json You should also subscribe to an anti-DDOS tunnel service, which can be bound to as an interface for making unsafe web requests to fetch image content. Without this, your server's IP is left exposed to the neer-do-wells of Discord. Configure this in tunnel_interface.

Starting the bot

cd beholder
screen -dmS beholder ./run.sh

beholder's People

Contributors

braindigitalis avatar jaskowicz1 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

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