Compare commits

...

3 commits

3 changed files with 6 additions and 5 deletions

View file

@ -4,10 +4,11 @@ REDDIT_AUTH_TOKEN=""
REDDIT_REFRESH_TOKEN=""
REDDIT_CLIENT_ID=""
REDDIT_CLIENT_SECRET=""
REDDIT_SUBREDDIT="ich_iel"
MASTODON_URL=""
MASTODON_EMAIL=""
MASTODON_PASSWORD=""
MASTODON_EMAIL="mail@example.com"
MASTODON_PASSWORD="password"
MASTODON_USER_ID=""
MASTODON_APP_NAME=""
MASTODON_APP_NAME="Reddit Mastodon Crossposter"
MASTODON_USER_SECRET="usercred.secret"
MASTODON_CLIENT_SECRET="clientcred.secret"

View file

@ -13,7 +13,7 @@
3. Initialize Mastodon.py with e.g. `masto.py` (please refer to the [Mastodon.py docs](https://mastodonpy.readthedocs.io)).
4. Set all `.env` variables if there are any remaining.
4. Set all `.env` variables if there are any remaining. (The code does not check for missing environment variables and assumes that everything is set correctly.)
5. Create a script `post_toots.sh` and make it executable `chmod +x post_toots.sh`:

View file

@ -26,7 +26,7 @@ mastodon = Mastodon(
# get recent posts to check for duplicates
last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), limit=15)
for submission in reddit.subreddit("ich_iel").top(time_filter="day", limit=10):
for submission in reddit.subreddit(str(getenv("REDDIT_SUBREDDIT"))).top(time_filter="day", limit=10):
# skip post if it is a stickied post
if (submission.stickied):
continue