From 5daebc75f5d9eb09075d84108aca2a947f16715c Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 28 Sep 2019 14:17:26 +0200 Subject: [PATCH 1/5] Fixed an issue with formatting --- misc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: From baf38064361a7b4c1a065e04aa623e9df6697c54 Mon Sep 17 00:00:00 2001 From: Frisk Date: Mon, 30 Sep 2019 13:38:34 +0200 Subject: [PATCH 2/5] Attempt to fix broken pipeline testing --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: From 3fcb098c40fad6a634c0b81a8502968c27ebd1bc Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 5 Oct 2019 13:33:43 +0200 Subject: [PATCH 3/5] Added entry for FlaggedRevs log event so the bot does not crash when no entry present --- settings.json.example | 4 ++++ 1 file changed, 4 insertions(+) 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 From 5991f295be31a70b83e541a477b49897fb8aa834 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 26 Oct 2019 11:16:26 +0200 Subject: [PATCH 4/5] Fixed potential issue when the request for comment content errors out --- rcgcdw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.") From 818e2779d94dd0329db3db30b988b336db7fead1 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sat, 26 Oct 2019 11:26:54 +0200 Subject: [PATCH 5/5] Bump version --- configloader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)