diff --git a/scripts/configbuilder.py b/scripts/configbuilder.py index 084d061..9c02d73 100644 --- a/scripts/configbuilder.py +++ b/scripts/configbuilder.py @@ -311,7 +311,7 @@ class AdvancedSettings: @staticmethod def set_ignored_events(): - 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/comment-purged", "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", "upload/revert", "newusers/create", "newusers/autocreate", "newusers/create2", "newusers/byemail", "newusers/newusers", "edit", "new", "external"] + 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/comment-purged", "curseprofile/profile-edited", "curseprofile/comment-replied", "contentmodel/change", "sprite/sprite", "sprite/sheet", "sprite/slice", "managetags/create", "managetags/delete", "managetags/activate", "managetags/deactivate", "cargo/createtable", "cargo/deletetable", "cargo/recreatetable", "cargo/replacetable", "upload/revert", "newusers/create", "newusers/autocreate", "newusers/create2", "newusers/byemail", "newusers/newusers", "edit", "new", "external"] option = default_or_custom( input( "Provide a list of entry types that are supposed to be ignored. Separate them using commas. Example: external, edit, upload/overwrite. (default: external)\n"), diff --git a/settings.json.example b/settings.json.example index e272035..0f93e51 100644 --- a/settings.json.example +++ b/settings.json.example @@ -63,250 +63,6 @@ "rcgcdw.misc": { } } - }, - "appearance":{ - "mode": "embed", - "embed": { - "show_edit_changes": false, - "show_footer": true, - "embed_images": true, - "daily_overview": { - "color": 16312092, - "icon":"" - }, - "new":{ - "icon":"https://i.imgur.com/6HIbEq8.png", - "color":"THIS COLOR DEPENDS ON EDIT SIZE, PLEASE DON'T CHANGE" - }, - "edit":{ - "icon":"", - "color":"THIS COLOR DEPENDS ON EDIT SIZE, PLEASE DON'T CHANGE" - }, - "upload/overwrite":{ - "icon":"https://i.imgur.com/egJpa81.png", - "color":12390624 - }, - "upload/upload":{ - "icon":"https://i.imgur.com/egJpa81.png", - "color":null - }, - "upload/revert": { - "icon": "https://i.imgur.com/egJpa81.png", - "color": null - }, - "delete/delete":{ - "icon":"https://i.imgur.com/BU77GD3.png", - "color":1 - }, - "delete/delete_redir":{ - "icon":"https://i.imgur.com/BU77GD3.png", - "color":1 - }, - "delete/restore":{ - "icon":"https://i.imgur.com/9MnROIU.png", - "color":null - }, - "delete/revision":{ - "icon":"https://i.imgur.com/1gps6EZ.png", - "color":null - }, - "delete/event":{ - "icon":"https://i.imgur.com/1gps6EZ.png", - "color":null - }, - "merge/merge":{ - "icon":"https://i.imgur.com/uQMK9XK.png", - "color":null - }, - "move/move":{ - "icon":"https://i.imgur.com/eXz9dog.png", - "color":null - }, - "move/move_redir":{ - "icon":"https://i.imgur.com/UtC3YX2.png", - "color":null - }, - "block/block":{ - "icon":"https://i.imgur.com/g7KgZHf.png", - "color":1 - }, - "block/unblock":{ - "icon":"https://i.imgur.com/bvtBJ8o.png", - "color":1 - }, - "block/reblock":{ - "icon":"https://i.imgur.com/g7KgZHf.png", - "color":1 - }, - "protect/protect":{ - "icon":"https://i.imgur.com/bzPt89Z.png", - "color":null - }, - "protect/modify":{ - "icon":"https://i.imgur.com/bzPt89Z.png", - "color":null - }, - "protect/move_prot":{ - "icon":"https://i.imgur.com/bzPt89Z.png", - "color":null - }, - "protect/unprotect":{ - "icon":"https://i.imgur.com/2wN3Qcq.png", - "color":null - }, - "import/upload":{ - "icon":"", - "color":null - }, - "import/interwiki":{ - "icon":"https://i.imgur.com/sFkhghb.png", - "color":null - }, - "rights/rights":{ - "icon":"", - "color":null - }, - "rights/autopromote": { - "icon":"", - "color":null - }, - "abusefilter/abusefilter":{ - "icon":"https://i.imgur.com/Sn2NzRJ.png", - "color":null - }, - "abusefilter/modify":{ - "icon":"https://i.imgur.com/Sn2NzRJ.png", - "color":null - }, - "abusefilter/create": { - "icon":"https://i.imgur.com/Sn2NzRJ.png", - "color":null - }, - "interwiki/iw_add":{ - "icon":"https://i.imgur.com/sFkhghb.png", - "color":null - }, - "interwiki/iw_edit":{ - "icon":"https://i.imgur.com/sFkhghb.png", - "color":null - }, - "interwiki/iw_delete":{ - "icon":"https://i.imgur.com/sFkhghb.png", - "color":null - }, - "curseprofile/comment-created":{ - "icon":"https://i.imgur.com/Lvy5E32.png", - "color":null - }, - "curseprofile/comment-edited":{ - "icon":"https://i.imgur.com/Lvy5E32.png", - "color":null - }, - "curseprofile/comment-deleted":{ - "icon":"", - "color":null - }, - "curseprofile/comment-purged":{ - "icon":"", - "color":null - }, - "curseprofile/comment-replied":{ - "icon":"https://i.imgur.com/hkyYsI1.png", - "color":null - }, - "curseprofile/profile-edited":{ - "icon":"", - "color":null - }, - "contentmodel/change":{ - "icon":"", - "color":null - }, - "cargo/deletetable": { - "icon": "", - "color": null - }, - "cargo/createtable": { - "icon": "", - "color": null - }, - "cargo/replacetable": { - "icon": "", - "color": null - }, - "cargo/recreatetable": { - "icon": "", - "color": null - }, - "sprite/sprite":{ - "icon":"", - "color":null - }, - "sprite/sheet":{ - "icon":"", - "color":null - }, - "sprite/slice":{ - "icon":"", - "color":null - }, - "managetags/create":{ - "icon":"", - "color":null - }, - "managetags/delete":{ - "icon":"", - "color":null - }, - "managetags/activate":{ - "icon":"", - "color":null - }, - "managetags/deactivate":{ - "icon":"", - "color":null - }, - "tag/update":{ - "icon":"", - "color":null - }, - "suppressed":{ - "icon": "https://i.imgur.com/1gps6EZ.png", - "color": 8092539 - }, - "discussion/forum/post": { - "icon": "", - "color":null - }, - "discussion/forum/reply": { - "icon": "", - "color":null - }, - "discussion/forum/poll": { - "icon": "", - "color":null - }, - "discussion/forum/quiz": { - "icon": "", - "color":null - }, - "discussion/wall/post": { - "icon": "", - "color":null - }, - "discussion/wall/reply": { - "icon": "", - "color":null - }, - "discussion/comment/post": { - "icon": "", - "color":null - }, - "discussion/comment/reply": { - "icon": "", - "color":null - } - } }, "fandom_discussions": { "enabled": false, @@ -322,5 +78,465 @@ } }, "show_forums": [] - } -} + }, + "appearance":{ + "mode": "embed", + "embed": { + "show_edit_changes": false, + "show_footer": true, + "embed_images": true, + } + }, + "event_appearance": { + "daily_overview": { + "icon": "", + "color": 16312092, + "emoji": "" + }, + "new": { + "icon": "https://i.imgur.com/6HIbEq8.png", + "color": "THIS COLOR DEPENDS ON EDIT SIZE, PLEASE DON'T CHANGE", + "emoji": "๐Ÿ†•" + }, + "edit": { + "icon": "", + "color": "THIS COLOR DEPENDS ON EDIT SIZE, PLEASE DON'T CHANGE", + "emoji": "๐Ÿ“" + }, + "upload/overwrite": { + "icon": "https://i.imgur.com/egJpa81.png", + "color": 12390624, + "emoji": "๐Ÿ–ผ๏ธ" + }, + "upload/upload": { + "icon": "https://i.imgur.com/egJpa81.png", + "color": 12390624, + "emoji": "๐Ÿ–ผ๏ธ" + }, + "upload/revert": { + "icon": "https://i.imgur.com/egJpa81.png", + "color": 12390624, + "emoji": "โฎ๏ธ" + }, + "delete/delete": { + "icon": "https://i.imgur.com/BU77GD3.png", + "color": 1, + "emoji": "๐Ÿ—‘๏ธ" + }, + "delete/delete_redir": { + "icon": "https://i.imgur.com/BU77GD3.png", + "color": 1, + "emoji": "๐Ÿ—‘๏ธ" + }, + "delete/restore": { + "icon": "https://i.imgur.com/9MnROIU.png", + "color": 1, + "emoji": "โ™ป๏ธ" + }, + "delete/revision": { + "icon": "https://i.imgur.com/1gps6EZ.png", + "color": 1, + "emoji": "๐Ÿ‘๏ธ" + }, + "delete/event": { + "icon": "https://i.imgur.com/1gps6EZ.png", + "color": 1, + "emoji": "๐Ÿ‘๏ธ" + }, + "merge/merge": { + "icon": "https://i.imgur.com/uQMK9XK.png", + "color": 25600, + "emoji": "๐Ÿ–‡๏ธ" + }, + "move/move": { + "icon": "https://i.imgur.com/eXz9dog.png", + "color": 25600, + "emoji": "๐Ÿ“จ" + }, + "move/move_redir": { + "icon": "https://i.imgur.com/UtC3YX2.png", + "color": 25600, + "emoji": "๐Ÿ“จ" + }, + "block/block": { + "icon": "https://i.imgur.com/g7KgZHf.png", + "color": 1, + "emoji": "๐Ÿšซ" + }, + "block/unblock": { + "icon": "https://i.imgur.com/bvtBJ8o.png", + "color": 1, + "emoji": "โœ…" + }, + "block/reblock": { + "icon": "https://i.imgur.com/g7KgZHf.png", + "color": 1, + "emoji": "๐Ÿšซ" + }, + "protect/protect": { + "icon": "https://i.imgur.com/bzPt89Z.png", + "color": 16312092, + "emoji": "๐Ÿ”’" + }, + "protect/modify": { + "icon": "https://i.imgur.com/bzPt89Z.png", + "color": 16312092, + "emoji": "๐Ÿ”" + }, + "protect/move_prot": { + "icon": "https://i.imgur.com/bzPt89Z.png", + "color": 16312092, + "emoji": "๐Ÿ”" + }, + "protect/unprotect": { + "icon": "https://i.imgur.com/2wN3Qcq.png", + "color": 16312092, + "emoji": "๐Ÿ”“" + }, + "import/upload": { + "icon": "", + "color": 65280, + "emoji": "๐Ÿ“ฅ" + }, + "import/interwiki": { + "icon": "https://i.imgur.com/sFkhghb.png", + "color": 65280, + "emoji": "๐Ÿ“ฅ" + }, + "rights/rights": { + "icon": "", + "color": 16711680, + "emoji": "๐Ÿ…" + }, + "rights/autopromote": { + "icon": "", + "color": 16711680, + "emoji": "๐Ÿ…" + }, + "abusefilter/modify": { + "icon": "https://i.imgur.com/Sn2NzRJ.png", + "color": 16711680, + "emoji": "๐Ÿ”" + }, + "abusefilter/create": { + "icon": "https://i.imgur.com/Sn2NzRJ.png", + "color": 16711680, + "emoji": "๐Ÿ”" + }, + "interwiki/iw_add": { + "icon": "https://i.imgur.com/sFkhghb.png", + "color": 16711680, + "emoji": "๐Ÿ”—" + }, + "interwiki/iw_edit": { + "icon": "https://i.imgur.com/sFkhghb.png", + "color": 16711680, + "emoji": "๐Ÿ”—" + }, + "interwiki/iw_delete": { + "icon": "https://i.imgur.com/sFkhghb.png", + "color": 16711680, + "emoji": "๐Ÿ”—" + }, + "curseprofile/comment-created": { + "icon": "https://i.imgur.com/Lvy5E32.png", + "color": 16089376, + "emoji": "โœ‰๏ธ" + }, + "curseprofile/comment-edited": { + "icon": "https://i.imgur.com/Lvy5E32.png", + "color": 16089376, + "emoji": "๐Ÿ“ง" + }, + "curseprofile/comment-deleted": { + "icon": "", + "color": 16089376, + "emoji": "๐Ÿ—‘๏ธ" + }, + "curseprofile/comment-purged":{ + "icon":"", + "color": 16089376, + "emoji": "๐Ÿ‘๏ธ" + }, + "curseprofile/comment-replied": { + "icon": "https://i.imgur.com/hkyYsI1.png", + "color": 16089376, + "emoji": "๐Ÿ“ฉ" + }, + "curseprofile/profile-edited": { + "icon": "", + "color": 16089376, + "emoji": "๐Ÿ“Œ" + }, + "contentmodel/change": { + "icon": "", + "color": 25600, + "emoji": "๐Ÿ“‹" + }, + "cargo/deletetable": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿ“ฆ" + }, + "cargo/createtable": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿ“ฆ" + }, + "cargo/replacetable": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿ“ฆ" + }, + "cargo/recreatetable": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿ“ฆ" + }, + "sprite/sprite": { + "icon": "", + "color": 16776960, + "emoji": "๐ŸชŸ" + }, + "sprite/sheet": { + "icon": "", + "color": 16776960, + "emoji": "๐ŸชŸ" + }, + "sprite/slice": { + "icon": "", + "color": 16776960, + "emoji": "๐ŸชŸ" + }, + "managetags/create": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿท๏ธ" + }, + "managetags/delete": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿท๏ธ" + }, + "managetags/activate": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿท๏ธ" + }, + "managetags/deactivate": { + "icon": "", + "color": 16776960, + "emoji": "๐Ÿท๏ธ" + }, + "newusers/autocreate": { + "icon": "", + "color": 65280, + "emoji": "๐Ÿ—ฟ" + }, + "newusers/byemail": { + "icon": "", + "color": 65280, + "emoji": "๐Ÿ—ฟ" + }, + "newusers/create": { + "icon": "", + "color": 65280, + "emoji": "๐Ÿ—ฟ" + }, + "newusers/create2": { + "icon": "", + "color": 65280, + "emoji": "๐Ÿ—ฟ" + }, + "newusers/newusers": { + "icon": "", + "color": 65280, + "emoji": "๐Ÿ—ฟ" + }, + "managewiki/delete": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ—‘๏ธ" + }, + "managewiki/lock": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ”’" + }, + "managewiki/namespaces": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ“ฆ" + }, + "managewiki/namespaces-delete": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ—‘๏ธ" + }, + "managewiki/rights": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ…" + }, + "managewiki/settings": { + "icon": "", + "color": 8421504, + "emoji": "โš™๏ธ" + }, + "managewiki/undelete": { + "icon": "", + "color": 8421504, + "emoji": "โ™ป๏ธ" + }, + "managewiki/unlock": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ”“" + }, + "datadump/generate": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ“ค" + }, + "datadump/delete": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ—‘๏ธ" + }, + "pagetranslation/mark": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/unmark": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/moveok": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/movenok": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/deletefok": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/deletefnok": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/deletelok": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/deletelnok": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/encourage": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/discourage": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/prioritylanguages": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/associate": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagetranslation/dissociate": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "translationreview/message": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "translationreview/group": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "pagelang/pagelang": { + "icon": "", + "color": 8421504, + "emoji": "๐ŸŒ" + }, + "renameuser/renameuser": { + "icon": "", + "color": 8421504, + "emoji": "๐Ÿ“›" + }, + "suppressed": { + "icon": "https://i.imgur.com/1gps6EZ.png", + "color": 1, + "emoji": "๐Ÿ‘๏ธ" + }, + "discussion/forum/post": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 54998, + "emoji": "๐Ÿ“" + }, + "discussion/forum/reply": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 54998, + "emoji": "๐Ÿ“" + }, + "discussion/forum/poll": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 54998, + "emoji": "๐Ÿ“" + }, + "discussion/forum/quiz": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 54998, + "emoji": "๐Ÿ“" + }, + "discussion/wall/post": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 3752525, + "emoji": "โœ‰๏ธ" + }, + "discussion/wall/reply": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 3752525, + "emoji": "๐Ÿ“ฉ" + }, + "discussion/comment/post": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 10802, + "emoji": "๐Ÿ—’๏ธ" + }, + "discussion/comment/reply": { + "icon": "https://static.wikia.nocookie.net/663e53f7-1e79-4906-95a7-2c1df4ebbada", + "color": 10802, + "emoji": "๐Ÿ—’๏ธ" + }, + "unknown": { + "icon": "", + "color": 0, + "emoji": "โ“" + } + } +} \ No newline at end of file diff --git a/src/discord/message.py b/src/discord/message.py index ed1d357..c781af9 100644 --- a/src/discord/message.py +++ b/src/discord/message.py @@ -47,12 +47,14 @@ class DiscordMessage: def finish_embed(self): if self.embed["color"] is None: - if settings["appearance"]["embed"].get(self.event_type, {"color": None})["color"] is None: + if settings["event_appearance"].get(self.event_type, {"color": None})["color"] is None: self.embed["color"] = random.randrange(1, 16777215) else: - self.embed["color"] = settings["appearance"]["embed"][self.event_type]["color"] + self.embed["color"] = settings["event_appearance"][self.event_type]["color"] else: self.embed["color"] = math.floor(self.embed["color"]) + if not self.embed["author"]["icon_url"] and settings["event_appearance"].get(self.event_type, {"icon": None})["icon"]: + self.embed["author"]["icon_url"] = settings["event_appearance"][self.event_type]["icon"] def set_author(self, name, url, icon_url=""): self.embed["author"]["name"] = name diff --git a/src/discussion_formatters.py b/src/discussion_formatters.py index 33b7658..5c292fc 100644 --- a/src/discussion_formatters.py +++ b/src/discussion_formatters.py @@ -28,38 +28,49 @@ def compact_formatter(post_type, post, article_paths): author = post["createdBy"]["name"] author_url = "<{url}wiki/User:{author}>".format(url=settings["fandom_discussions"]["wiki_url"], author=author) author_url = link_formatter(create_article_path("User:{user}".format(user=author))) + event_type = "discussion" if post_type == "FORUM": if not post["isReply"]: thread_funnel = post.get("funnel") msg_text = _("[{author}]({author_url}) created [{title}](<{url}f/p/{threadId}>) in {forumName}") if thread_funnel == "POLL": + event_type = "discussion/forum/poll" msg_text = _("[{author}]({author_url}) created a poll [{title}](<{url}f/p/{threadId}>) in {forumName}") elif thread_funnel == "QUIZ": + event_type = "discussion/forum/quiz" msg_text = _("[{author}]({author_url}) created a quiz [{title}](<{url}f/p/{threadId}>) in {forumName}") - elif thread_funnel != "TEXT": + elif thread_funnel == "TEXT": + event_type = "discussion/forum/post" + else: discussion_logger.warning("The type of {} is an unknown discussion post type. Please post an issue on the project page to have it added https://gitlab.com/piotrex43/RcGcDw/-/issues.".format(thread_funnel)) - message = "๐Ÿ“ "+msg_text.format(author=author, author_url=author_url, title=post["title"], url=settings["fandom_discussions"]["wiki_url"], threadId=post["threadId"], forumName=post["forumName"]) + event_type = "unknown" + message = msg_text.format(author=author, author_url=author_url, title=post["title"], url=settings["fandom_discussions"]["wiki_url"], threadId=post["threadId"], forumName=post["forumName"]) else: - message = "๐Ÿ“ "+_("[{author}]({author_url}) created a [reply](<{url}f/p/{threadId}/r/{postId}>) to [{title}](<{url}f/p/{threadId}>) in {forumName}").format(author=author, author_url=author_url, url=settings["fandom_discussions"]["wiki_url"], threadId=post["threadId"], postId=post["id"], title=post["_embedded"]["thread"][0]["title"], forumName=post["forumName"]) + event_type = "discussion/forum/reply" + message = _("[{author}]({author_url}) created a [reply](<{url}f/p/{threadId}/r/{postId}>) to [{title}](<{url}f/p/{threadId}>) in {forumName}").format(author=author, author_url=author_url, url=settings["fandom_discussions"]["wiki_url"], threadId=post["threadId"], postId=post["id"], title=post["_embedded"]["thread"][0]["title"], forumName=post["forumName"]) elif post_type == "WALL": user_wall = _("unknown") # Fail safe if post["forumName"].endswith(' Message Wall'): user_wall = post["forumName"][:-13] if not post["isReply"]: - message = "โœ‰๏ธ "+_("[{author}]({author_url}) created [{title}](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}>) on [{user}'s Message Wall](<{url}wiki/Message_Wall:{user_wall}>)").format(author=author, author_url=author_url, title=post["title"], url=settings["fandom_discussions"]["wiki_url"], user=user_wall, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"]) + event_type = "discussion/wall/post" + message = _("[{author}]({author_url}) created [{title}](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}>) on [{user}'s Message Wall](<{url}wiki/Message_Wall:{user_wall}>)").format(author=author, author_url=author_url, title=post["title"], url=settings["fandom_discussions"]["wiki_url"], user=user_wall, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"]) else: - message = "๐Ÿ“ฉ "+_("[{author}]({author_url}) created a [reply](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}#{replyId}>) to [{title}](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}>) on [{user}'s Message Wall](<{url}wiki/Message_Wall:{user_wall}>)").format(author=author, author_url=author_url, url=settings["fandom_discussions"]["wiki_url"], title=post["_embedded"]["thread"][0]["title"], user=user_wall, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"], replyId=post["id"]) + event_type = "discussion/wall/reply" + message = _("[{author}]({author_url}) created a [reply](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}#{replyId}>) to [{title}](<{url}wiki/Message_Wall:{user_wall}?threadId={threadId}>) on [{user}'s Message Wall](<{url}wiki/Message_Wall:{user_wall}>)").format(author=author, author_url=author_url, url=settings["fandom_discussions"]["wiki_url"], title=post["_embedded"]["thread"][0]["title"], user=user_wall, user_wall=quote_plus(user_wall.replace(" ", "_")), threadId=post["threadId"], replyId=post["id"]) elif post_type == "ARTICLE_COMMENT": if article_paths is None: article_paths = {"title": _("unknown"), "fullUrl": settings["fandom_discussions"]["wiki_url"]} # No page known article_paths["fullUrl"] = article_paths["fullUrl"].replace(")", "\)").replace("()", "\(") if not post["isReply"]: - message = "๐Ÿ—’๏ธ "+_( + event_type = "discussion/comment/post" + message = _( "[{author}]({author_url}) created a [comment](<{url}?commentId={commentId}>) on [{article}](<{url}>)").format( author=author, author_url=author_url, url=article_paths["fullUrl"], article=article_paths["title"], commentId=post["threadId"]) else: - message = "๐Ÿ—’๏ธ "+_( + event_type = "discussion/comment/reply" + message = _( "[{author}]({author_url}) created a [reply](<{url}?commentId={commentId}&replyId={replyId}>) to a [comment](<{url}?commentId={commentId}>) on [{article}](<{url}>)").format( author=author, author_url=author_url, url=article_paths["fullUrl"], article=article_paths["title"], commentId=post["threadId"], replyId=post["id"]) @@ -68,9 +79,12 @@ def compact_formatter(post_type, post, article_paths): if not settings["support"]: return else: - message = "โ“ "+_("Unknown event `{event}` by [{author}]({author_url}), report it on the [support server](<{support}>).").format( + message = _("Unknown event `{event}` by [{author}]({author_url}), report it on the [support server](<{support}>).").format( event=post_type, author=author, author_url=author_url, support=settings["support"]) - send_to_discord(DiscordMessage("compact", "discussion", settings["fandom_discussions"]["webhookURL"], content=message), meta=DiscordMessageMetadata("POST")) + event_type = "unknown" + if settings["event_appearance"].get(event_type, {"emoji": None})["emoji"]: + message = settings["event_appearance"][event_type]["emoji"] + " " + message + send_to_discord(DiscordMessage("compact", event_type, settings["fandom_discussions"]["webhookURL"], content=message), meta=DiscordMessageMetadata("POST")) def embed_formatter(post_type, post, article_paths): @@ -122,6 +136,7 @@ def embed_formatter(post_type, post, article_paths): embed.event_type = "discussion/forum/post" else: discussion_logger.warning("The type of {} is an unknown discussion post type. Please post an issue on the project page to have it added https://gitlab.com/piotrex43/RcGcDw/-/issues.".format(thread_funnel)) + embed.event_type = "unknown" if post["_embedded"]["thread"][0]["tags"]: tag_displayname = [] for tag in post["_embedded"]["thread"][0]["tags"]: @@ -161,7 +176,7 @@ def embed_formatter(post_type, post, article_paths): else: discussion_logger.warning("No entry for {event} with params: {params}".format(event=post_type, params=post)) embed["title"] = _("Unknown event `{event}`").format(event=post_type) - embed["color"] = 0 + embed.event_type = "unknown" if settings.get("support", None): change_params = "[```json\n{params}\n```]({support})".format(params=json.dumps(post, indent=2), support=settings["support"]) diff --git a/src/rc.py b/src/rc.py index bcc9c23..2accac9 100644 --- a/src/rc.py +++ b/src/rc.py @@ -29,7 +29,7 @@ supported_logs = {"protect/protect", "protect/modify", "protect/unprotect", "upl "curseprofile/comment-edited", "curseprofile/comment-deleted", "curseprofile/comment-purged", "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", + "managetags/deactivate", "cargo/createtable", "cargo/deletetable", "cargo/recreatetable", "cargo/replacetable", "upload/revert", "newusers/create", "newusers/autocreate", "newusers/create2", "newusers/byemail", "newusers/newusers", "managewiki/settings", "managewiki/delete", "managewiki/lock", "managewiki/unlock", diff --git a/src/rc_formatters.py b/src/rc_formatters.py index 05828aa..4424ba9 100644 --- a/src/rc_formatters.py +++ b/src/rc_formatters.py @@ -113,49 +113,49 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes if change["title"].startswith("MediaWiki:Tag-"): pass if action == "edit": - content = "๐Ÿ“ "+_("[{author}]({author_url}) edited [{article}]({edit_link}){comment} {bold}({sign}{edit_size}){bold}").format(author=author, author_url=author_url, article=change["title"], edit_link=edit_link, comment=parsed_comment, edit_size=edit_size, sign=sign, bold=bold) + content = _("[{author}]({author_url}) edited [{article}]({edit_link}){comment} {bold}({sign}{edit_size}){bold}").format(author=author, author_url=author_url, article=change["title"], edit_link=edit_link, comment=parsed_comment, edit_size=edit_size, sign=sign, bold=bold) else: - content = "๐Ÿ†• "+_("[{author}]({author_url}) created [{article}]({edit_link}){comment} {bold}({sign}{edit_size}){bold}").format(author=author, author_url=author_url, article=change["title"], edit_link=edit_link, comment=parsed_comment, edit_size=edit_size, sign=sign, bold=bold) + content = _("[{author}]({author_url}) created [{article}]({edit_link}){comment} {bold}({sign}{edit_size}){bold}").format(author=author, author_url=author_url, article=change["title"], edit_link=edit_link, comment=parsed_comment, edit_size=edit_size, sign=sign, bold=bold) elif action =="upload/upload": file_link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ–ผ๏ธ "+_("[{author}]({author_url}) uploaded [{file}]({file_link}){comment}").format(author=author, + content = _("[{author}]({author_url}) uploaded [{file}]({file_link}){comment}").format(author=author, author_url=author_url, file=change["title"], file_link=file_link, comment=parsed_comment) elif action == "upload/revert": file_link = link_formatter(create_article_path(change["title"])) - content = "โฎ๏ธ "+_("[{author}]({author_url}) reverted a version of [{file}]({file_link}){comment}").format( + content = _("[{author}]({author_url}) reverted a version of [{file}]({file_link}){comment}").format( author=author, author_url=author_url, file=change["title"], file_link=file_link, comment=parsed_comment) elif action == "upload/overwrite": file_link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ–ผ๏ธ "+_("[{author}]({author_url}) uploaded a new version of [{file}]({file_link}){comment}").format(author=author, author_url=author_url, file=change["title"], file_link=file_link, comment=parsed_comment) + content = _("[{author}]({author_url}) uploaded a new version of [{file}]({file_link}){comment}").format(author=author, author_url=author_url, file=change["title"], file_link=file_link, comment=parsed_comment) elif action == "delete/delete": page_link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ—‘๏ธ "+_("[{author}]({author_url}) deleted [{page}]({page_link}){comment}").format(author=author, author_url=author_url, page=change["title"], page_link=page_link, + content = _("[{author}]({author_url}) deleted [{page}]({page_link}){comment}").format(author=author, author_url=author_url, page=change["title"], page_link=page_link, comment=parsed_comment) if AUTO_SUPPRESSION_ENABLED: delete_messages(dict(pageid=change.get("pageid"))) elif action == "delete/delete_redir": page_link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ—‘๏ธ "+_("[{author}]({author_url}) deleted redirect by overwriting [{page}]({page_link}){comment}").format(author=author, author_url=author_url, page=change["title"], page_link=page_link, + content = _("[{author}]({author_url}) deleted redirect by overwriting [{page}]({page_link}){comment}").format(author=author, author_url=author_url, page=change["title"], page_link=page_link, comment=parsed_comment) if AUTO_SUPPRESSION_ENABLED: delete_messages(dict(pageid=change.get("pageid"))) elif action == "move/move": link = link_formatter(create_article_path(change["logparams"]['target_title'])) redirect_status = _("without making a redirect") if "suppressredirect" in change["logparams"] else _("with a redirect") - content = "๐Ÿ“จ "+_("[{author}]({author_url}) moved {redirect}*{article}* to [{target}]({target_url}) {made_a_redirect}{comment}").format(author=author, author_url=author_url, redirect="โคท " if "redirect" in change else "", article=change["title"], + content = _("[{author}]({author_url}) moved {redirect}*{article}* to [{target}]({target_url}) {made_a_redirect}{comment}").format(author=author, author_url=author_url, redirect="โคท " if "redirect" in change else "", article=change["title"], target=change["logparams"]['target_title'], target_url=link, comment=parsed_comment, made_a_redirect=redirect_status) elif action == "move/move_redir": link = link_formatter(create_article_path(change["logparams"]["target_title"])) redirect_status = _("without making a redirect") if "suppressredirect" in change["logparams"] else _( "with a redirect") - content = "๐Ÿ“จ "+_("[{author}]({author_url}) moved {redirect}*{article}* over redirect to [{target}]({target_url}) {made_a_redirect}{comment}").format(author=author, author_url=author_url, redirect="โคท " if "redirect" in change else "", article=change["title"], + content = _("[{author}]({author_url}) moved {redirect}*{article}* over redirect to [{target}]({target_url}) {made_a_redirect}{comment}").format(author=author, author_url=author_url, redirect="โคท " if "redirect" in change else "", article=change["title"], target=change["logparams"]['target_title'], target_url=link, comment=parsed_comment, made_a_redirect=redirect_status) elif action == "protect/move_prot": link = link_formatter(create_article_path(change["logparams"]["oldtitle_title"])) - content = "๐Ÿ” "+_( + content = _( "[{author}]({author_url}) moved protection settings from {redirect}*{article}* to [{target}]({target_url}){comment}").format(author=author, author_url=author_url, redirect="โคท " if "redirect" in change else "", article=change["logparams"]["oldtitle_title"], target=change["title"], target_url=link, comment=parsed_comment) elif action == "block/block": @@ -206,34 +206,34 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes if len(restriction_description) > 1020: logger.debug(restriction_description) restriction_description = restriction_description[:1020] + "โ€ฆ" - content = "๐Ÿšซ "+_( + content = _( "[{author}]({author_url}) blocked [{user}]({user_url}) {time}{restriction_desc}{comment}").format(author=author, author_url=author_url, user=user, time=block_time, user_url=link, restriction_desc=restriction_description, comment=parsed_comment) elif action == "block/reblock": link = link_formatter(create_article_path(change["title"])) user = change["title"].split(':', 1)[1] - content = "๐Ÿšซ "+_("[{author}]({author_url}) changed block settings for [{blocked_user}]({user_url}){comment}").format(author=author, author_url=author_url, blocked_user=user, user_url=link, comment=parsed_comment) + content = _("[{author}]({author_url}) changed block settings for [{blocked_user}]({user_url}){comment}").format(author=author, author_url=author_url, blocked_user=user, user_url=link, comment=parsed_comment) elif action == "block/unblock": link = link_formatter(create_article_path(change["title"])) user = change["title"].split(':', 1)[1] - content = "โœ… "+_("[{author}]({author_url}) unblocked [{blocked_user}]({user_url}){comment}").format(author=author, author_url=author_url, blocked_user=user, user_url=link, comment=parsed_comment) + content = _("[{author}]({author_url}) unblocked [{blocked_user}]({user_url}){comment}").format(author=author, author_url=author_url, blocked_user=user, user_url=link, comment=parsed_comment) elif action == "curseprofile/comment-created": link = link_formatter(create_article_path("Special:CommentPermalink/{commentid}".format(commentid=change["logparams"]["4:comment_id"]))) target_user = change["title"].split(':', 1)[1] if target_user != author: - content = "โœ‰๏ธ "+ _("[{author}]({author_url}) left a [comment]({comment}) on {target}'s profile".format(author=author, author_url=author_url, comment=link, target=target_user)) + content = _("[{author}]({author_url}) left a [comment]({comment}) on {target}'s profile".format(author=author, author_url=author_url, comment=link, target=target_user)) else: - content = "โœ‰๏ธ "+ _("[{author}]({author_url}) left a [comment]({comment}) on their own profile".format(author=author, author_url=author_url, comment=link)) + content = _("[{author}]({author_url}) left a [comment]({comment}) on their own profile".format(author=author, author_url=author_url, comment=link)) elif action == "curseprofile/comment-replied": link = link_formatter(create_article_path("Special:CommentPermalink/{commentid}".format(commentid=change["logparams"]["4:comment_id"]))) target_user = change["title"].split(':', 1)[1] if target_user != author: - content = "๐Ÿ“ฉ "+ _( + content = _( "[{author}]({author_url}) replied to a [comment]({comment}) on {target}'s profile".format(author=author, author_url=author_url, comment=link, target=target_user)) else: - content = "๐Ÿ“ฉ "+ _( + content = _( "[{author}]({author_url}) replied to a [comment]({comment}) on their own profile".format(author=author, comment=link, author_url=author_url)) @@ -241,22 +241,22 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes link = link_formatter(create_article_path("Special:CommentPermalink/{commentid}".format(commentid=change["logparams"]["4:comment_id"]))) target_user = change["title"].split(':', 1)[1] if target_user != author: - content = "๐Ÿ“ง "+ _( + content = _( "[{author}]({author_url}) edited a [comment]({comment}) on {target}'s profile".format(author=author, author_url=author_url, comment=link, target=target_user)) else: - content = "๐Ÿ“ง "+ _( + content = _( "[{author}]({author_url}) edited a [comment]({comment}) on their own profile".format(author=author, comment=link, author_url=author_url)) elif action == "curseprofile/comment-purged": target_user = change["title"].split(':', 1)[1] if target_user != author: - content = "๐Ÿ‘๏ธ " + _("[{author}]({author_url}) purged a comment on {target}'s profile".format(author=author, author_url=author_url,target=target_user)) + content = _("[{author}]({author_url}) purged a comment on {target}'s profile".format(author=author, author_url=author_url,target=target_user)) else: - content = "๐Ÿ‘๏ธ " + _("[{author}]({author_url}) purged a comment on their own profile".format(author=author, author_url=author_url)) + content = _("[{author}]({author_url}) purged a comment on their own profile".format(author=author, author_url=author_url)) elif action == "curseprofile/comment-deleted": if "4:comment_id" in change["logparams"]: link = link_formatter(create_article_path("Special:CommentPermalink/{commentid}".format(commentid=change["logparams"]["4:comment_id"]))) @@ -264,21 +264,21 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes link = link_formatter(create_article_path(change["title"])) target_user = change["title"].split(':', 1)[1] if target_user != author: - content = "๐Ÿ—‘๏ธ "+ _("[{author}]({author_url}) deleted a [comment]({comment}) on {target}'s profile".format(author=author,author_url=author_url, comment=link, target=target_user)) + content = _("[{author}]({author_url}) deleted a [comment]({comment}) on {target}'s profile".format(author=author,author_url=author_url, comment=link, target=target_user)) else: - content = "๐Ÿ—‘๏ธ "+ _("[{author}]({author_url}) deleted a [comment]({comment}) on their own profile".format(author=author, author_url=author_url, comment=link)) + content = _("[{author}]({author_url}) deleted a [comment]({comment}) on their own profile".format(author=author, author_url=author_url, comment=link)) elif action == "curseprofile/profile-edited": target_user = change["title"].split(':', 1)[1] link = link_formatter(create_article_path("UserProfile:{user}".format(user=target_user))) if target_user != author: - content = "๐Ÿ“Œ "+_("[{author}]({author_url}) edited the {field} on [{target}]({target_url})'s profile. *({desc})*").format(author=author, + content = _("[{author}]({author_url}) edited the {field} on [{target}]({target_url})'s profile. *({desc})*").format(author=author, author_url=author_url, target=target_user, target_url=link, field=profile_field_name(change["logparams"]['4:section'], False), desc=BeautifulSoup(change["parsedcomment"], "lxml").get_text()) else: - content = "๐Ÿ“Œ " + _("[{author}]({author_url}) edited the {field} on [their own]({target_url}) profile. *({desc})*").format( + content = _("[{author}]({author_url}) edited the {field} on [their own]({target_url}) profile. *({desc})*").format( author=author, author_url=author_url, target_url=link, @@ -298,21 +298,21 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes new_groups = [_("none")] if action == "rights/rights": - content = "๐Ÿ… "+_("[{author}]({author_url}) changed group membership for [{target}]({target_url}) from {old_groups} to {new_groups}{comment}").format(author=author, author_url=author_url, target=change["title"].split(":")[1], target_url=link, old_groups=", ".join(old_groups), new_groups=', '.join(new_groups), comment=parsed_comment) + content = _("[{author}]({author_url}) changed group membership for [{target}]({target_url}) from {old_groups} to {new_groups}{comment}").format(author=author, author_url=author_url, target=change["title"].split(":")[1], target_url=link, old_groups=", ".join(old_groups), new_groups=', '.join(new_groups), comment=parsed_comment) else: - content = "๐Ÿ… "+_("{author} autopromoted [{target}]({target_url}) from {old_groups} to {new_groups}{comment}").format( + content = _("{author} autopromoted [{target}]({target_url}) from {old_groups} to {new_groups}{comment}").format( author=_("System"), author_url=author_url, target=change["title"].split(":")[1], target_url=link, old_groups=", ".join(old_groups), new_groups=', '.join(new_groups), comment=parsed_comment) elif action == "protect/protect": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ”’ "+_("[{author}]({author_url}) protected [{article}]({article_url}) with the following settings: {settings}{comment}").format(author=author, author_url=author_url, + content = _("[{author}]({author_url}) protected [{article}]({article_url}) with the following settings: {settings}{comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, settings=change["logparams"]["description"]+(_(" [cascading]") if "cascade" in change["logparams"] else ""), comment=parsed_comment) elif action == "protect/modify": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ” "+_( + content = _( "[{author}]({author_url}) modified protection settings of [{article}]({article_url}) to: {settings}{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, @@ -320,11 +320,11 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes comment=parsed_comment) elif action == "protect/unprotect": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ”“ "+_("[{author}]({author_url}) removed protection from [{article}]({article_url}){comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment) + content = _("[{author}]({author_url}) removed protection from [{article}]({article_url}){comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment) elif action == "delete/revision": amount = len(change["logparams"]["ids"]) link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ‘๏ธ "+ngettext("[{author}]({author_url}) changed visibility of revision on page [{article}]({article_url}){comment}", + content = ngettext("[{author}]({author_url}) changed visibility of revision on page [{article}]({article_url}){comment}", "[{author}]({author_url}) changed visibility of {amount} revisions on page [{article}]({article_url}){comment}", amount).format(author=author, author_url=author_url, article=change["title"], article_url=link, amount=amount, comment=parsed_comment) if AUTO_SUPPRESSION_ENABLED: @@ -337,14 +337,14 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes delete_messages(dict(pageid=pageid)) elif action == "import/upload": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ“ฅ "+ngettext("[{author}]({author_url}) imported [{article}]({article_url}) with {count} revision{comment}", + content = ngettext("[{author}]({author_url}) imported [{article}]({article_url}) with {count} revision{comment}", "[{author}]({author_url}) imported [{article}]({article_url}) with {count} revisions{comment}", change["logparams"]["count"]).format( author=author, author_url=author_url, article=change["title"], article_url=link, count=change["logparams"]["count"], comment=parsed_comment) elif action == "delete/restore": link = link_formatter(create_article_path(change["title"])) - content = "โ™ป๏ธ "+_("[{author}]({author_url}) restored [{article}]({article_url}){comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment) + content = _("[{author}]({author_url}) restored [{article}]({article_url}){comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment) elif action == "delete/event": - content = "๐Ÿ‘๏ธ "+_("[{author}]({author_url}) changed visibility of log events{comment}").format(author=author, author_url=author_url, comment=parsed_comment) + content = _("[{author}]({author_url}) changed visibility of log events{comment}").format(author=author, author_url=author_url, comment=parsed_comment) if AUTO_SUPPRESSION_ENABLED: try: logparams = change["logparams"] @@ -356,131 +356,131 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "import/interwiki": link = link_formatter(create_article_path(change["title"])) source_link = link_formatter(create_article_path(change["logparams"]["interwiki_title"])) - content = "๐Ÿ“ฅ "+ngettext("[{author}]({author_url}) imported [{article}]({article_url}) with {count} revision from [{source}]({source_url}){comment}", + content = ngettext("[{author}]({author_url}) imported [{article}]({article_url}) with {count} revision from [{source}]({source_url}){comment}", "[{author}]({author_url}) imported [{article}]({article_url}) with {count} revisions from [{source}]({source_url}){comment}", change["logparams"]["count"]).format( author=author, author_url=author_url, article=change["title"], article_url=link, count=change["logparams"]["count"], source=change["logparams"]["interwiki_title"], source_url=source_link, comment=parsed_comment) elif action == "abusefilter/modify": link = link_formatter(create_article_path("Special:AbuseFilter/history/{number}/diff/prev/{historyid}".format(number=change["logparams"]['newId'], historyid=change["logparams"]["historyId"]))) - content = "๐Ÿ” "+_("[{author}]({author_url}) edited abuse filter [number {number}]({filter_url})").format(author=author, author_url=author_url, number=change["logparams"]['newId'], filter_url=link) + content = _("[{author}]({author_url}) edited abuse filter [number {number}]({filter_url})").format(author=author, author_url=author_url, number=change["logparams"]['newId'], filter_url=link) elif action == "abusefilter/create": link = link_formatter( create_article_path("Special:AbuseFilter/{number}".format(number=change["logparams"]['newId']))) - content = "๐Ÿ” "+_("[{author}]({author_url}) created abuse filter [number {number}]({filter_url})").format(author=author, author_url=author_url, number=change["logparams"]['newId'], filter_url=link) + content = _("[{author}]({author_url}) created abuse filter [number {number}]({filter_url})").format(author=author, author_url=author_url, number=change["logparams"]['newId'], filter_url=link) elif action == "merge/merge": link = link_formatter(create_article_path(change["title"])) link_dest = link_formatter(create_article_path(change["logparams"]["dest_title"])) - content = "๐Ÿ–‡๏ธ "+_("[{author}]({author_url}) merged revision histories of [{article}]({article_url}) into [{dest}]({dest_url}){comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, dest_url=link_dest, + content = _("[{author}]({author_url}) merged revision histories of [{article}]({article_url}) into [{dest}]({dest_url}){comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, dest_url=link_dest, dest=change["logparams"]["dest_title"], comment=parsed_comment) elif action == "newusers/autocreate": - content = "๐Ÿ—ฟ "+_("Account [{author}]({author_url}) was created automatically").format(author=author, author_url=author_url) + content = _("Account [{author}]({author_url}) was created automatically").format(author=author, author_url=author_url) elif action == "newusers/create": - content = "๐Ÿ—ฟ "+_("Account [{author}]({author_url}) was created").format(author=author, author_url=author_url) + content = _("Account [{author}]({author_url}) was created").format(author=author, author_url=author_url) elif action == "newusers/create2": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ—ฟ "+_("Account [{article}]({article_url}) was created by [{author}]({author_url}){comment}").format(article=change["title"], article_url=link, author=author, author_url=author_url, comment=parsed_comment) + content = _("Account [{article}]({article_url}) was created by [{author}]({author_url}){comment}").format(article=change["title"], article_url=link, author=author, author_url=author_url, comment=parsed_comment) elif action == "newusers/byemail": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ—ฟ "+_("Account [{article}]({article_url}) was created by [{author}]({author_url}) and password was sent by email{comment}").format(article=change["title"], article_url=link, author=author, author_url=author_url, comment=parsed_comment) + content = _("Account [{article}]({article_url}) was created by [{author}]({author_url}) and password was sent by email{comment}").format(article=change["title"], article_url=link, author=author, author_url=author_url, comment=parsed_comment) elif action == "newusers/newusers": - content = "๐Ÿ—ฟ "+_("Account [{author}]({author_url}) was created").format(author=author, author_url=author_url) + content = _("Account [{author}]({author_url}) was created").format(author=author, author_url=author_url) elif action == "interwiki/iw_add": link = link_formatter(create_article_path("Special:Interwiki")) - content = "๐Ÿ”— "+_("[{author}]({author_url}) added an entry to the [interwiki table]({table_url}) pointing to {website} with {prefix} prefix").format(author=author, author_url=author_url, desc=parsed_comment, + content = _("[{author}]({author_url}) added an entry to the [interwiki table]({table_url}) pointing to {website} with {prefix} prefix").format(author=author, author_url=author_url, desc=parsed_comment, prefix=change["logparams"]['0'], website=change["logparams"]['1'], table_url=link) elif action == "interwiki/iw_edit": link = link_formatter(create_article_path("Special:Interwiki")) - content = "๐Ÿ”— "+_("[{author}]({author_url}) edited an entry in [interwiki table]({table_url}) pointing to {website} with {prefix} prefix").format(author=author, author_url=author_url, desc=parsed_comment, + content = _("[{author}]({author_url}) edited an entry in [interwiki table]({table_url}) pointing to {website} with {prefix} prefix").format(author=author, author_url=author_url, desc=parsed_comment, prefix=change["logparams"]['0'], website=change["logparams"]['1'], table_url=link) elif action == "interwiki/iw_delete": link = link_formatter(create_article_path("Special:Interwiki")) - content = "๐Ÿ”— "+_("[{author}]({author_url}) deleted an entry in [interwiki table]({table_url})").format(author=author, author_url=author_url, table_url=link) + content = _("[{author}]({author_url}) deleted an entry in [interwiki table]({table_url})").format(author=author, author_url=author_url, table_url=link) elif action == "contentmodel/change": link = link_formatter(create_article_path(change["title"])) - content = "๐Ÿ“‹ "+_("[{author}]({author_url}) changed the content model of the page [{article}]({article_url}) from {old} to {new}{comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, old=change["logparams"]["oldmodel"], + content = _("[{author}]({author_url}) changed the content model of the page [{article}]({article_url}) from {old} to {new}{comment}").format(author=author, author_url=author_url, article=change["title"], article_url=link, old=change["logparams"]["oldmodel"], new=change["logparams"]["newmodel"], comment=parsed_comment) elif action == "sprite/sprite": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸชŸ "+_("[{author}]({author_url}) edited the sprite for [{article}]({article_url})").format(author=author, author_url=author_url, article=change["title"], article_url=link) + content = _("[{author}]({author_url}) edited the sprite for [{article}]({article_url})").format(author=author, author_url=author_url, article=change["title"], article_url=link) elif action == "sprite/sheet": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸชŸ "+_("[{author}]({author_url}) created the sprite sheet for [{article}]({article_url})").format(author=author, author_url=author_url, article=change["title"], article_url=link) + content = _("[{author}]({author_url}) created the sprite sheet for [{article}]({article_url})").format(author=author, author_url=author_url, article=change["title"], article_url=link) elif action == "sprite/slice": link = link_formatter(create_article_path(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) + 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"]) + 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) + 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) + content = _("[{author}]({author_url}) replaced the Cargo table \"{table}\"").format(author=author, author_url=author_url, table=table) elif action == "managetags/create": link = link_formatter(create_article_path("Special:Tags")) - 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) recent_changes.init_info() elif action == "managetags/delete": link = link_formatter(create_article_path("Special:Tags")) - content = "๐Ÿท๏ธ "+_("[{author}]({author_url}) deleted a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + content = _("[{author}]({author_url}) deleted a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) recent_changes.init_info() elif action == "managetags/activate": link = link_formatter(create_article_path("Special:Tags")) - content = "๐Ÿท๏ธ "+_("[{author}]({author_url}) activated a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + content = _("[{author}]({author_url}) activated a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) elif action == "managetags/deactivate": link = link_formatter(create_article_path("Special:Tags")) - content = "๐Ÿท๏ธ "+_("[{author}]({author_url}) deactivated a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) + content = _("[{author}]({author_url}) deactivated a [tag]({tag_url}) \"{tag}\"").format(author=author, author_url=author_url, tag=change["logparams"]["tag"], tag_url=link) elif action == "managewiki/settings": # Miraheze's ManageWiki extension https://github.com/miraheze/ManageWiki - content = "โš™๏ธ "+_("[{author}]({author_url}) changed wiki settings{reason}".format(author=author, author_url=author_url, reason=parsed_comment)) + content = _("[{author}]({author_url}) changed wiki settings{reason}".format(author=author, author_url=author_url, reason=parsed_comment)) elif action == "managewiki/delete": - content = "๐Ÿ—‘๏ธ "+_("[{author}]({author_url}) deleted a wiki *{wiki_name}*{comment}").format(author=author, author_url=author_url, + content = _("[{author}]({author_url}) deleted a wiki *{wiki_name}*{comment}").format(author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment) elif action == "managewiki/lock": - content = "๐Ÿ”’ "+_("[{author}]({author_url}) locked a wiki *{wiki_name}*{comment}").format( + content = _("[{author}]({author_url}) locked a wiki *{wiki_name}*{comment}").format( author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment) elif action == "managewiki/namespaces": - content = "๐Ÿ“ฆ "+_("[{author}]({author_url}) modified a namespace *{namespace_name}* on *{wiki_name}*{comment}").format( + content = _("[{author}]({author_url}) modified a namespace *{namespace_name}* on *{wiki_name}*{comment}").format( author=author, author_url=author_url, namespace_name=change["logparams"].get("namespace", _("Unknown")), wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment) elif action == "managewiki/namespaces-delete": - content = "๐Ÿ—‘๏ธ " + _( + content = _( "[{author}]({author_url}) deleted a namespace *{namespace_name}* on *{wiki_name}*{comment}").format( author=author, author_url=author_url, namespace_name=change["logparams"].get("namespace", _("Unknown")), wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment) elif action == "managewiki/rights": group_name = change["title"].split("/permissions/", 1)[1] - content = "๐Ÿ… " + _("[{author}]({author_url}) modified user group *{group_name}*{comment}").format( + content = _("[{author}]({author_url}) modified user group *{group_name}*{comment}").format( author=author, author_url=author_url, group_name=group_name, comment=parsed_comment ) elif action == "managewiki/undelete": - content = "๐Ÿ… " + _("[{author}]({author_url}) restored a wiki *{wiki_name}*{comment}").format( + content = _("[{author}]({author_url}) restored a wiki *{wiki_name}*{comment}").format( author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment ) elif action == "managewiki/unlock": - content = "๐Ÿ… " + _("[{author}]({author_url}) unlocked a wiki *{wiki_name}*{comment}").format( + content = _("[{author}]({author_url}) unlocked a wiki *{wiki_name}*{comment}").format( author=author, author_url=author_url, wiki_name=change["logparams"].get("wiki", _("Unknown")), comment=parsed_comment ) elif action == "datadump/generate": - content = "๐Ÿ… " + _("[{author}]({author_url}) generated *{file}* dump{comment}").format( + content = _("[{author}]({author_url}) generated *{file}* dump{comment}").format( author=author, author_url=author_url, file=change["logparams"]["filename"], comment=parsed_comment ) elif action == "datadump/delete": - content = "๐Ÿ… " + _("[{author}]({author_url}) deleted *{file}* dump{comment}").format( + content = _("[{author}]({author_url}) deleted *{file}* dump{comment}").format( author=author, author_url=author_url, file=change["logparams"]["filename"], comment=parsed_comment ) @@ -491,21 +491,21 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes else: link = link + "?oldid={}".format(change["logparams"]["revision"]) link = link_formatter(link) - content = "๐ŸŒ " + _("[{author}]({author_url}) marked [{article}]({article_url}) for translation{comment}").format( + content = _("[{author}]({author_url}) marked [{article}]({article_url}) for translation{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment ) elif action == "pagetranslation/unmark": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) removed [{article}]({article_url}) from the translation system{comment}").format( + content = _("[{author}]({author_url}) removed [{article}]({article_url}) from the translation system{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment ) elif action == "pagetranslation/moveok": link = link_formatter(create_article_path(change["logparams"]["target"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) completed moving translation pages from *{article}* to [{target}]({target_url}){comment}").format( + content = _("[{author}]({author_url}) completed moving translation pages from *{article}* to [{target}]({target_url}){comment}").format( author=author, author_url=author_url, article=change["title"], target=change["logparams"]["target"], target_url=link, comment=parsed_comment @@ -513,7 +513,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "pagetranslation/movenok": link = link_formatter(create_article_path(change["title"])) target_url = link_formatter(create_article_path(change["logparams"]["target"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) encountered a problem while moving [{article}]({article_url}) to [{target}]({target_url}){comment}").format( + content = _("[{author}]({author_url}) encountered a problem while moving [{article}]({article_url}) to [{target}]({target_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, target=change["logparams"]["target"], target_url=target_url, @@ -521,7 +521,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes ) elif action == "pagetranslation/deletefok": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) completed deletion of translatable page [{article}]({article_url}){comment}").format( + content = _("[{author}]({author_url}) completed deletion of translatable page [{article}]({article_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment @@ -529,7 +529,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "pagetranslation/deletefnok": link = link_formatter(create_article_path(change["title"])) target_url = link_formatter(create_article_path(change["logparams"]["target"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) failed to delete [{article}]({article_url}) which belongs to translatable page [{target}]({target_url}){comment}").format( + content = _("[{author}]({author_url}) failed to delete [{article}]({article_url}) which belongs to translatable page [{target}]({target_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, target=change["logparams"]["target"], target_url=target_url, @@ -537,7 +537,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes ) elif action == "pagetranslation/deletelok": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) completed deletion of translation page [{article}]({article_url}){comment}").format( + content = _("[{author}]({author_url}) completed deletion of translation page [{article}]({article_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment @@ -545,7 +545,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "pagetranslation/deletelnok": link = link_formatter(create_article_path(change["title"])) target_url = link_formatter(create_article_path(change["logparams"]["target"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) failed to delete [{article}]({article_url}) which belongs to translation page [{target}]({target_url}){comment}").format( + content = _("[{author}]({author_url}) failed to delete [{article}]({article_url}) which belongs to translation page [{target}]({target_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, target=change["logparams"]["target"], target_url=target_url, @@ -553,14 +553,14 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes ) elif action == "pagetranslation/encourage": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) encouraged translation of [{article}]({article_url}){comment}").format( + content = _("[{author}]({author_url}) encouraged translation of [{article}]({article_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment ) elif action == "pagetranslation/discourage": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) discouraged translation of [{article}]({article_url}){comment}").format( + content = _("[{author}]({author_url}) discouraged translation of [{article}]({article_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment @@ -570,33 +570,33 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes if "languages" in change["logparams"]: languages = "`, `".join(change["logparams"]["languages"].split(",")) if change["logparams"]["force"] == "on": - content = "๐ŸŒ " + _("[{author}]({author_url}) limited languages for [{article}]({article_url}) to `{languages}`{comment}").format( + content = _("[{author}]({author_url}) limited languages for [{article}]({article_url}) to `{languages}`{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, languages=languages, comment=parsed_comment ) else: - content = "๐ŸŒ " + _("[{author}]({author_url}) set the priority languages for [{article}]({article_url}) to `{languages}`{comment}").format( + content = _("[{author}]({author_url}) set the priority languages for [{article}]({article_url}) to `{languages}`{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, languages=languages, comment=parsed_comment ) else: - content = "๐ŸŒ " + _("[{author}]({author_url}) removed priority languages from [{article}]({article_url}){comment}").format( + content = _("[{author}]({author_url}) removed priority languages from [{article}]({article_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment ) elif action == "pagetranslation/associate": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) added translatable page [{article}]({article_url}) to aggregate group \"{group}\"{comment}").format( + content = _("[{author}]({author_url}) added translatable page [{article}]({article_url}) to aggregate group \"{group}\"{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, group=change["logparams"]["aggregategroup"], comment=parsed_comment ) elif action == "pagetranslation/dissociate": link = link_formatter(create_article_path(change["title"])) - content = "๐ŸŒ " + _("[{author}]({author_url}) removed translatable page [{article}]({article_url}) from aggregate group \"{group}\"{comment}").format( + content = _("[{author}]({author_url}) removed translatable page [{article}]({article_url}) from aggregate group \"{group}\"{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, group=change["logparams"]["aggregategroup"], comment=parsed_comment @@ -608,7 +608,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes else: link = link + "?oldid={}".format(change["logparams"]["revision"]) link = link_formatter(link) - content = "๐ŸŒ " + _("[{author}]({author_url}) reviewed translation [{article}]({article_url}){comment}").format( + content = _("[{author}]({author_url}) reviewed translation [{article}]({article_url}){comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, comment=parsed_comment @@ -616,14 +616,14 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes elif action == "translationreview/group": link = link_formatter(create_article_path(change["title"])) if "old-state" in change["logparams"]: - content = "๐ŸŒ " + _("[{author}]({author_url}) changed the state of `{language}` translations of [{article}]({article_url}) from `{old_state}` to `{new_state}`{comment}").format( + content = _("[{author}]({author_url}) changed the state of `{language}` translations of [{article}]({article_url}) from `{old_state}` to `{new_state}`{comment}").format( author=author, author_url=author_url, language=change["logparams"]["language"], article=change["logparams"]["group-label"], article_url=link, old_state=change["logparams"]["old-state"], new_state=change["logparams"]["new-state"], comment=parsed_comment ) else: - content = "๐ŸŒ " + _("[{author}]({author_url}) changed the state of `{language}` translations of [{article}]({article_url}) to `{new_state}`{comment}").format( + content = _("[{author}]({author_url}) changed the state of `{language}` translations of [{article}]({article_url}) to `{new_state}`{comment}").format( author=author, author_url=author_url, language=change["logparams"]["language"], article=change["logparams"]["group-label"], article_url=link, new_state=change["logparams"]["new-state"], comment=parsed_comment @@ -636,7 +636,7 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes new_lang = "`{}`".format(change["logparams"]["newlanguage"]) if change["logparams"]["newlanguage"][-5:] == "[def]": new_lang = "`{}` {}".format(change["logparams"]["oldlanguage"][:-5], _("(default)")) - content = "๐ŸŒ " + _("[{author}]({author_url}) changed the language of [{article}]({article_url}) from {old_lang} to {new_lang}{comment}").format( + content = _("[{author}]({author_url}) changed the language of [{article}]({article_url}) from {old_lang} to {new_lang}{comment}").format( author=author, author_url=author_url, article=change["title"], article_url=link, old_lang=old_lang, new_lang=new_lang, comment=parsed_comment @@ -645,24 +645,27 @@ def compact_formatter(action, change, parsed_comment, categories, recent_changes link = link_formatter(create_article_path("User:"+change["logparams"]["newuser"])) edits = change["logparams"]["edits"] if edits > 0: - content = "๐Ÿ“› " + ngettext("[{author}]({author_url}) renamed user *{old_name}* with {edits} edit to [{new_name}]({link}){comment}", + content = ngettext("[{author}]({author_url}) renamed user *{old_name}* with {edits} edit to [{new_name}]({link}){comment}", "[{author}]({author_url}) renamed user *{old_name}* with {edits} edits to [{new_name}]({link}){comment}", edits).format( author=author, author_url=author_url, old_name=change["logparams"]["olduser"], edits=edits, new_name=change["logparams"]["newuser"], link=link, comment=parsed_comment ) else: - content = "๐Ÿ“› " + _("[{author}]({author_url}) renamed user *{old_name}* to [{new_name}]({link}){comment}").format( + content = _("[{author}]({author_url}) renamed user *{old_name}* to [{new_name}]({link}){comment}").format( author=author, author_url=author_url, old_name=change["logparams"]["olduser"], new_name=change["logparams"]["newuser"], link=link, comment=parsed_comment ) elif action == "suppressed": - content = "๐Ÿ‘๏ธ "+_("An action has been hidden by administration.") + content = _("An action has been hidden by administration.") else: logger.warning("No entry for {event} with params: {params}".format(event=action, params=change)) if not settings.get("support", None): return else: - content = "โ“ "+_( + content = _( "Unknown event `{event}` by [{author}]({author_url}), report it on the [support server](<{support}>).").format( event=action, author=author, author_url=author_url, support=settings["support"]) + action = "unknown" + if settings["event_appearance"].get(action, {"emoji": None})["emoji"]: + content = settings["event_appearance"][action]["emoji"] + " " + content send_to_discord(DiscordMessage("compact", action, settings["webhookURL"], content=content), meta=request_metadata) def embed_abuselog_formatter(change, recent_changes): @@ -1242,7 +1245,7 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes): logger.warning("No entry for {event} with params: {params}".format(event=action, params=change)) link = create_article_path("Special:RecentChanges") embed["title"] = _("Unknown event `{event}`").format(event=action) - embed["color"] = 0 + embed.event_type = "unknown" if settings.get("support", None): change_params = "[```json\n{params}\n```]({support})".format(params=json.dumps(change, indent=2), support=settings["support"]) @@ -1250,7 +1253,6 @@ def embed_formatter(action, change, parsed_comment, categories, recent_changes): embed.add_field(_("Report this on the support server"), settings["support"]) else: embed.add_field(_("Report this on the support server"), change_params) - embed["author"]["icon_url"] = settings["appearance"]["embed"].get(action, {"icon": None})["icon"] embed["url"] = quote(link.replace(" ", "_"), "/:?=&") if parsed_comment is not None: embed["description"] = parsed_comment diff --git a/src/rcgcdw.py b/src/rcgcdw.py index e19622a..1970e18 100644 --- a/src/rcgcdw.py +++ b/src/rcgcdw.py @@ -146,8 +146,7 @@ def day_overview(): embed = DiscordMessage("embed", "daily_overview", settings["webhookURL"]) embed["title"] = _("Daily overview") embed["url"] = create_article_path("Special:Statistics") - embed.set_author(settings["wikiname"], create_article_path(""), - icon_url=settings["appearance"]["embed"]["daily_overview"]["icon"]) + embed.set_author(settings["wikiname"], create_article_path("")) if not result[0]: if not settings["send_empty_overview"]: return # no changes in this day