diff --git a/.env.example b/.env.example index 5dbf49c..e93598f 100644 --- a/.env.example +++ b/.env.example @@ -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" diff --git a/README.md b/README.md index 04a3ad4..5253b50 100644 --- a/README.md +++ b/README.md @@ -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`: diff --git a/script.py b/script.py index ba7d157..450b6a2 100644 --- a/script.py +++ b/script.py @@ -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