Compare commits
3 commits
0c7af6afa6
...
4c3f56bf2b
Author | SHA1 | Date | |
---|---|---|---|
4c3f56bf2b | |||
8762852c8d | |||
d328fc0a7b |
3 changed files with 6 additions and 5 deletions
|
@ -4,10 +4,11 @@ REDDIT_AUTH_TOKEN=""
|
||||||
REDDIT_REFRESH_TOKEN=""
|
REDDIT_REFRESH_TOKEN=""
|
||||||
REDDIT_CLIENT_ID=""
|
REDDIT_CLIENT_ID=""
|
||||||
REDDIT_CLIENT_SECRET=""
|
REDDIT_CLIENT_SECRET=""
|
||||||
|
REDDIT_SUBREDDIT="ich_iel"
|
||||||
MASTODON_URL=""
|
MASTODON_URL=""
|
||||||
MASTODON_EMAIL=""
|
MASTODON_EMAIL="mail@example.com"
|
||||||
MASTODON_PASSWORD=""
|
MASTODON_PASSWORD="password"
|
||||||
MASTODON_USER_ID=""
|
MASTODON_USER_ID=""
|
||||||
MASTODON_APP_NAME=""
|
MASTODON_APP_NAME="Reddit Mastodon Crossposter"
|
||||||
MASTODON_USER_SECRET="usercred.secret"
|
MASTODON_USER_SECRET="usercred.secret"
|
||||||
MASTODON_CLIENT_SECRET="clientcred.secret"
|
MASTODON_CLIENT_SECRET="clientcred.secret"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
3. Initialize Mastodon.py with e.g. `masto.py` (please refer to the [Mastodon.py docs](https://mastodonpy.readthedocs.io)).
|
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`:
|
5. Create a script `post_toots.sh` and make it executable `chmod +x post_toots.sh`:
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ mastodon = Mastodon(
|
||||||
# get recent posts to check for duplicates
|
# get recent posts to check for duplicates
|
||||||
last_posts = mastodon.account_statuses(getenv("MASTODON_USER_ID"), limit=15)
|
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
|
# skip post if it is a stickied post
|
||||||
if (submission.stickied):
|
if (submission.stickied):
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in a new issue