From d21567e2fa6deb469d8acb9d558752968b023761 Mon Sep 17 00:00:00 2001 From: Frisk Date: Sun, 24 Jun 2018 20:28:42 +0200 Subject: [PATCH] Fixes to 585cc36dfa28dc354034b74477f7167536e88eae --- rcgcdw.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rcgcdw.py b/rcgcdw.py index f67617b..a59cae9 100644 --- a/rcgcdw.py +++ b/rcgcdw.py @@ -123,20 +123,20 @@ def webhook_formatter(action, STATIC, **params): return 0 content = list(article_content.values())[0]['revisions'][0]['*'] try: - matches = re.search(re.compile(settings["license_regex"]), content, re.IGNORECASE) + matches = re.search(re.compile(settings["license_regex"], re.IGNORECASE), content) if matches is not None: license = matches.group("license") else: - if re.search(re.compile(settings["license_regex_detect"]), content, re.IGNORECASE) is None: + if re.search(re.compile(settings["license_regex_detect"], re.IGNORECASE), content) is None: license = _("**No license!**") else: license = "?" - except sre_constants.error: - logging.error("Given regex for the license detection is incorrect. Please fix license_regex or license_regex_detect values in the config!") - license = "?" except IndexError: logging.error("Given regex for the license detection is incorrect. It does not have a capturing group called \"license\" specified. Please fix license_regex value in the config!") license = "?" + except re.error: + logging.error("Given regex for the license detection is incorrect. Please fix license_regex or license_regex_detect values in the config!") + license = "?" embed["fields"] = [{"name": _("Options"), "value": _("([preview]({link}))").format(link=embed["image"]["url"])}] params["desc"] = _("{desc}\nLicense: {license}").format(desc=params["desc"], license=license) elif action == 6: