Skip to main content

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.sample.ini dankbot/dankbot.ini

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

(.venv35)➜  dankbot git:(master) ✗ cat dankbot/dankbot.sample.ini
[dankbot]
# Leave directory blank and dankbot will determine the best place to
# log to your platform
log_to_file: true
directory:
file_name: dankbot.log
backups: 5
max_bytes: 1000000

[slack]
# Follow instructions at https://my.slack.com/services/new/bot
token: <put here>
channel: #random

[reddit]
# r/dankmemes, r/funnygifs, etc
subreddits: dankmemes, funnygifs

[imgur]
# Register at https://api.imgur.com/oauth2/addclient
# Select Anonymous usage
client_id: <your client ID>
client_secret: <your client secret>

[misc]
include_nsfw: false
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 .

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

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.6.tar.gz (28.8 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.6-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dankbot-0.0.6.tar.gz
Algorithm Hash digest
SHA256 196f60bf54874f703b9299b49ef4094d80f64b6ec171fb18f26aed3821b963ad
MD5 224f724078dc7371cf8e949f528855b2
BLAKE2b-256 53290524ab17de6ae9f3e88674f65f5c3555035fb4cfdc202dda7c88821a65af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dankbot-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 9bc5c760cbefa60335d4d40a3048a48ce1228314cc43dd2efa2d855e855f4ec9
MD5 1ca58ba5486fe8b2670353ef7f087ca4
BLAKE2b-256 3b5ca45cb9a2fd9674b7bc9cbffadae120c905c3e4f5b224dd5d6dce00973af7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

Supported by

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