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.4.tar.gz (27.5 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.4-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dankbot-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7ab5b19b7c45ee01e943599cf28f33ad205f97f688839a928ae1a761eb09dafa
MD5 6fd0160cc60bd0bfc5f50d3139b6ec8c
BLAKE2b-256 ded0604670237993df91ab68845f7bfbd8d7d889e9faa3fac2219188797684d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dankbot-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cdc29cd2608e4ac7aa676c68c7c27c9cd3a350b1517d068f956d0d0ae95f503d
MD5 3d4a70e2f88ac288ef0726628ab67999
BLAKE2b-256 37d7e8c3241987c68596d1512ca2a75850d71a25d3d786f7056e83df31fd9108

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