Skip to content
This repository has been archived by the owner on Oct 22, 2020. It is now read-only.

Updated to allow use with Python 3.8.5 #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# Tootbot

**I am no longer actively developing Tootbot, and no bug fixes or new features will be implemented. There is one fork developed by Mark Burgunder [here](https://gitlab.com/marvin8/tootbot), with fixes to Gfycat integration and a few other changes.**

**If you want to take over this project, [send me an email](https://corbin.io/contact.html).**

This is a Python bot that looks up posts from specified subreddits and automatically posts them on Twitter and/or [Mastodon](https://joinmastodon.org/). It is based on [reddit-twitter-bot](/~https://github.com/rhiever/reddit-twitter-bot). Tootbot is now used by [a wide variety of social media accounts](/~https://github.com/corbindavenport/tootbot/wiki/Accounts-using-Tootbot).

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

**NEW:** Subscribe to the Tootbot updates feed [via email](https://feedburner.google.com/fb/a/mailverify?uri=tootbot) or [with an RSS reader](http://feeds.feedburner.com/tootbot) to be notified when a new version is available.

**Features:**

* Can post to both Twitter and [Mastodon](https://joinmastodon.org/)
* Runs in the cloud with a free Heroku account, or locally on any PC with Python
* Tootbot can post to both Twitter and [Mastodon](https://joinmastodon.org/)
* Tootbot can either run locally, or in the cloud with a free Heroku account
* Media from direct links, Gfycat, Imgur, Reddit, and Giphy is automatically attached in the social media post
* Links that do not contain media can be skipped, ideal for meme accounts
* Links that do not contain media can be skipped, ideal for meme accounts like [@badreactiongifs](https://twitter.com/badreactiongifs)
* NSFW content, spoilers, and self-posts can be filtered
* Multiple subreddits can be monitored at once
* Tootbot can monitor multiple subreddits at once
* Tootbot is fully open-source, so you don't have to give an external service full access to your social media accounts

Tootbot uses the [tweepy](/~https://github.com/tweepy/tweepy), [PRAW](https://praw.readthedocs.io/en/latest/), [py-gfycat](/~https://github.com/ankeshanand/py-gfycat), [imgurpython](/~https://github.com/Imgur/imgurpython), [Pillow](/~https://github.com/python-pillow/Pillow), and [Mastodon.py](/~https://github.com/halcy/Mastodon.py) libraries. The Heroku version also uses the [redis-py](/~https://github.com/andymccurdy/redis-py) library.

Expand All @@ -25,4 +24,4 @@ The developers of Tootbot hold no liability for what you do with this script or

## Setup and usage

For instructions on setting up and using Tootbot, please visit [the wiki](/~https://github.com/corbindavenport/tootbot/wiki).
For instructions on setting up and using Tootbot, please visit [the wiki](/~https://github.com/corbindavenport/tootbot/wiki).
10 changes: 5 additions & 5 deletions config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
# File name for the cache spreadsheet (default is 'cache.csv')
CacheFile: cache.csv
# Minimum delay between social media posts, in seconds (default is '600')
DelayBetweenPosts: 600
DelayBetweenPosts: 2500
# Minimum position of post on subreddit front page that the bot will look at (default is '10')
PostLimit: 10
PostLimit: 20
# Name of subreddit to take posts from (example: 'gaming')
# Multiple subreddits can be used like this: 'gaming+funny+news'
SubredditToMonitor:
SubredditToMonitor: # Name of Subreddits here Seperate by comma
# Allow NSFW Reddit posts to be posted by the bot
# NSFW media will be marked as sensitive, regardless of this setting
NSFWPostsAllowed: false
NSFWPostsAllowed: true
# Allow Reddit posts marked as spoilers to be posted by the bot
SpoilersAllowed: true
# Allow Reddit self-posts to be posted by the bot
SelfPostsAllowed: true
# List of hashtags to be used on every post, separated by commas without # symbols (example: hashtag1, hashtag2)
# Leaving this blank will disable hashtags
Hashtags:
Hashtags: # Hashtags here. Seperate by comma

# Settings related to media attachments
[MediaSettings]
Expand Down
2 changes: 2 additions & 0 deletions getmedia.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import sys
import configparser
import PIL
from gfycat.client import GfycatClient
from imgurpython import ImgurClient
from PIL import Image
Expand Down Expand Up @@ -189,6 +190,7 @@ def get_media(img_url, IMGUR_CLIENT, IMGUR_CLIENT_SECRET):

def get_hd_media(submission, IMGUR_CLIENT, IMGUR_CLIENT_SECRET):
media_url = submission.url
media_url = "https://gfycat.com/ElectricAdolescentDove"
# Make sure config file exists
try:
config = configparser.ConfigParser()
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
tweepy==3.7.0
praw==6.0.0
praw==7.1.1
gfycat==0.1.4
imgurpython==1.1.7
Pillow==5.3.0
Pillow==8.0.0
Mastodon.py==1.3.1
redis==3.0.1
redis==3.5.0
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.6.6
python-3.8.5
1 change: 1 addition & 0 deletions tootbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import configparser
import urllib.parse
import sys
import PIL
from imgurpython import ImgurClient
from glob import glob
import distutils.core
Expand Down