mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Fixes to 585cc36dfa
This commit is contained in:
parent
5774c0821e
commit
d21567e2fa
10
rcgcdw.py
10
rcgcdw.py
|
@ -123,20 +123,20 @@ def webhook_formatter(action, STATIC, **params):
|
||||||
return 0
|
return 0
|
||||||
content = list(article_content.values())[0]['revisions'][0]['*']
|
content = list(article_content.values())[0]['revisions'][0]['*']
|
||||||
try:
|
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:
|
if matches is not None:
|
||||||
license = matches.group("license")
|
license = matches.group("license")
|
||||||
else:
|
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!**")
|
license = _("**No license!**")
|
||||||
else:
|
else:
|
||||||
license = "?"
|
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:
|
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!")
|
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 = "?"
|
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"])}]
|
embed["fields"] = [{"name": _("Options"), "value": _("([preview]({link}))").format(link=embed["image"]["url"])}]
|
||||||
params["desc"] = _("{desc}\nLicense: {license}").format(desc=params["desc"], license=license)
|
params["desc"] = _("{desc}\nLicense: {license}").format(desc=params["desc"], license=license)
|
||||||
elif action == 6:
|
elif action == 6:
|
||||||
|
|
Loading…
Reference in a new issue