• Stars
    star
    449
  • Rank 97,328 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 11 years ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Headless chatbot that detects spam and posts links to it in chatrooms for quick deletion.

SmokeDetector

Build Status Circle CI Coverage Status Open issues Open PRs

Headless chatbot that detects spam and posts it to chatrooms. Uses ChatExchange, takes questions from the Stack Exchange realtime tab, and accesses answers via the Stack Exchange API.

Example chat post:

Example chat post

Documentation

User documentation is in the wiki.

Detailed documentation for setting up and running SmokeDetector is in the wiki.

Basic setup

To set up SmokeDetector, please use

git clone https://github.com/Charcoal-SE/SmokeDetector.git
cd SmokeDetector
git checkout deploy
sudo pip3 install -r requirements.txt --upgrade
pip3 install --user -r user_requirements.txt --upgrade

Next, copy config.sample to a new file called config, and edit the values required.

To run, use python3 nocrash.py (preferably in a daemon-able mode, like a screen session.) You can also use python3 ws.py, but then SmokeDetector will be shut down after 6 hours; when running from nocrash.py, it will be restarted. (This is to be sure that closed websockets, if any, are reopened.)

Virtual environment setup

Running in a virtual environment is a good way to isolate dependency packages from your local system. To set up SmokeDetector in a virtual environment, you can use

git clone https://github.com/Charcoal-SE/SmokeDetector.git
cd SmokeDetector
git config user.email "[email protected]"
git config user.name "SmokeDetector"
git checkout deploy

python3 -m venv env
env/bin/pip3 install -r requirements.txt --upgrade
env/bin/pip3 install --user -r user_requirements.txt --upgrade

Next, copy the config file and edit as said above. To run SmokeDetector in this virtual environment, use env/bin/python3 nocrash.py.

[Note: On some systems (e.g. Mac's and Linux), some circumstances may require the --user option be removed from the last pip3 command line in the above instructions. However, the --user option is known to be necessary in other circumstances. Further testing is necessary to resolve the discrepancy.]

Docker setup

Running in a Docker container is an even better way to isolate dependency packages from your local system. To set up SmokeDetector in a Docker container, follow the steps below.

  1. Grab the Dockerfile and build an image of SmokeDetector:

    DATE=$(date +%F)
    mkdir temp
    cd temp
    wget https://raw.githubusercontent.com/Charcoal-SE/SmokeDetector/master/Dockerfile
    docker build -t smokey:$DATE .
  2. Create a container from the image you just built

    docker create --name=mysmokedetector smokey:$DATE
  3. Start the container. Don't worry, SmokeDetector won't run until it's ready, so you have the chance to edit the configuration file before SmokeDetector runs.

    Copy config.sample to a new file named config and edit the values required, then copy the file into the container with this command:

    docker cp config mysmokedetector:/home/smokey/SmokeDetector/config
  4. If you would like to set up additional stuff (SSH, Git etc.), you can do so with a Bash shell in the container:

    docker exec -it mysmokedetector bash

    After you're ready, put a file named ready under /home/smokey:

    touch ~smokey/ready

Automate Docker deployment with Docker Compose

I'll assume you have the basic ideas of Docker and Docker Compose.

The first thing you need is a properly filled config file. You can start with the sample.

Create a directory (name it whatever you like), place the config file and docker-compose.yml file. Run docker-compose up -d and your SmokeDetector instance is up.

If you want additional control like memory and CPU constraint, you can edit docker-compose.yml and add the following keys to smokey. The example values are recommended values.

restart: always  # when your host reboots Smokey can autostart
mem_limit: 512M
cpus: 0.5  # Recommend 2.0 or more for spam waves

Requirements

SmokeDetector only supports Stack Exchange logins, and runs on Python 3.7 or higher, for now.

To allow committing blacklist and watchlist modifications back to GitHub, your system also needs Git 1.8 or higher, although we recommend Git 2.11+.

License

Licensed under either of

at your option.

Contribution Licensing

By submitting your contribution for inclusion in the work as defined in the Apache-2.0 license, you agree that it be dual licensed as above, without any additional terms or conditions.

More Repositories

1

metasmoke

Web dashboard for SmokeDetector.
Ruby
42
star
2

userscripts

Collection of userscripts that are used by/are useful to Charcoal.
JavaScript
26
star
3

blaze

Displays recent content on sites. Good for sites troubled by low-quality content.
JavaScript
9
star
4

charcoal-se.github.io

Website for Charcoal
SCSS
7
star
5

SmokeDetector-ng

SmokeDetector reboot project.
Python
6
star
6

halflife

Metasmoke back-end analysis client
Python
6
star
7

coal

Access Charcoal HQ from a desktop app
JavaScript
4
star
8

PulseMonitor

PulseMonitor is the chat interface to Halflife.
Python
4
star
9

helios

SmokeDetector Central Server
Python
4
star
10

sdml

Smokey feedback-based realtime machine learning thing.
Python
4
star
11

inferno

Ruby
3
star
12

tools

A collection of tools that may or may not be useful or related to what Charcoal does.
AppleScript
3
star
13

Cinder

For more efficient flagging of SE spam
PHP
3
star
14

elections

Shows you information about currently running elections on Stack Exchange sites.
JavaScript
3
star
15

Firestorm

Tool to add more information to flags than fits in 500 characters.
Ruby
2
star
16

Ash

Database of spammy websites and the hosts to contact to remove them.
Ruby
2
star
17

blacklist-audits

Checks the SmokeDetector blacklists for useless/counterproductive items
Python
2
star
18

Charcoal

Comment flagging webapp.
PHP
2
star
19

pingbot

see diazona/pingbot
Python
2
star
20

Flare

An experiment in running new Stack Exchange questions through NLTK, looking for patterns.
Python
2
star
21

charcoal-jekyll-theme

The theme used on the Charcoal-SE website
HTML
1
star
22

flovis-collector

Data collection server for Flovis
Ruby
1
star
23

Voter-Gizmo

A PHP thing that presents posts you haven't voted on, encouraging you to vote on them.
PHP
1
star
24

flovis-farmhouse

Visualiser for data collected by Flovis (see flovis-collector)
TSQL
1
star
25

Wildfire

For queuing up flags, so as not to make moderators angry.
Ruby
1
star
26

msml

Ruby
1
star
27

StatEngine

For collection of SE site stats over time.
PHP
1
star
28

redis-zhregex

C
1
star
29

Utilities

A random collection of utilities.
PHP
1
star
30

ms-autoflagger

AWS Lambda application to hold tokens and cast flags on behalf of metasmoke
Python
1
star
31

Thermite

Charcoal reboot. If I get time.
Ruby
1
star