Fixed link text bug

This commit is contained in:
Anon 2022-10-13 14:56:40 -07:00
parent f26853cdb5
commit 2bcce1b13c

View File

@ -50,15 +50,16 @@ class YandereBot:
consecutive_failed_uploads = 0 consecutive_failed_uploads = 0
currentSessionCount = 0 currentSessionCount = 0
currentIndexCount = 0 currentIndexCount = 0
currentProfileIndex = tuple() currentProfileIndex = []
debug_mode = False debug_mode = False
primed = False primed = False
decrypted = False decrypted = False
# YandereBot.__init__() # YandereBot.__init__()
# @param cfg A dynamically loaded python module. See yanlib.module_load() for an example # @param cfg A dynamically loaded python module. See yanlib.module_load() for an example
# @param keyfile Keyfile to decrypt settings_post
# @param debug_mode Should the bot run in debug mode (do not sign in or post to Pleroma) # @param debug_mode Should the bot run in debug mode (do not sign in or post to Pleroma)
# prime_bot Should the bot immediately prime itself (configure picture list and login, but don't post) # @prime_bot Should the bot immediately prime itself (configure picture list and login, but don't post)
def __init__(self, cfg, keyfile=None, debug_mode=False, prime_bot=True): def __init__(self, cfg, keyfile=None, debug_mode=False, prime_bot=True):
self.cfg = cfg self.cfg = cfg
self.load_settings(self.cfg) self.load_settings(self.cfg)
@ -193,8 +194,10 @@ class YandereBot:
string_imglinks = [] string_imglinks = []
if media_list and self.settings_behavior["post_image_link"]: if media_list and self.settings_behavior["post_image_link"]:
for ele in media_list: for media_dict in media_list:
path, media = ele path = media_dict["path"]
media = media_dict["media"]
if path is None or media is None: if path is None or media is None:
continue continue
elif content_type == "text/markdown" and not self.debug_mode: elif content_type == "text/markdown" and not self.debug_mode:
@ -264,11 +267,7 @@ class YandereBot:
# The main post function # The main post function
# This function is responsible for incrementing self.currentSessionCount, as well as posting and blacklisting the # This funciton is responsible for picking a profile, generate a screenshot, and posting it.
# picked item.
#
# It is also responsible for removing the picked item from self.listPictures, which can be accomplished by simply
# popping it at index 0. This should handle any error that might occur while posting.
# #
# This function should return 'None' if a post failed, and the picked item from self.listPictures if it succeeded. # This function should return 'None' if a post failed, and the picked item from self.listPictures if it succeeded.
def post(self): def post(self):
@ -312,7 +311,7 @@ class YandereBot:
# a. FIX: Reduce settings_behavior["max_size"] # a. FIX: Reduce settings_behavior["max_size"]
# 2. The server is down. Check to verify in a web browser (this is the default assumption since the # 2. The server is down. Check to verify in a web browser (this is the default assumption since the
# mastodon.py API will not specify why the connection timed out). # mastodon.py API will not specify why the connection timed out).
# The default assumption is #2 # 3. Other general exceptions
except (FileNotFoundError, MastodonAPIError, Exception) as e: except (FileNotFoundError, MastodonAPIError, Exception) as e:
print("Exception:", e) print("Exception:", e)
@ -343,7 +342,8 @@ class YandereBot:
# End Conditions: # End Conditions:
# 1. User presses Ctrl+C # 1. User presses Ctrl+C
# 2. settings_behavior["uploads_per_post"] is less than one for some reason # 2. settings_behavior["uploads_per_post"] is less than uploads_per_post
# 3. Consecutive failed uploads is less than max_errors
def can_post(self): def can_post(self):
return ( return (
not self.eventSleep.is_set() and not self.eventSleep.is_set() and