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.
mkdir build
cd build
cmake ..
make -j
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
- 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
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
.
cd beholder
screen -dmS beholder ./run.sh