Skip to main content

Slack bot for posting dank memes from Reddit

Project description

Dankbot

PyPIVersion CircleCI CoverageStatus Code Health StoriesInReady

A Slack Bot that scrapes memes from subreddits and posts them to slack

Steps to run

Clone into directory

cd /opt
sudo mkdir dankbot && sudo chown <user>:<user> dankbot
git clone git@github.com:DankCity/dankbot.git

Setup INI file

cd /opt/dankbot
cp dankbot/dankbot.ini.sample dankbot/dankbot.ini

Edit the INI file to fill in the missing token, username, and password fields:

(.venv35)➜  dankbot git:(master) ✗ cat dankbot/dankbot.ini.sample
[slack]
token: <put here>
channel: #random

[reddit]
subreddits: dankmemes, fishpost, me_irl, 4chan

[imgur]
client_id: <client_id>
client_secret: <client Secret>

[mysql]
database: <db>
username: <username>
password: <password>

[misc]
include_nsfw: <boolean>
max_memes: 3

Create and activate a virtual environment

cd /opt/dankbot
virtualenv --python=`which python3` env
source env/bin/activate

Install the python package

cd /opt/dankbot
source env/bin/activate
pip install -e .

Create logging folder

sudo mkdir /var/log/dankbot
sudo chown <user> /var/log/dankbot

Add an entry to your crontab

Edit the crontab with your favorite editor

sudo vi /etc/crontab

And add an entry like so:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the 'crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow usernamecommand
*/5 09-17 * * 1-5 root cd /opt/dankbot && source env/bin/activate && dankbot .

This will run dankbot once every 5 minutes, Monday to Friday, between 9 AM and 5 PM CST

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dankbot-0.0.5.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dankbot-0.0.5-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file dankbot-0.0.5.tar.gz.

File metadata

  • Download URL: dankbot-0.0.5.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dankbot-0.0.5.tar.gz
Algorithm Hash digest
SHA256 93f63f71aa9c3af737a7023302402c9455b87498876fade95a791af0a56819dd
MD5 48dc16a0f147b8b66df01ba1c8e8662b
BLAKE2b-256 0d8b382f7e73009fc5519dd1519635c737d2a70171aaba8bdd32784339819daa

See more details on using hashes here.

File details

Details for the file dankbot-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for dankbot-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a7b2ff0d089d3750c12b087c9771cd079c41e3502373c3c9789b4b8de4a847d6
MD5 471ee5fa5d54d92d051919c039897851
BLAKE2b-256 af3598b3c372b17e6ec3603cabaf068820b4b24364dcfb610a8d2a5d3b2f9b92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page