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

Metadata

Release files for dankbot 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dankbot 0.0.6
File Size Uploaded
dankbot-0.0.6.tar.gz 28.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dankbot 0.0.6
File Interpreter ABI Platform
dankbot-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 45.0 kB

Release files / dankbot-0.0.6.tar.gz

Download URL dankbot-0.0.6.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
196f60bf54874f703b9299b49ef4094d80f64b6ec171fb18f26aed3821b963ad
BLAKE2b-256 checksum
How to use checksums
53290524ab17de6ae9f3e88674f65f5c3555035fb4cfdc202dda7c88821a65af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / dankbot-0.0.6-py3-none-any.whl

Download URL dankbot-0.0.6-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9bc5c760cbefa60335d4d40a3048a48ce1228314cc43dd2efa2d855e855f4ec9
BLAKE2b-256 checksum
How to use checksums
3b5ca45cb9a2fd9674b7bc9cbffadae120c905c3e4f5b224dd5d6dce00973af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page