mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Merge remote-tracking branch 'origin/testing' into testing
This commit is contained in:
commit
0b5df0177e
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
364
rcgcdw.pot
364
rcgcdw.pot
File diff suppressed because it is too large
Load diff
26
rcgcdw.py
26
rcgcdw.py
|
@ -113,6 +113,16 @@ def send_to_discord(data):
|
|||
time.sleep(2.0)
|
||||
pass
|
||||
|
||||
|
||||
def pull_comment(comment_id):
|
||||
comment = None
|
||||
try:
|
||||
comment = recent_changes.handle_mw_errors(recent_changes.safe_request("https://{}.gamepedia.com/api.php?action=comment&do=getRaw&comment_id={}&format=json".format(settings["wiki"], comment_id)).json())
|
||||
except MWError:
|
||||
pass
|
||||
return comment
|
||||
|
||||
|
||||
def compact_formatter(action, change, parsed_comment, categories):
|
||||
if action != "suppressed":
|
||||
author_url = link_formatter("https://{wiki}.gamepedia.com/User:{user}".format(wiki=settings["wiki"], user=change["user"]))
|
||||
|
@ -508,7 +518,11 @@ def embed_formatter(action, change, parsed_comment, categories):
|
|||
if action == "upload/overwrite":
|
||||
if additional_info_retrieved:
|
||||
article_encoded = change["title"].replace(" ", "_").replace(')', '\)')
|
||||
try:
|
||||
img_timestamp = [x for x in img_info[1]["timestamp"] if x.isdigit()]
|
||||
except IndexError:
|
||||
logger.exception("Could not analize the information about the image (does it have only one version when expected more in overwrite?) which resulted in no Options field: {}".format(img_info))
|
||||
else:
|
||||
undolink = "https://{wiki}.gamepedia.com/index.php?title={filename}&action=revert&oldimage={timestamp}%21{filenamewon}".format(
|
||||
wiki=settings["wiki"], filename=article_encoded, timestamp="".join(img_timestamp),
|
||||
filenamewon=article_encoded.split(":", 1)[1])
|
||||
|
@ -609,18 +623,30 @@ def embed_formatter(action, change, parsed_comment, categories):
|
|||
user = change["title"].split(':')[1]
|
||||
embed["title"] = _("Unblocked {blocked_user}").format(blocked_user=user)
|
||||
elif action == "curseprofile/comment-created":
|
||||
if settings["appearance"]["embed"]["show_edit_changes"]:
|
||||
comment_content = pull_comment(change["logparams"]["4:comment_id"])
|
||||
if comment_content is not None and comment_content["text"]:
|
||||
embed["fields"] = [{"name": _("Comment content"), "value": comment_content["text"]}]
|
||||
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
||||
commentid=change["logparams"]["4:comment_id"])
|
||||
embed["title"] = _("Left a comment on {target}'s profile").format(target=change["title"].split(':')[1]) if change["title"].split(':')[1] != \
|
||||
change["user"] else _(
|
||||
"Left a comment on their own profile")
|
||||
elif action == "curseprofile/comment-replied":
|
||||
if settings["appearance"]["embed"]["show_edit_changes"]:
|
||||
comment_content = pull_comment(change["logparams"]["4:comment_id"])
|
||||
if comment_content is not None and comment_content["text"]:
|
||||
embed["fields"] = [{"name": _("Comment content"), "value": comment_content["text"]}]
|
||||
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
||||
commentid=change["logparams"]["4:comment_id"])
|
||||
embed["title"] = _("Replied to a comment on {target}'s profile").format(target=change["title"].split(':')[1]) if change["title"].split(':')[1] != \
|
||||
change["user"] else _(
|
||||
"Replied to a comment on their own profile")
|
||||
elif action == "curseprofile/comment-edited":
|
||||
if settings["appearance"]["embed"]["show_edit_changes"]:
|
||||
comment_content = pull_comment(change["logparams"]["4:comment_id"])
|
||||
if comment_content is not None and comment_content["text"]:
|
||||
embed["fields"] = [{"name": _("Comment content"), "value": comment_content["text"]}]
|
||||
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
||||
commentid=change["logparams"]["4:comment_id"])
|
||||
embed["title"] = _("Edited a comment on {target}'s profile").format(target=change["title"].split(':')[1]) if change["title"].split(':')[1] != \
|
||||
|
|
Loading…
Reference in a new issue