mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Added #70
This commit is contained in:
parent
e32ab0778c
commit
74ca419e35
|
@ -516,6 +516,7 @@ def embed_formatter(action, change, parsed_comment, categories):
|
|||
embed["title"] = _("Uploaded a new version of {name}").format(name=change["title"])
|
||||
else:
|
||||
embed["title"] = _("Uploaded {name}").format(name=change["title"])
|
||||
if settings["license_detection"]:
|
||||
article_content = safe_read(recent_changes.safe_request(
|
||||
"https://{wiki}.gamepedia.com/api.php?action=query&format=json&prop=revisions&titles={article}&rvprop=content".format(
|
||||
wiki=settings["wiki"], article=quote_plus(change["title"], safe=''))), "query", "pages")
|
||||
|
@ -541,11 +542,12 @@ def embed_formatter(action, change, parsed_comment, categories):
|
|||
logging.error(
|
||||
"Given regex for the license detection is incorrect. Please fix license_regex or license_regex_detect values in the config!")
|
||||
license = "?"
|
||||
if license is not None:
|
||||
parsed_comment += "\n{}".format(license)
|
||||
if additional_info_retrieved:
|
||||
embed["fields"] = [
|
||||
{"name": _("Options"), "value": _("([preview]({link}))").format(link=embed["image"]["url"])}]
|
||||
parsed_comment = _("{desc}\nLicense: {license}").format(desc=parsed_comment,
|
||||
license=license if license is not None else "?")
|
||||
|
||||
elif action == "delete/delete":
|
||||
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"],
|
||||
article=change["title"].replace(" ", "_"))
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"overview": false,
|
||||
"overview_time": "00:00",
|
||||
"send_empty_overview": false,
|
||||
"license_detection": true,
|
||||
"license_regex_detect": "\\{\\{(license|lizenz|licence|copyright)",
|
||||
"license_regex": "\\{\\{(license|lizenz|licence|copyright)(\\ |\\|)(?P<license>.*?)\\}\\}",
|
||||
"wiki_bot_login": "",
|
||||
|
|
Loading…
Reference in a new issue