mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-24 00:34:10 +00:00
Merge branch 'testing' into 'master'
1.8 See merge request piotrex43/RcGcDw!61
This commit is contained in:
commit
aae4570ac1
46
rcgcdw.py
46
rcgcdw.py
|
@ -65,7 +65,7 @@ if settings["limitrefetch"] != -1 and os.path.exists("lastchange.txt") is True:
|
||||||
# A few initial vars
|
# A few initial vars
|
||||||
|
|
||||||
logged_in = False
|
logged_in = False
|
||||||
supported_logs = ["protect/protect", "protect/modify", "protect/unprotect", "upload/overwrite", "upload/upload", "delete/delete", "delete/delete_redir", "delete/restore", "delete/revision", "delete/event", "import/upload", "import/interwiki", "merge/merge", "move/move", "move/move_redir", "protect/move_prot", "block/block", "block/unblock", "block/reblock", "rights/rights", "rights/autopromote", "abusefilter/modify", "abusefilter/create", "interwiki/iw_add", "interwiki/iw_edit", "interwiki/iw_delete", "curseprofile/comment-created", "curseprofile/comment-edited", "curseprofile/comment-deleted", "curseprofile/profile-edited", "curseprofile/comment-replied", "contentmodel/change", "sprite/sprite", "sprite/sheet", "sprite/slice", "managetags/create", "managetags/delete", "managetags/activate", "managetags/deactivate", "tag/update"]
|
supported_logs = ["protect/protect", "protect/modify", "protect/unprotect", "upload/overwrite", "upload/upload", "delete/delete", "delete/delete_redir", "delete/restore", "delete/revision", "delete/event", "import/upload", "import/interwiki", "merge/merge", "move/move", "move/move_redir", "protect/move_prot", "block/block", "block/unblock", "block/reblock", "rights/rights", "rights/autopromote", "abusefilter/modify", "abusefilter/create", "interwiki/iw_add", "interwiki/iw_edit", "interwiki/iw_delete", "curseprofile/comment-created", "curseprofile/comment-edited", "curseprofile/comment-deleted", "curseprofile/profile-edited", "curseprofile/comment-replied", "contentmodel/change", "sprite/sprite", "sprite/sheet", "sprite/slice", "managetags/create", "managetags/delete", "managetags/activate", "managetags/deactivate", "tag/update", "cargo/createtable", "cargo/deletetable", "cargo/recreatetable", "cargo/replacetable"]
|
||||||
profile_fields = {"profile-location": _("Location"), "profile-aboutme": _("About me"), "profile-link-google": _("Google link"), "profile-link-facebook":_("Facebook link"), "profile-link-twitter": _("Twitter link"), "profile-link-reddit": _("Reddit link"), "profile-link-twitch": _("Twitch link"), "profile-link-psn": _("PSN link"), "profile-link-vk": _("VK link"), "profile-link-xbl": _("XVL link"), "profile-link-steam": _("Steam link"), "profile-link-discord": _("Discord handle"), "profile-link-battlenet": _("Battle.net handle")}
|
profile_fields = {"profile-location": _("Location"), "profile-aboutme": _("About me"), "profile-link-google": _("Google link"), "profile-link-facebook":_("Facebook link"), "profile-link-twitter": _("Twitter link"), "profile-link-reddit": _("Reddit link"), "profile-link-twitch": _("Twitch link"), "profile-link-psn": _("PSN link"), "profile-link-vk": _("VK link"), "profile-link-xbl": _("XVL link"), "profile-link-steam": _("Steam link"), "profile-link-discord": _("Discord handle"), "profile-link-battlenet": _("Battle.net handle")}
|
||||||
|
|
||||||
LinkParser = LinkParser()
|
LinkParser = LinkParser()
|
||||||
|
@ -93,7 +93,7 @@ def profile_field_name(name, embed):
|
||||||
|
|
||||||
def send_to_discord_webhook(data):
|
def send_to_discord_webhook(data):
|
||||||
header = settings["header"]
|
header = settings["header"]
|
||||||
if "content" not in data:
|
if isinstance(data, str):
|
||||||
header['Content-Type'] = 'application/json'
|
header['Content-Type'] = 'application/json'
|
||||||
else:
|
else:
|
||||||
header['Content-Type'] = 'application/x-www-form-urlencoded'
|
header['Content-Type'] = 'application/x-www-form-urlencoded'
|
||||||
|
@ -379,6 +379,23 @@ def compact_formatter(action, change, parsed_comment, categories):
|
||||||
link = link_formatter("https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"],
|
link = link_formatter("https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"],
|
||||||
article=change["title"]))
|
article=change["title"]))
|
||||||
content = _("[{author}]({author_url}) edited the slice for [{article}]({article_url})").format(author=author, author_url=author_url, article=change["title"], article_url=link)
|
content = _("[{author}]({author_url}) edited the slice for [{article}]({article_url})").format(author=author, author_url=author_url, article=change["title"], article_url=link)
|
||||||
|
elif action == "cargo/createtable":
|
||||||
|
LinkParser.feed(change["logparams"]["0"])
|
||||||
|
table = LinkParser.new_string
|
||||||
|
LinkParser.new_string = ""
|
||||||
|
content = _("[{author}]({author_url}) created the Cargo table \"{table}\"").format(author=author, author_url=author_url, table=table)
|
||||||
|
elif action == "cargo/deletetable":
|
||||||
|
content = _("[{author}]({author_url}) deleted the Cargo table \"{table}\"").format(author=author, author_url=author_url, table=change["logparams"]["0"])
|
||||||
|
elif action == "cargo/recreatetable":
|
||||||
|
LinkParser.feed(change["logparams"]["0"])
|
||||||
|
table = LinkParser.new_string
|
||||||
|
LinkParser.new_string = ""
|
||||||
|
content = _("[{author}]({author_url}) recreated the Cargo table \"{table}\"").format(author=author, author_url=author_url, table=table)
|
||||||
|
elif action == "cargo/replacetable":
|
||||||
|
LinkParser.feed(change["logparams"]["0"])
|
||||||
|
table = LinkParser.new_string
|
||||||
|
LinkParser.new_string = ""
|
||||||
|
content = _("[{author}]({author_url}) replaced the Cargo table \"{table}\"").format(author=author, author_url=author_url, table=table)
|
||||||
elif action == "managetags/create":
|
elif action == "managetags/create":
|
||||||
link = "<https://{wiki}.gamepedia.com/Special:Tags>".format(wiki=settings["wiki"])
|
link = "<https://{wiki}.gamepedia.com/Special:Tags>".format(wiki=settings["wiki"])
|
||||||
content = _("[{author}]({author_url}) created a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link)
|
content = _("[{author}]({author_url}) created a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link)
|
||||||
|
@ -765,6 +782,27 @@ def embed_formatter(action, change, parsed_comment, categories):
|
||||||
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"],
|
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"],
|
||||||
article=change["title"].replace(" ", "_"))
|
article=change["title"].replace(" ", "_"))
|
||||||
embed["title"] = _("Edited the slice for {article}").format(article=change["title"])
|
embed["title"] = _("Edited the slice for {article}").format(article=change["title"])
|
||||||
|
elif action == "cargo/createtable":
|
||||||
|
LinkParser.feed(change["logparams"]["0"])
|
||||||
|
table = re.search(r"\[(.*?)\]\(<(.*?)>\)", LinkParser.new_string)
|
||||||
|
LinkParser.new_string = ""
|
||||||
|
link = table.group(2)
|
||||||
|
embed["title"] = _("Created the Cargo table \"{table}\"").format(table=table.group(1))
|
||||||
|
elif action == "cargo/deletetable":
|
||||||
|
link = "https://{wiki}.gamepedia.com/Special:CargoTables".format(wiki=settings["wiki"])
|
||||||
|
embed["title"] = _("Deleted the Cargo table \"{table}\"").format(table=change["logparams"]["0"])
|
||||||
|
elif action == "cargo/recreatetable":
|
||||||
|
LinkParser.feed(change["logparams"]["0"])
|
||||||
|
table = re.search(r"\[(.*?)\]\(<(.*?)>\)", LinkParser.new_string)
|
||||||
|
LinkParser.new_string = ""
|
||||||
|
link = table.group(2)
|
||||||
|
embed["title"] = _("Recreated the Cargo table \"{table}\"").format(table=table.group(1))
|
||||||
|
elif action == "cargo/replacetable":
|
||||||
|
LinkParser.feed(change["logparams"]["0"])
|
||||||
|
table = re.search(r"\[(.*?)\]\(<(.*?)>\)", LinkParser.new_string)
|
||||||
|
LinkParser.new_string = ""
|
||||||
|
link = table.group(2)
|
||||||
|
embed["title"] = _("Replaced the Cargo table \"{table}\"").format(table=table.group(1))
|
||||||
elif action == "managetags/create":
|
elif action == "managetags/create":
|
||||||
link = "https://{wiki}.gamepedia.com/Special:Tags".format(wiki=settings["wiki"])
|
link = "https://{wiki}.gamepedia.com/Special:Tags".format(wiki=settings["wiki"])
|
||||||
embed["title"] = _("Created a tag \"{tag}\"").format(tag=change["logparams"]["tag"])
|
embed["title"] = _("Created a tag \"{tag}\"").format(tag=change["logparams"]["tag"])
|
||||||
|
@ -1203,6 +1241,10 @@ class Recent_Changes_Class(object):
|
||||||
logger.warning("Reached connection error for request on link {url}".format(url=url))
|
logger.warning("Reached connection error for request on link {url}".format(url=url))
|
||||||
self.downtime_controller()
|
self.downtime_controller()
|
||||||
return None
|
return None
|
||||||
|
except requests.exceptions.ChunkedEncodingError:
|
||||||
|
logger.warning("Detected faulty response from the web server for request on link {url}".format(url=url))
|
||||||
|
self.downtime_controller()
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
if 499 < request.status_code < 600:
|
if 499 < request.status_code < 600:
|
||||||
self.downtime_controller()
|
self.downtime_controller()
|
||||||
|
|
|
@ -201,6 +201,22 @@
|
||||||
"icon":"",
|
"icon":"",
|
||||||
"color":null
|
"color":null
|
||||||
},
|
},
|
||||||
|
"cargo/deletetable": {
|
||||||
|
"icon": "",
|
||||||
|
"color": null
|
||||||
|
},
|
||||||
|
"cargo/createtable": {
|
||||||
|
"icon": "",
|
||||||
|
"color": null
|
||||||
|
},
|
||||||
|
"cargo/replacetable": {
|
||||||
|
"icon": "",
|
||||||
|
"color": null
|
||||||
|
},
|
||||||
|
"cargo/recreatetable": {
|
||||||
|
"icon": "",
|
||||||
|
"color": null
|
||||||
|
},
|
||||||
"sprite/sprite":{
|
"sprite/sprite":{
|
||||||
"icon":"",
|
"icon":"",
|
||||||
"color":null
|
"color":null
|
||||||
|
|
Loading…
Reference in a new issue