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: