diff --git a/src/formatters/rc.py b/src/formatters/rc.py index 837def3..f91d476 100644 --- a/src/formatters/rc.py +++ b/src/formatters/rc.py @@ -541,6 +541,19 @@ async def compact_formatter(action, change, parsed_comment, categories, recent_c article=change["logparams"]["group-label"], article_url=link, new_state=change["logparams"]["new-state"], comment=parsed_comment ) + elif action == "pagelang/pagelang": + link = link_formatter(create_article_path(change["title"], WIKI_ARTICLE_PATH)) + old_lang = "`{}`".format(change["logparams"]["oldlanguage"]) + if change["logparams"]["oldlanguage"][-5:] == "[def]": + old_lang = "`{}` {}".format(change["logparams"]["oldlanguage"][:-5], _("(default)")) + 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( + author=author, author_url=author_url, + article=change["title"], article_url=link, + old_lang=old_lang, new_lang=new_lang, comment=parsed_comment + ) elif action == "renameuser/renameuser": link = link_formatter(create_article_path("User:"+change["logparams"]["newuser"], WIKI_ARTICLE_PATH)) edits = change["logparams"]["edits"] @@ -1060,6 +1073,17 @@ async def embed_formatter(action, change, parsed_comment, categories, recent_cha if "old-state" in change["logparams"]: embed.add_field(_("Old state"), change["logparams"]["old-state"], inline=True) embed.add_field(_("New state"), change["logparams"]["new-state"], inline=True) + elif action == "pagelang/pagelang": + link = create_article_path(change["title"], WIKI_ARTICLE_PATH) + old_lang = "`{}`".format(change["logparams"]["oldlanguage"]) + if change["logparams"]["oldlanguage"][-5:] == "[def]": + old_lang = "`{}` {}".format(change["logparams"]["oldlanguage"][:-5], _("(default)")) + new_lang = "`{}`".format(change["logparams"]["newlanguage"]) + if change["logparams"]["newlanguage"][-5:] == "[def]": + new_lang = "`{}` {}".format(change["logparams"]["oldlanguage"][:-5], _("(default)")) + embed["title"] = _("Changed the language of \"{article}\"").format(article=change["title"]) + embed.add_field(_("Old language"), old_lang, inline=True) + embed.add_field(_("New language"), new_lang, inline=True) elif action == "renameuser/renameuser": edits = change["logparams"]["edits"] if edits > 0: diff --git a/src/wiki.py b/src/wiki.py index 8a46e6b..25421f2 100644 --- a/src/wiki.py +++ b/src/wiki.py @@ -54,7 +54,7 @@ class Wiki: @staticmethod async def fetch_feeds(wiki, session: aiohttp.ClientSession) -> aiohttp.ClientResponse: url_path = "{wiki}wikia.php".format(wiki=wiki) - params = {"controller": "DiscussionPost", "method": "getPosts", "sortDirection": "descending", "sortKey": "creation_date", "limit": 20} + params = {"controller": "DiscussionPost", "method": "getPosts", "includeCounters": "false", "sortDirection": "descending", "sortKey": "creation_date", "limit": 20} try: response = await session.get(url_path, params=params) response.raise_for_status()