从reddit发布潮湿memes的slack bot

dankbot的Python项目详细描述


丹克伯特

PyPIVersionCircleCICoverageStatusCode HealthStoriesInReady

一个松弛的机器人,它从subreddits中删除meme并将其发布到slack

运行步骤

克隆到目录

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

设置ini文件

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

编辑ini文件以填写缺少的令牌、用户名和密码字段:

(.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

创建并激活虚拟环境

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

安装python包

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

在crontab中添加一个条目

使用您喜爱的编辑器编辑crontab

sudo vi /etc/crontab

并添加如下条目:

# /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 .

从星期一到星期五,上午9点到 下午5点cst

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
c#Java Tcp服务器和。Net Tcp客户端的发送和接收问题   安卓应用程序上的java标记地理位置,其位置位于我周围5Km半径范围内。   向java添加对话框并检索html文件   当eclipse甚至无法打开时,java会在eclipse中更改不兼容的JVM   java中同一jframe中的jlabel和paintComponent   基于另一数组排序的java排序   java AADSTS7000012:该补助金是为另一个租户获得的   java在JSF中使用foreach循环   java如何通过maven为运行junit测试创建运行配置?   java Selenium webDriver不稳定错误堆栈跟踪   java有没有办法创建以键为大写的JSON对象?