This commit is contained in:
Frisk 2018-07-12 11:00:30 +02:00
parent 3a6f6b4518
commit 5bbbbe90e8
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C
2 changed files with 229 additions and 216 deletions

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2018-07-08 18:43+0200\n" "POT-Creation-Date: 2018-07-12 10:57+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -15,385 +15,393 @@ msgstr ""
"Generated-By: pygettext.py 1.5\n" "Generated-By: pygettext.py 1.5\n"
#: rcgcdw.py:126 #: rcgcdw.py:123
msgid "(N!) " msgid "(N!) "
msgstr "" msgstr ""
#: rcgcdw.py:126 #: rcgcdw.py:123
msgid "m " msgid "m "
msgstr "" msgstr ""
#: rcgcdw.py:144 #: rcgcdw.py:141
msgid "([preview]({link}) | [undo]({undolink}))" msgid "([preview]({link}) | [undo]({undolink}))"
msgstr "" msgstr ""
#: rcgcdw.py:144 rcgcdw.py:170 #: rcgcdw.py:141 rcgcdw.py:167
msgid "Options" msgid "Options"
msgstr "" msgstr ""
#: rcgcdw.py:145 #: rcgcdw.py:142
msgid "Uploaded a new version of {name}" msgid "Uploaded a new version of {name}"
msgstr "" msgstr ""
#: rcgcdw.py:147 #: rcgcdw.py:144
msgid "Uploaded {name}" msgid "Uploaded {name}"
msgstr "" msgstr ""
#: rcgcdw.py:160 #: rcgcdw.py:157
msgid "**No license!**" msgid "**No license!**"
msgstr "" msgstr ""
#: rcgcdw.py:170 #: rcgcdw.py:167
msgid "([preview]({link}))" msgid "([preview]({link}))"
msgstr "" msgstr ""
#: rcgcdw.py:171 #: rcgcdw.py:168
msgid "" msgid ""
"{desc}\n" "{desc}\n"
"License: {license}" "License: {license}"
msgstr "" msgstr ""
#: rcgcdw.py:174 #: rcgcdw.py:171
msgid "Deleted page {article}" msgid "Deleted page {article}"
msgstr "" msgstr ""
#: rcgcdw.py:177 #: rcgcdw.py:174
msgid "Deleted redirect {article} by overwriting" msgid "Deleted redirect {article} by overwriting"
msgstr "" msgstr ""
#: rcgcdw.py:180 #: rcgcdw.py:177
msgid "A redirect has been made" msgid "A redirect has been made"
msgstr "" msgstr ""
#: rcgcdw.py:180 #: rcgcdw.py:177
msgid "No redirect has been made" msgid "No redirect has been made"
msgstr "" msgstr ""
#: rcgcdw.py:181 #: rcgcdw.py:178
msgid "Moved {article} to {target}" msgid "Moved {article} to {target}"
msgstr "" msgstr ""
#: rcgcdw.py:184 #: rcgcdw.py:181
msgid "Moved {article} to {title} over redirect" msgid "Moved {article} to {title} over redirect"
msgstr "" msgstr ""
#: rcgcdw.py:187 #: rcgcdw.py:184
msgid "Moved protection settings from {article} to {title}" msgid "Moved protection settings from {article} to {title}"
msgstr "" msgstr ""
#: rcgcdw.py:191 #: rcgcdw.py:188
msgid "infinity and beyond" msgid "infinity and beyond"
msgstr "" msgstr ""
#: rcgcdw.py:192 #: rcgcdw.py:189
msgid "Blocked {blocked_user} for {time}" msgid "Blocked {blocked_user} for {time}"
msgstr "" msgstr ""
#: rcgcdw.py:196 #: rcgcdw.py:193
msgid "Changed block settings for {blocked_user}" msgid "Changed block settings for {blocked_user}"
msgstr "" msgstr ""
#: rcgcdw.py:200 #: rcgcdw.py:197
msgid "Unblocked {blocked_user}" msgid "Unblocked {blocked_user}"
msgstr "" msgstr ""
#: rcgcdw.py:204 #: rcgcdw.py:201
msgid "Left a comment on {target}'s profile" msgid "Left a comment on {target}'s profile"
msgstr "" msgstr ""
#: rcgcdw.py:208 #: rcgcdw.py:205
msgid "Replied to a comment on {target}'s profile" msgid "Replied to a comment on {target}'s profile"
msgstr "" msgstr ""
#: rcgcdw.py:212 #: rcgcdw.py:209
msgid "Edited a comment on {target}'s profile" msgid "Edited a comment on {target}'s profile"
msgstr "" msgstr ""
#: rcgcdw.py:216 #: rcgcdw.py:213
msgid "Location" msgid "Location"
msgstr "" msgstr ""
#: rcgcdw.py:218 #: rcgcdw.py:215
msgid "About me" msgid "About me"
msgstr "" msgstr ""
#: rcgcdw.py:220 #: rcgcdw.py:217
msgid "Google link" msgid "Google link"
msgstr "" msgstr ""
#: rcgcdw.py:222 #: rcgcdw.py:219
msgid "Facebook link" msgid "Facebook link"
msgstr "" msgstr ""
#: rcgcdw.py:224 #: rcgcdw.py:221
msgid "Twitter link" msgid "Twitter link"
msgstr "" msgstr ""
#: rcgcdw.py:226 #: rcgcdw.py:223
msgid "Reddit link" msgid "Reddit link"
msgstr "" msgstr ""
#: rcgcdw.py:228 #: rcgcdw.py:225
msgid "Twitch link" msgid "Twitch link"
msgstr "" msgstr ""
#: rcgcdw.py:230 #: rcgcdw.py:227
msgid "PSN link" msgid "PSN link"
msgstr "" msgstr ""
#: rcgcdw.py:232 #: rcgcdw.py:229
msgid "VK link" msgid "VK link"
msgstr "" msgstr ""
#: rcgcdw.py:234 #: rcgcdw.py:231
msgid "XVL link" msgid "XVL link"
msgstr "" msgstr ""
#: rcgcdw.py:236 #: rcgcdw.py:233
msgid "Steam link" msgid "Steam link"
msgstr "" msgstr ""
#: rcgcdw.py:238 #: rcgcdw.py:235
msgid "Unknown" msgid "Unknown"
msgstr "" msgstr ""
#: rcgcdw.py:239 #: rcgcdw.py:236
msgid "Edited {target}'s profile" msgid "Edited {target}'s profile"
msgstr "" msgstr ""
#: rcgcdw.py:240 #: rcgcdw.py:237
msgid "{field} field changed to: {desc}" msgid "{field} field changed to: {desc}"
msgstr "" msgstr ""
#: rcgcdw.py:244 #: rcgcdw.py:241
msgid "Deleted a comment on {target}'s profile" msgid "Deleted a comment on {target}'s profile"
msgstr "" msgstr ""
#: rcgcdw.py:247 #: rcgcdw.py:245
msgid "Changed group membership for {target}" msgid "Changed group membership for {target}"
msgstr "" msgstr ""
#: rcgcdw.py:257 rcgcdw.py:259 #: rcgcdw.py:247
msgid "System"
msgstr ""
#: rcgcdw.py:249
msgid "{target} got autopromoted to a new usergroup"
msgstr ""
#: rcgcdw.py:259 rcgcdw.py:261
msgid "none" msgid "none"
msgstr "" msgstr ""
#: rcgcdw.py:260 rcgcdw.py:381 #: rcgcdw.py:262 rcgcdw.py:383
msgid "No description provided" msgid "No description provided"
msgstr "" msgstr ""
#: rcgcdw.py:261 #: rcgcdw.py:263
msgid "Groups changed from {old_groups} to {new_groups}{reason}" msgid "Groups changed from {old_groups} to {new_groups}{reason}"
msgstr "" msgstr ""
#: rcgcdw.py:264 #: rcgcdw.py:266
msgid "Protected {target}" msgid "Protected {target}"
msgstr "" msgstr ""
#: rcgcdw.py:268 #: rcgcdw.py:270
msgid "Changed protection level for {article}" msgid "Changed protection level for {article}"
msgstr "" msgstr ""
#: rcgcdw.py:272 #: rcgcdw.py:274
msgid "Removed protection from {article}" msgid "Removed protection from {article}"
msgstr "" msgstr ""
#: rcgcdw.py:275 #: rcgcdw.py:277
msgid "Changed visibility of revision(s) on page {article} " msgid "Changed visibility of revision(s) on page {article} "
msgstr "" msgstr ""
#: rcgcdw.py:278 #: rcgcdw.py:280
msgid "Imported {article} with {count} revision(s)" msgid "Imported {article} with {count} revision(s)"
msgstr "" msgstr ""
#: rcgcdw.py:281 #: rcgcdw.py:283
msgid "Restored {article}" msgid "Restored {article}"
msgstr "" msgstr ""
#: rcgcdw.py:284 #: rcgcdw.py:286
msgid "Changed visibility of log events" msgid "Changed visibility of log events"
msgstr "" msgstr ""
#: rcgcdw.py:287 #: rcgcdw.py:289
msgid "Imported interwiki" msgid "Imported interwiki"
msgstr "" msgstr ""
#: rcgcdw.py:290 #: rcgcdw.py:292
msgid "Edited abuse filter number {number}" msgid "Edited abuse filter number {number}"
msgstr "" msgstr ""
#: rcgcdw.py:293 #: rcgcdw.py:295
msgid "Merged revision histories of {article} into {dest}" msgid "Merged revision histories of {article} into {dest}"
msgstr "" msgstr ""
#: rcgcdw.py:296 #: rcgcdw.py:298
msgid "Added an entry to the interwiki table" msgid "Added an entry to the interwiki table"
msgstr "" msgstr ""
#: rcgcdw.py:297 rcgcdw.py:301 #: rcgcdw.py:299 rcgcdw.py:303
msgid "Prefix: {prefix}, website: {website} | {desc}" msgid "Prefix: {prefix}, website: {website} | {desc}"
msgstr "" msgstr ""
#: rcgcdw.py:300 #: rcgcdw.py:302
msgid "Edited an entry in interwiki table" msgid "Edited an entry in interwiki table"
msgstr "" msgstr ""
#: rcgcdw.py:304 #: rcgcdw.py:306
msgid "Deleted an entry in interwiki table" msgid "Deleted an entry in interwiki table"
msgstr "" msgstr ""
#: rcgcdw.py:305 #: rcgcdw.py:307
msgid "Prefix: {prefix} | {desc}" msgid "Prefix: {prefix} | {desc}"
msgstr "" msgstr ""
#: rcgcdw.py:308 #: rcgcdw.py:310
msgid "Changed the content model of the page {article}" msgid "Changed the content model of the page {article}"
msgstr "" msgstr ""
#: rcgcdw.py:309 #: rcgcdw.py:311
msgid "Model changed from {old} to {new}: {reason}" msgid "Model changed from {old} to {new}: {reason}"
msgstr "" msgstr ""
#: rcgcdw.py:312 #: rcgcdw.py:314
msgid "Edited the sprite for {article}" msgid "Edited the sprite for {article}"
msgstr "" msgstr ""
#: rcgcdw.py:315 #: rcgcdw.py:317
msgid "Created the sprite sheet for {article}" msgid "Created the sprite sheet for {article}"
msgstr "" msgstr ""
#: rcgcdw.py:318 #: rcgcdw.py:320
msgid "Edited the slice for {article}" msgid "Edited the slice for {article}"
msgstr "" msgstr ""
#: rcgcdw.py:321 #: rcgcdw.py:323
msgid "Created a tag \"{tag}\"" msgid "Created a tag \"{tag}\""
msgstr "" msgstr ""
#: rcgcdw.py:325 #: rcgcdw.py:327
msgid "Deleted a tag \"{tag}\"" msgid "Deleted a tag \"{tag}\""
msgstr "" msgstr ""
#: rcgcdw.py:329 #: rcgcdw.py:331
msgid "Activated a tag \"{tag}\"" msgid "Activated a tag \"{tag}\""
msgstr "" msgstr ""
#: rcgcdw.py:332 #: rcgcdw.py:334
msgid "Deactivated a tag \"{tag}\"" msgid "Deactivated a tag \"{tag}\""
msgstr "" msgstr ""
#: rcgcdw.py:353 #: rcgcdw.py:355
msgid "Tags" msgid "Tags"
msgstr "" msgstr ""
#: rcgcdw.py:474 #: rcgcdw.py:478
msgid "Unable to process the event" msgid "Unable to process the event"
msgstr "" msgstr ""
#: rcgcdw.py:474 #: rcgcdw.py:478
msgid "error" msgid "error"
msgstr "" msgstr ""
#: rcgcdw.py:554 #: rcgcdw.py:558
msgid "Daily overview" msgid "Daily overview"
msgstr "" msgstr ""
#: rcgcdw.py:570 #: rcgcdw.py:574
msgid " ({} actions)" msgid " ({} actions)"
msgstr "" msgstr ""
#: rcgcdw.py:571 #: rcgcdw.py:575
msgid " UTC ({} actions)" msgid " UTC ({} actions)"
msgstr "" msgstr ""
#: rcgcdw.py:573 rcgcdw.py:574 #: rcgcdw.py:577 rcgcdw.py:578
msgid "But nobody came" msgid "But nobody came"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Admin actions" msgid "Admin actions"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Bytes changed" msgid "Bytes changed"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Day score" msgid "Day score"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Edits made" msgid "Edits made"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Most active hours" msgid "Most active hours"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Most active users" msgid "Most active users"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "New articles" msgid "New articles"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "New files" msgid "New files"
msgstr "" msgstr ""
#: rcgcdw.py:578 #: rcgcdw.py:582
msgid "Unique contributors" msgid "Unique contributors"
msgstr "" msgstr ""
#: rcgcdw.py:668 #: rcgcdw.py:672
msgid "Connection to {wiki} seems to be stable now." msgid "Connection to {wiki} seems to be stable now."
msgstr "" msgstr ""
#: rcgcdw.py:668 rcgcdw.py:723 #: rcgcdw.py:672 rcgcdw.py:727
msgid "Connection status" msgid "Connection status"
msgstr "" msgstr ""
#: rcgcdw.py:723 #: rcgcdw.py:727
msgid "{wiki} seems to be down or unreachable." msgid "{wiki} seems to be down or unreachable."
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "autopatrol" msgid "autopatrol"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "autoreview" msgid "autoreview"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "bot" msgid "bot"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "bureaucrat" msgid "bureaucrat"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "director" msgid "director"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "directors" msgid "directors"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "editor" msgid "editor"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "reviewer" msgid "reviewer"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "sysop" msgid "sysop"
msgstr "" msgstr ""
#: rcgcdw.py:745 #: rcgcdw.py:749
msgid "wiki_guardian" msgid "wiki_guardian"
msgstr "" msgstr ""

243
rcgcdw.py
View file

@ -104,7 +104,7 @@ def webhook_formatter(action, STATIC, **params):
params["user"] = "{author} ({amount})".format(author=params["user"], amount=recent_changes.map_ips[params["user"]]) params["user"] = "{author} ({amount})".format(author=params["user"], amount=recent_changes.map_ips[params["user"]])
else: else:
author_url = "https://{wiki}.gamepedia.com/User:{user}".format(wiki=settings["wiki"], user=params["user"].replace(" ", "_")) author_url = "https://{wiki}.gamepedia.com/User:{user}".format(wiki=settings["wiki"], user=params["user"].replace(" ", "_"))
if action in (1, 37): #edit or new page if action in ("edit", "new"): #edit or new page
editsize = params["size"] editsize = params["size"]
print (editsize) print (editsize)
if editsize > 0: if editsize > 0:
@ -120,8 +120,8 @@ def webhook_formatter(action, STATIC, **params):
elif editsize == 0: elif editsize == 0:
colornumber = 8750469 colornumber = 8750469
link = "https://{wiki}.gamepedia.com/index.php?title={article}&curid={pageid}&diff={diff}&oldid={oldrev}".format(wiki=settings["wiki"], pageid=params["pageid"], diff=params["diff"], oldrev=params["oldrev"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/index.php?title={article}&curid={pageid}&diff={diff}&oldid={oldrev}".format(wiki=settings["wiki"], pageid=params["pageid"], diff=params["diff"], oldrev=params["oldrev"], article=params["title"].replace(" ", "_"))
embed["title"] = "{article} ({new}{minor}{editsize})".format(article=params["title"], editsize="+"+str(editsize) if editsize>0 else editsize, new= _("(N!) ") if action == 37 else "", minor=_("m ") if action == 1 and params["minor"] else "") embed["title"] = "{article} ({new}{minor}{editsize})".format(article=params["title"], editsize="+"+str(editsize) if editsize>0 else editsize, new= _("(N!) ") if action == "new" else "", minor=_("m ") if action == "edit" and params["minor"] else "")
elif action == 5: #sending files elif action in ("upload/overwrite", "upload/upload"): #sending files
license = None license = None
urls = safe_read(recent_changes.safe_request("https://{wiki}.gamepedia.com/api.php?action=query&format=json&prop=imageinfo&list=&meta=&titles={filename}&iiprop=timestamp%7Curl&iilimit=2".format(wiki=settings["wiki"], filename=params["title"])), "query", "pages") urls = safe_read(recent_changes.safe_request("https://{wiki}.gamepedia.com/api.php?action=query&format=json&prop=imageinfo&list=&meta=&titles={filename}&iiprop=timestamp%7Curl&iilimit=2".format(wiki=settings["wiki"], filename=params["title"])), "query", "pages")
undolink = "" undolink = ""
@ -166,48 +166,48 @@ def webhook_formatter(action, STATIC, **params):
if additional_info_retrieved: if additional_info_retrieved:
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 if license is not None else "?") params["desc"] = _("{desc}\nLicense: {license}").format(desc=params["desc"], license=license if license is not None else "?")
elif action == 6: elif action == "delete/delete":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Deleted page {article}").format(article=params["title"]) embed["title"] = _("Deleted page {article}").format(article=params["title"])
elif action == 7: elif action == "delete/delete_redir":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Deleted redirect {article} by overwriting").format(article=params["title"]) embed["title"] = _("Deleted redirect {article} by overwriting").format(article=params["title"])
elif action == 14: elif action == "move/move":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["target"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["target"].replace(" ", "_"))
params["desc"] = "{supress}. {desc}".format(desc=params["desc"], supress=_("No redirect has been made") if params["supress"] == True else _("A redirect has been made")) params["desc"] = "{supress}. {desc}".format(desc=params["desc"], supress=_("No redirect has been made") if params["supress"] == True else _("A redirect has been made"))
embed["title"] = _("Moved {article} to {target}").format(article = params["title"], target=params["target"]) embed["title"] = _("Moved {article} to {target}").format(article = params["title"], target=params["target"])
elif action == 15: elif action == "move/move_redir":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["target"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["target"].replace(" ", "_"))
embed["title"] = _("Moved {article} to {title} over redirect").format(article=params["title"], title=params["target"]) embed["title"] = _("Moved {article} to {title} over redirect").format(article=params["title"], title=params["target"])
elif action == 16: elif action == "protect/move_prot":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Moved protection settings from {article} to {title}").format(article=params["title"], title=params["target"]) embed["title"] = _("Moved protection settings from {article} to {title}").format(article=params["title"], title=params["target"])
elif action == 17: elif action == "block/block":
link = "https://{wiki}.gamepedia.com/{user}".format(wiki=settings["wiki"], user=params["blocked_user"].replace(" ", "_").replace(')', '\)')) link = "https://{wiki}.gamepedia.com/{user}".format(wiki=settings["wiki"], user=params["blocked_user"].replace(" ", "_").replace(')', '\)'))
user = params["blocked_user"].split(':')[1] user = params["blocked_user"].split(':')[1]
time =_( "infinity and beyond") if params["duration"] == "infinite" else params["duration"] time =_( "infinity and beyond") if params["duration"] == "infinite" else params["duration"]
embed["title"] = _("Blocked {blocked_user} for {time}").format(blocked_user=user, time=time) embed["title"] = _("Blocked {blocked_user} for {time}").format(blocked_user=user, time=time)
elif action == 19: elif action == "block/reblock":
link = "https://{wiki}.gamepedia.com/{user}".format(wiki=settings["wiki"], user=params["blocked_user"].replace(" ", "_").replace(')', '\)')) link = "https://{wiki}.gamepedia.com/{user}".format(wiki=settings["wiki"], user=params["blocked_user"].replace(" ", "_").replace(')', '\)'))
user = params["blocked_user"].split(':')[1] user = params["blocked_user"].split(':')[1]
embed["title"] = _("Changed block settings for {blocked_user}").format(blocked_user=user) embed["title"] = _("Changed block settings for {blocked_user}").format(blocked_user=user)
elif action == 18: elif action == "block/unblock":
link = "https://{wiki}.gamepedia.com/{user}".format(wiki=settings["wiki"], user=params["blocked_user"].replace(" ", "_").replace(')', '\)')) link = "https://{wiki}.gamepedia.com/{user}".format(wiki=settings["wiki"], user=params["blocked_user"].replace(" ", "_").replace(')', '\)'))
user = params["blocked_user"].split(':')[1] user = params["blocked_user"].split(':')[1]
embed["title"] = _("Unblocked {blocked_user}").format(blocked_user=user) embed["title"] = _("Unblocked {blocked_user}").format(blocked_user=user)
elif action == 25: elif action == "curseprofile/comment-created":
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"]) link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"])
#link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)')) old way of linking #link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)')) old way of linking
embed["title"] = _("Left a comment on {target}'s profile").format(target=params["target"]) embed["title"] = _("Left a comment on {target}'s profile").format(target=params["target"])
elif action == 29: elif action == "curseprofile/comment-replied":
#link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)')) #link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)'))
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"]) link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"])
embed["title"] = _("Replied to a comment on {target}'s profile").format(target=params["target"]) embed["title"] = _("Replied to a comment on {target}'s profile").format(target=params["target"])
elif action == 26: elif action == "curseprofile/comment-edited":
#link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)')) #link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)'))
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"]) link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"])
embed["title"] = _("Edited a comment on {target}'s profile").format(target=params["target"]) embed["title"] = _("Edited a comment on {target}'s profile").format(target=params["target"])
elif action == 28: elif action == "curseprofile/profile-edited":
link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)')) link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)'))
if params["field"] == "profile-location": if params["field"] == "profile-location":
field = _("Location") field = _("Location")
@ -235,13 +235,18 @@ def webhook_formatter(action, STATIC, **params):
field = _("Unknown") field = _("Unknown")
embed["title"] = _("Edited {target}'s profile").format(target=params["target"]) embed["title"] = _("Edited {target}'s profile").format(target=params["target"])
params["desc"] = _("{field} field changed to: {desc}").format(field=field, desc=params["desc"]) params["desc"] = _("{field} field changed to: {desc}").format(field=field, desc=params["desc"])
elif action == 27: elif action == "curseprofile/comment-deleted":
link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"]) link = "https://{wiki}.gamepedia.com/Special:CommentPermalink/{commentid}".format(wiki=settings["wiki"], commentid=params["commentid"])
#link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)')) #link = "https://{wiki}.gamepedia.com/UserProfile:{target}".format(wiki=settings["wiki"], target=params["target"].replace(" ", "_").replace(')', '\)'))
embed["title"] = _("Deleted a comment on {target}'s profile").format(target=params["target"]) embed["title"] = _("Deleted a comment on {target}'s profile").format(target=params["target"])
elif action == 20: elif action in ("rights/rights", "rights/autopromote"):
link = "https://{wiki}.gamepedia.com/User:".format(wiki=settings["wiki"])+params["title"].split(":")[1] link = "https://{wiki}.gamepedia.com/User:".format(wiki=settings["wiki"])+params["title"].split(":")[1]
if action == "rights/rights":
embed["title"] = _("Changed group membership for {target}").format(target=params["title"].split(":")[1]) embed["title"] = _("Changed group membership for {target}").format(target=params["title"].split(":")[1])
else:
params["user"] = _("System")
author_url = ""
embed["title"] = _("{target} got autopromoted to a new usergroup").format(target=params["title"].split(":")[1])
if len(params["old_groups"]) < len(params["new_groups"]): if len(params["old_groups"]) < len(params["new_groups"]):
embed["thumbnail"]["url"] = "https://i.imgur.com/WnGhF5g.gif" embed["thumbnail"]["url"] = "https://i.imgur.com/WnGhF5g.gif"
old_groups = [] old_groups = []
@ -256,75 +261,75 @@ def webhook_formatter(action, STATIC, **params):
new_groups = [_("none")] new_groups = [_("none")]
reason = ": {desc}".format(desc=params["desc"]) if params["desc"]!=_("No description provided") else "" reason = ": {desc}".format(desc=params["desc"]) if params["desc"]!=_("No description provided") else ""
params["desc"] = _("Groups changed from {old_groups} to {new_groups}{reason}").format(old_groups=", ".join(old_groups), new_groups=', '.join(new_groups), reason=reason) params["desc"] = _("Groups changed from {old_groups} to {new_groups}{reason}").format(old_groups=", ".join(old_groups), new_groups=', '.join(new_groups), reason=reason)
elif action == 2: elif action == "protect/protect":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Protected {target}").format(target=params["title"]) embed["title"] = _("Protected {target}").format(target=params["title"])
params["desc"] = params["settings"] + " | " + params["desc"] params["desc"] = params["settings"] + " | " + params["desc"]
elif action == 3: elif action == "protect/modify":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Changed protection level for {article}").format(article=params["title"]) embed["title"] = _("Changed protection level for {article}").format(article=params["title"])
params["desc"] = params["settings"] + " | " + params["desc"] params["desc"] = params["settings"] + " | " + params["desc"]
elif action == 4: elif action == "protect/unprotect":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Removed protection from {article}").format(article=params["title"]) embed["title"] = _("Removed protection from {article}").format(article=params["title"])
elif action == 9: elif action == "delete/revision":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Changed visibility of revision(s) on page {article} ").format(article=params["title"]) embed["title"] = _("Changed visibility of revision(s) on page {article} ").format(article=params["title"])
elif action == 11: elif action == "import/upload":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Imported {article} with {count} revision(s)").format(article=params["title"], count=params["amount"]) embed["title"] = _("Imported {article} with {count} revision(s)").format(article=params["title"], count=params["amount"])
elif action == 8: elif action == "delete/restore":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Restored {article}").format(article=params["title"]) embed["title"] = _("Restored {article}").format(article=params["title"])
elif action == 10: elif action == "delete/event":
link = "https://{wiki}.gamepedia.com/Special:RecentChanges".format(wiki=settings["wiki"]) link = "https://{wiki}.gamepedia.com/Special:RecentChanges".format(wiki=settings["wiki"])
embed["title"] = _("Changed visibility of log events") embed["title"] = _("Changed visibility of log events")
elif action == 12: elif action == "import/interwiki":
link = "https://{wiki}.gamepedia.com/Special:RecentChanges".format(wiki=settings["wiki"]) link = "https://{wiki}.gamepedia.com/Special:RecentChanges".format(wiki=settings["wiki"])
embed["title"] = _("Imported interwiki") embed["title"] = _("Imported interwiki")
elif action == 21: elif action == "abusefilter/modify":
link = "https://{wiki}.gamepedia.com/Special:RecentChanges".format(wiki=settings["wiki"]) link = "https://{wiki}.gamepedia.com/Special:RecentChanges".format(wiki=settings["wiki"])
embed["title"] = _("Edited abuse filter number {number}").format(number=params["filternr"]) embed["title"] = _("Edited abuse filter number {number}").format(number=params["filternr"])
elif action == 13: elif action == "merge/merge":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Merged revision histories of {article} into {dest}").format(article=params["title"], dest=params["destination"]) embed["title"] = _("Merged revision histories of {article} into {dest}").format(article=params["title"], dest=params["destination"])
elif action == 22: elif action == "interwiki/iw_add":
link = "https://{wiki}.gamepedia.com/Special:Interwiki".format(wiki=settings["wiki"]) link = "https://{wiki}.gamepedia.com/Special:Interwiki".format(wiki=settings["wiki"])
embed["title"] = _("Added an entry to the interwiki table") embed["title"] = _("Added an entry to the interwiki table")
params["desc"] =_("Prefix: {prefix}, website: {website} | {desc}").format(desc=params["desc"], prefix=params["prefix"], website=params["website"]) params["desc"] =_("Prefix: {prefix}, website: {website} | {desc}").format(desc=params["desc"], prefix=params["prefix"], website=params["website"])
elif action == 23: elif action == "interwiki/iw_edit":
link = "https://{wiki}.gamepedia.com/Special:Interwiki".format(wiki=settings["wiki"]) link = "https://{wiki}.gamepedia.com/Special:Interwiki".format(wiki=settings["wiki"])
embed["title"] = _("Edited an entry in interwiki table") embed["title"] = _("Edited an entry in interwiki table")
params["desc"] =_("Prefix: {prefix}, website: {website} | {desc}").format(desc=params["desc"], prefix=params["prefix"], website=params["website"]) params["desc"] =_("Prefix: {prefix}, website: {website} | {desc}").format(desc=params["desc"], prefix=params["prefix"], website=params["website"])
elif action == 24: elif action == "interwiki/iw_delete":
link = "https://{wiki}.gamepedia.com/Special:Interwiki".format(wiki=settings["wiki"]) link = "https://{wiki}.gamepedia.com/Special:Interwiki".format(wiki=settings["wiki"])
embed["title"] = _("Deleted an entry in interwiki table") embed["title"] = _("Deleted an entry in interwiki table")
params["desc"] =_("Prefix: {prefix} | {desc}").format(desc=params["desc"], prefix=params["prefix"]) params["desc"] =_("Prefix: {prefix} | {desc}").format(desc=params["desc"], prefix=params["prefix"])
elif action == 30: elif action == "contentmodel/change":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Changed the content model of the page {article}").format(article=params["title"]) embed["title"] = _("Changed the content model of the page {article}").format(article=params["title"])
params["desc"] = _("Model changed from {old} to {new}: {reason}").format(old=params["oldmodel"], new=params["newmodel"], reason=params["desc"]) params["desc"] = _("Model changed from {old} to {new}: {reason}").format(old=params["oldmodel"], new=params["newmodel"], reason=params["desc"])
elif action == 31: elif action == "sprite/sprite":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Edited the sprite for {article}").format(article=params["title"]) embed["title"] = _("Edited the sprite for {article}").format(article=params["title"])
elif action == 32: elif action == "sprite/sheet":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Created the sprite sheet for {article}").format(article=params["title"]) embed["title"] = _("Created the sprite sheet for {article}").format(article=params["title"])
elif action == 33: elif action == "sprite/slice":
link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_")) link = "https://{wiki}.gamepedia.com/{article}".format(wiki=settings["wiki"], article=params["title"].replace(" ", "_"))
embed["title"] = _("Edited the slice for {article}").format(article=params["title"]) embed["title"] = _("Edited the slice for {article}").format(article=params["title"])
elif action == 34: elif action == "managetags/create":
link = "https://{wiki}.gamepedia.com/Special:Tags" link = "https://{wiki}.gamepedia.com/Special:Tags"
embed["title"] = _("Created a tag \"{tag}\"").format(tag=params["additional"]["tag"]) embed["title"] = _("Created a tag \"{tag}\"").format(tag=params["additional"]["tag"])
recent_changes.update_tags() recent_changes.update_tags()
elif action == 35: elif action == "managetags/delete":
link = "https://{wiki}.gamepedia.com/Special:Tags" link = "https://{wiki}.gamepedia.com/Special:Tags"
embed["title"] = _("Deleted a tag \"{tag}\"").format(tag=params["additional"]["tag"]) embed["title"] = _("Deleted a tag \"{tag}\"").format(tag=params["additional"]["tag"])
recent_changes.update_tags() recent_changes.update_tags()
elif action == 36: elif action == "managetags/activate":
link = "https://{wiki}.gamepedia.com/Special:Tags" link = "https://{wiki}.gamepedia.com/Special:Tags"
embed["title"] = _("Activated a tag \"{tag}\"").format(tag=params["additional"]["tag"]) embed["title"] = _("Activated a tag \"{tag}\"").format(tag=params["additional"]["tag"])
elif action == 38: elif action == "managetags/deactivate":
link = "https://{wiki}.gamepedia.com/Special:Tags" link = "https://{wiki}.gamepedia.com/Special:Tags"
embed["title"] = _("Deactivated a tag \"{tag}\"").format(tag=params["additional"]["tag"]) embed["title"] = _("Deactivated a tag \"{tag}\"").format(tag=params["additional"]["tag"])
else: else:
@ -378,11 +383,9 @@ def first_pass(change): #I've decided to split the embed formatter and change ha
parsedcomment = _("No description provided") parsedcomment = _("No description provided")
if change["type"] == "edit" and "edit" not in settings["ignored"]: if change["type"] == "edit" and "edit" not in settings["ignored"]:
STATIC_VARS = {**STATIC_VARS ,**{"color": settings["appearance"]["edit"]["color"], "icon": settings["appearance"]["edit"]["icon"]}} STATIC_VARS = {**STATIC_VARS ,**{"color": settings["appearance"]["edit"]["color"], "icon": settings["appearance"]["edit"]["icon"]}}
webhook_formatter(1, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"], size=change["newlen"]-change["oldlen"], minor= True if "minor" in change else False) webhook_formatter("edit", STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"], size=change["newlen"]-change["oldlen"], minor= True if "minor" in change else False)
elif change["type"] == "log": elif change["type"] == "log":
logtype = change["logtype"] combination = "{logtype}/{logaction}".format(logtype=change["logtype"], logaction=change["logaction"])
logaction = change["logaction"]
combination = "{logtype}/{logaction}".format(logtype=logtype, logaction=logaction)
if combination in settings["ignored"]: if combination in settings["ignored"]:
return return
logging.debug("combination is {}".format(combination)) logging.debug("combination is {}".format(combination))
@ -391,82 +394,84 @@ def first_pass(change): #I've decided to split the embed formatter and change ha
except KeyError: except KeyError:
STATIC_VARS = {**STATIC_VARS ,**{"color": "", "icon": ""}} STATIC_VARS = {**STATIC_VARS ,**{"color": "", "icon": ""}}
logging.error("No value in the settings has been given for {}".format(combination)) logging.error("No value in the settings has been given for {}".format(combination))
if logtype=="protect" and logaction=="protect": if combination == "protect/protect"
webhook_formatter(2, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, settings=change["logparams"]["description"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, settings=change["logparams"]["description"])
elif logtype=="protect" and logaction=="modify": elif combination=="protect/modify":
webhook_formatter(3, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, settings=change["logparams"]["description"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, settings=change["logparams"]["description"])
elif logtype=="protect" and logaction=="unprotect": elif combination=="protect/unprotect":
webhook_formatter(4, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="upload" and logaction=="overwrite": elif combination=="upload/overwrite":
webhook_formatter(5, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, overwrite=True) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, overwrite=True)
elif logtype=="upload": elif combination=="upload/upload":
webhook_formatter(5, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, overwrite=False) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, overwrite=False)
elif logtype=="delete" and logaction=="delete": elif combination=="delete/delete":
webhook_formatter(6, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="delete" and logaction=="delete_redir": elif combination=="delete/delete_redir":
webhook_formatter(7, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="delete" and logaction=="restore": elif combination=="delete/restore":
webhook_formatter(8, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="delete" and logaction=="revision": elif combination=="delete/revision":
webhook_formatter(9, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="delete" and logaction=="event": elif combination=="delete/event":
webhook_formatter(10, STATIC_VARS, user=change["user"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], desc=parsedcomment)
elif logtype=="import" and logaction=="upload": elif combination=="import/upload":
webhook_formatter(11, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, amount=change["logparams"]["count"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, amount=change["logparams"]["count"])
elif logtype=="import" and logaction=="interwiki": elif combination=="import/interwiki":
webhook_formatter(12, STATIC_VARS, user=change["user"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], desc=parsedcomment)
elif logtype=="merge" : elif combination=="merge/merge" :
webhook_formatter(13, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, destination=change["logparams"]["dest_title"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, destination=change["logparams"]["dest_title"])
elif logtype=="move" and logaction=="move": elif combination=="move/move":
webhook_formatter(14, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, supress=True if "suppressredirect" in change["logparams"] else False, target=change["logparams"]['target_title']) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, supress=True if "suppressredirect" in change["logparams"] else False, target=change["logparams"]['target_title'])
elif logtype=="move" and logaction=="move_redir": elif combination=="move/move_redir":
webhook_formatter(15, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, target=change["logparams"]["target_title"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, target=change["logparams"]["target_title"])
elif logtype=="protect" and logaction=="move_prot": elif combination=="protect/move_prot":
webhook_formatter(16, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, target=change["logparams"]["oldtitle_title"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, target=change["logparams"]["oldtitle_title"])
elif logtype=="block" and logaction=="block": elif combination=="block/block":
webhook_formatter(17, STATIC_VARS, user=change["user"], blocked_user=change["title"], desc=parsedcomment, duration=change["logparams"]["duration"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], blocked_user=change["title"], desc=parsedcomment, duration=change["logparams"]["duration"])
elif logtype=="block" and logaction=="unblock": elif combination=="block/unblock":
webhook_formatter(18, STATIC_VARS, user=change["user"], blocked_user=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], blocked_user=change["title"], desc=parsedcomment)
elif logtype=="block": elif combination=="block/reblock":
webhook_formatter(19, STATIC_VARS, user=change["user"], blocked_user=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], blocked_user=change["title"], desc=parsedcomment)
elif logtype=="rights": elif combination=="rights/rights":
webhook_formatter(20, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, old_groups=change["logparams"]["oldgroups"], new_groups=change["logparams"]["newgroups"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, old_groups=change["logparams"]["oldgroups"], new_groups=change["logparams"]["newgroups"])
elif logtype=="abusefilter": elif combination=="rights/autopromote":
webhook_formatter(21, STATIC_VARS, user=change["user"], desc=parsedcomment, filternr=change["logparams"]['1']) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, old_groups=change["logparams"]["oldgroups"], new_groups=change["logparams"]["newgroups"])
elif logtype=="interwiki" and logaction=="iw_add": elif combination=="abusefilter/modify":
webhook_formatter(22, STATIC_VARS, user=change["user"], desc=parsedcomment, prefix=change["logparams"]['0'], website=change["logparams"]['1']) webhook_formatter(combination, STATIC_VARS, user=change["user"], desc=parsedcomment, filternr=change["logparams"]['1'])
elif logtype=="interwiki" and logaction=="iw_edit": elif combination=="interwiki/iw_add":
webhook_formatter(23, STATIC_VARS, user=change["user"], desc=parsedcomment, prefix=change["logparams"]['0'], website=change["logparams"]['1']) webhook_formatter(combination, STATIC_VARS, user=change["user"], desc=parsedcomment, prefix=change["logparams"]['0'], website=change["logparams"]['1'])
elif logtype=="interwiki" and logaction=="iw_delete": elif combination=="interwiki/iw_edit":
webhook_formatter(24, STATIC_VARS, user=change["user"], desc=parsedcomment, prefix=change["logparams"]['0']) webhook_formatter(combination, STATIC_VARS, user=change["user"], desc=parsedcomment, prefix=change["logparams"]['0'], website=change["logparams"]['1'])
elif logtype=="curseprofile" and logaction=="comment-created": elif combination=="interwiki/iw_delete":
webhook_formatter(25, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], desc=parsedcomment, prefix=change["logparams"]['0'])
elif logtype=="curseprofile" and logaction=="comment-edited": elif combination=="curseprofile/comment-created":
webhook_formatter(26, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"])
elif logtype=="curseprofile" and logaction=="comment-deleted": elif combination=="curseprofile/comment-edited":
webhook_formatter(27, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"])
elif logtype=="curseprofile" and logaction=="profile-edited": elif combination=="curseprofile/comment-deleted":
webhook_formatter(28, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], field=change["logparams"]['0'], desc=change["parsedcomment"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"])
elif logtype=="curseprofile" and logaction=="comment-replied": elif combination=="curseprofile/profile-edited":
webhook_formatter(29, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], field=change["logparams"]['0'], desc=change["parsedcomment"])
elif logtype=="contentmodel" and logaction=="change": elif combination=="curseprofile/comment-replied":
webhook_formatter(30, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldmodel=change["logparams" ]["oldmodel"], newmodel=change["logparams" ]["newmodel"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], target=change["title"].split(':')[1], commentid=change["logparams"]["0"])
elif logtype=="sprite" and logaction=="sprite": elif combination=="contentmodel/change":
webhook_formatter(31, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldmodel=change["logparams" ]["oldmodel"], newmodel=change["logparams" ]["newmodel"])
elif logtype=="sprite" and logaction=="sheet": elif combination=="sprite/sprite":
webhook_formatter(32, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="sprite" and logaction=="slice": elif combination=="sprite/sheet":
webhook_formatter(33, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="managetags" and logaction=="create": elif combination=="sprite/slice":
webhook_formatter(34, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
elif logtype=="managetags" and logaction=="delete": elif combination=="managetags/create":
webhook_formatter(35, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"])
elif logtype=="managetags" and logaction=="activate": elif combination=="managetags/delete":
webhook_formatter(36, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"])
elif logtype=="managetags" and logaction=="deactivate": elif combination=="managetags/activate":
webhook_formatter(38, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"]) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"])
elif logtype=="tag" and logaction=="update": elif combination=="managetags/deactivate":
webhook_formatter(39, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment) webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, additional=change["logparams"])
elif combination=="tag/update":
webhook_formatter(combination, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment)
else: else:
logging.warning("No entry matches given change!") logging.warning("No entry matches given change!")
print (change) print (change)
@ -478,7 +483,7 @@ def first_pass(change): #I've decided to split the embed formatter and change ha
return return
elif change["type"] == "new" and "new" not in settings["ignored"]: #new page elif change["type"] == "new" and "new" not in settings["ignored"]: #new page
STATIC_VARS = {**STATIC_VARS ,**{"color": settings["appearance"]["new"]["color"], "icon": settings["appearance"]["new"]["icon"]}} STATIC_VARS = {**STATIC_VARS ,**{"color": settings["appearance"]["new"]["color"], "icon": settings["appearance"]["new"]["icon"]}}
webhook_formatter(37, STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"], size=change["newlen"]) webhook_formatter("new", STATIC_VARS, user=change["user"], title=change["title"], desc=parsedcomment, oldrev=change["old_revid"], pageid=change["pageid"], diff=change["revid"], size=change["newlen"])
def day_overview_request(): def day_overview_request():
logging.info("Fetching daily overview... This may take up to 30 seconds!") logging.info("Fetching daily overview... This may take up to 30 seconds!")