From 34a19f431197bbdf0bb6fe627e7f903fbca13be1 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sun, 11 Nov 2018 19:48:57 +0100 Subject: [PATCH] Changed the way to recognize IP edits from regex to MediaWiki propriety --- rcgcdw.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rcgcdw.py b/rcgcdw.py index 7d700f3..439e96e 100644 --- a/rcgcdw.py +++ b/rcgcdw.py @@ -135,7 +135,7 @@ def webhook_formatter(action, STATIC, **params): article_encoded = params["title"].replace(" ", "_").replace(')', '\)') if STATIC["redirect"]: params["title"] = "⤷ " + params["title"] - if re.match(r"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b", params["user"]) is not None: + if STATIC["ipaction"]: author_url = "https://{wiki}.gamepedia.com/Special:Contributions/{user}".format(wiki=settings["wiki"], user=params["user"]) logging.debug("current user: {} with cache of IPs: {}".format(params["user"], recent_changes.map_ips.keys())) @@ -537,7 +537,7 @@ def first_pass( if change["type"] == "edit" and "edit" not in settings["ignored"]: logging.debug("List of categories in first_pass: {}".format(added_categories)) STATIC_VARS = {**STATIC_VARS, **{"color": settings["appearance"]["edit"]["color"], - "icon": settings["appearance"]["edit"]["icon"], "redirect": (True if "redirect" in change else False)}} + "icon": settings["appearance"]["edit"]["icon"], "redirect": (True if "redirect" in change else False), "ipaction": (True if "anon" in change else False)}} webhook_formatter("edit", STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"], size=change["newlen"] - change["oldlen"], minor=True if "minor" in change else False, new_categories=added_categories)