Skip to content

A discord bot capable of detecting toxic messages sent to a server, delete them and warn the author.

License

Notifications You must be signed in to change notification settings

ToxicBot-Discord/ToxicBot

Repository files navigation

ToxicBot

Platform Code Style

Discord bot for detecting and deleting toxic messages

Toxic Bot

Introduction

Discussing things you care about can be difficult: the threat of abuse and harassment online means that many people stop expressing themselves and give up on seeking different opinions.

Platforms struggle to effectively facilitate conversations, leading many communities to limit or completely shut down user comments. Toxic or insulting comments are nowhere more evident than the popular platform Discord since it is possible to remain anonymous on Discord.

We try to develop a discord bot that can remove toxic comments and warn users. It can also provide reports to the guild or server owner about all the members whoose comments have been deleted ( not implemented ).

Disclaimer

The dataset used for training this bot contains text that may be considered profane, vulgar, or offensive.

Demo

View a demo of ToxicBot in action on YouTube (click image below):

ToxicBot : A light-weight Discord Bot

Installation

Prerequisites ---------

  • Python 3.6+
  • pip
  • Discord Developer Account

Docker

$ sh secret_create.sh
$ docker-compose build
$ docker-compose up -d

macOS/Linux ---------

For installing on macOS or Linux, first clone the repository:

$ git clone https://github.com/ToxicBot-Discord/ToxicBot.git

Then run setup-unix.sh in your local ToxicBot repository:

$ cd ToxicBot
$ sh setup-unix.sh

You could also use the make command instead of running the script manually

Source the activate file and launch the app.py Python script:

$ source env/bin/activate
$ python app.py

Windows

For installing on Windows, download and install:

Open the "git bash" app

Note: you can right-click on the desktop and choose "git bash here" from the contextual menu

Clone the repository:

$ git clone https://github.com/ToxicBot-Discord/ToxicBot.git

Execute these commands in git bash:

$ cd ToxicBot
$ sh setup-win.sh

Paste your Discord token when prompted by the setup-win.sh script.

When the installation is done, start the app by executing these commands in git bash:

$ cd ToxicBot
$ . env/Scripts/activate
$ python app.py

Commands

Below are the commands that can be used with ToxicBot. Just type the command in the channel's textbox:

Command Accessible By Description
/report All users Displays the link to the ToxicBot GitHub project page to report bugs and issues
/info All users Displays information about the current running bot
/help All users Displays the list of available commands
/config Server owners Displays ToxicBot's current configuration settings
/setcount N Server owners Sets the number of toxic comments before suspending user ( ex: /setcount 10)
/setdays N Server owners Sets the number of days before toxic comments count for a user is reset ( ex: /setdays 15)
/toptoxic N Server owners Returns the top N toxic comments by user for a server ( ex: /toptoxic 5)

Toxic Comment Classification

Model 1

Model 2

This is model used in ToxicBot.