mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Added pulling comments function and required code. Updated pl translation for this feature
This commit is contained in:
parent
de20f63cf2
commit
08ed53a5a4
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
22
rcgcdw.py
22
rcgcdw.py
|
@ -113,6 +113,16 @@ def send_to_discord(data):
|
||||||
time.sleep(2.0)
|
time.sleep(2.0)
|
||||||
pass
|
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):
|
def compact_formatter(action, change, parsed_comment, categories):
|
||||||
if action != "suppressed":
|
if action != "suppressed":
|
||||||
author_url = link_formatter("https://{wiki}.gamepedia.com/User:{user}".format(wiki=settings["wiki"], user=change["user"]))
|
author_url = link_formatter("https://{wiki}.gamepedia.com/User:{user}".format(wiki=settings["wiki"], user=change["user"]))
|
||||||
|
@ -609,18 +619,30 @@ def embed_formatter(action, change, parsed_comment, categories):
|
||||||
user = change["title"].split(':')[1]
|
user = change["title"].split(':')[1]
|
||||||
embed["title"] = _("Unblocked {blocked_user}").format(blocked_user=user)
|
embed["title"] = _("Unblocked {blocked_user}").format(blocked_user=user)
|
||||||
elif action == "curseprofile/comment-created":
|
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:
|
||||||
|
embed["fields"] = [{"name": _("Comment content"), "value": comment_content["text"]}]
|
||||||
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
||||||
commentid=change["logparams"]["4:comment_id"])
|
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] != \
|
embed["title"] = _("Left a comment on {target}'s profile").format(target=change["title"].split(':')[1]) if change["title"].split(':')[1] != \
|
||||||
change["user"] else _(
|
change["user"] else _(
|
||||||
"Left a comment on their own profile")
|
"Left a comment on their own profile")
|
||||||
elif action == "curseprofile/comment-replied":
|
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:
|
||||||
|
embed["fields"] = [{"name": _("Comment content"), "value": comment_content["text"]}]
|
||||||
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
||||||
commentid=change["logparams"]["4:comment_id"])
|
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] != \
|
embed["title"] = _("Replied to a comment on {target}'s profile").format(target=change["title"].split(':')[1]) if change["title"].split(':')[1] != \
|
||||||
change["user"] else _(
|
change["user"] else _(
|
||||||
"Replied to a comment on their own profile")
|
"Replied to a comment on their own profile")
|
||||||
elif action == "curseprofile/comment-edited":
|
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:
|
||||||
|
embed["fields"] = [{"name": _("Comment content"), "value": comment_content["text"]}]
|
||||||
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"],
|
||||||
commentid=change["logparams"]["4:comment_id"])
|
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] != \
|
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