diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 35b9342..b268630 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,8 @@ test: script: - apk add libxml2-dev libxslt-dev libxml2 gcc musl-dev linux-headers - pip3.6 install -r requirements.txt - - sed -i -e "s/https:\/\/discordapp.com\/api\/webhooks\/111111111111111111\/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/$DISCORD/g" settings.json.example + - sed -i -e "s/111111111111111111/$DISCORD1/g" settings.json.example + - sed -i -e "s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/$DISCORD2/g" settings.json.example - mv settings.json.example settings.json - python3.6 rcgcdw.py --test only: diff --git a/configloader.py b/configloader.py index abc0c25..8db4cba 100644 --- a/configloader.py +++ b/configloader.py @@ -6,7 +6,7 @@ try: # load settings if settings["limitrefetch"] < settings["limit"] and settings["limitrefetch"] != -1: settings["limitrefetch"] = settings["limit"] if "user-agent" in settings["header"]: - settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.7.2") # set the version in the useragent + settings["header"]["user-agent"] = settings["header"]["user-agent"].format(version="1.7.3") # set the version in the useragent except FileNotFoundError: logging.critical("No config file could be found. Please make sure settings.json is in the directory.") sys.exit(1) diff --git a/misc.py b/misc.py index ea30a4e..0578b1d 100644 --- a/misc.py +++ b/misc.py @@ -75,7 +75,7 @@ def weighted_average(value, weight, new_value): def link_formatter(link): """Formats a link to not embed it""" - return "<" + re.sub(r"([ \)])", "\\\\\\1", link) + ">" + return "<" + re.sub(r"([ )])", "\\\\\\1", link) + ">" class ContentParser(HTMLParser): @@ -98,7 +98,7 @@ class ContentParser(HTMLParser): self.added = True def handle_data(self, data): - data = re.sub(r"(`|_|\*|~|<|>|{|}|@|/|\|)", "\\\\\\1", data, 0) + data = re.sub(r"([`_*~<>{}@/|\\])", "\\\\\\1", data, 0) if self.current_tag == "ins" and self.ins_length <= 1000: self.ins_length += len("**" + data + '**') if self.ins_length <= 1000: diff --git a/rcgcdw.py b/rcgcdw.py index 36bb734..dfd3046 100644 --- a/rcgcdw.py +++ b/rcgcdw.py @@ -131,7 +131,7 @@ def pull_comment(comment_id): logger.debug("Got the following comment from the API: {}".format(comment)) except MWError: pass - except TypeError: + except (TypeError, AttributeError): logger.exception("Could not resolve the comment text.") except KeyError: logger.exception("CurseProfile extension API did not respond with a valid comment content.") diff --git a/settings.json.example b/settings.json.example index c1adc74..e5e7b03 100644 --- a/settings.json.example +++ b/settings.json.example @@ -149,6 +149,10 @@ "icon":"", "color":null }, + "rights/autopromote": { + "icon":"", + "color":null + }, "abusefilter/abusefilter":{ "icon":"https://i.imgur.com/Sn2NzRJ.png", "color":null