Merge pull request #21 from Linus2punkt0/Add-setting-for-max-timelimit

Added setting for max timelimit
This commit is contained in:
Linus Svensson
2023-09-12 18:41:18 +02:00
committed by GitHub
3 changed files with 9 additions and 4 deletions

View File

@@ -4,8 +4,10 @@ The Bluesky Crossposter is a python script that when running will automatically
To get started, get the necessary keys and passwords and enter them in auth.py. Then fill in your paths in path.py. Finally set up a way for the code to be run periodically, for example a cronjob running every five or ten minutes.
In the file toggle.py you can disable posting to twitter or mastodon if you only want to post to one of them. Just change "True" to "False" for the service you want to disable. You can also disable logging if you have limited space where the program will run.
When first run, or run without a database file, all posts within the timelimit set by postTimeLimit in settings.py will be posted.
The file toggle.py now also allows (mis)using blueskys language function by designating a language that when set can be used to decide if a specific post should or should not be crossposted. More info can be found in the file.
In the settings.py you can also disable posting to twitter or mastodon if you only want to post to one of them. Just change "True" to "False" for the service you want to disable. You can also disable logging if you have limited space where the program will run.
The file settings.py now also allows (mis)using blueskys language function by designating a language that when set can be used to decide if a specific post should or should not be crossposted. More info can be found in the file.
Bluesky Crossposter™©® developed by denvitadrogen

View File

@@ -80,8 +80,8 @@ def getPosts():
if not replyToUser:
writeLog("Unable to find the user that this post replies to or quotes")
continue
# Checking if post is by user (i.e. not a repost), withing the last 12 hours and either not a reply or a reply in a thread.
if feed_view.post.author.handle == bsky_handle and timestamp > datetime.now() - timedelta(hours = 12) and replyToUser == bsky_handle:
# Checking if post is by user (i.e. not a repost), withing timelimit and either not a reply or a reply in a thread.
if feed_view.post.author.handle == bsky_handle and timestamp > datetime.now() - timedelta(hours = settings.postTimeLimit) and replyToUser == bsky_handle:
# Fetching images if there are any in the post
imageData = ""
images = []

View File

@@ -23,3 +23,6 @@ mastodonLang = ""
twitterLang = ""
# Sets maximum amount of times poster will retry a failed crosspost.
maxRetries = 5
# Sets max time limit (in hours) for fetching posts. If no database exists, all posts within this time
# period will be posted.
postTimeLimit = 12