mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Update file mediawiki.py
This commit is contained in:
parent
c8e8cb47b6
commit
55f6b5478b
|
@ -787,11 +787,14 @@ def embed_import_interwiki(ctx, change):
|
||||||
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
embed = DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url)
|
||||||
embed_helper(ctx, embed, change)
|
embed_helper(ctx, embed, change)
|
||||||
embed["url"] = ctx.client.create_article_path(sanitize_to_url(change["title"]))
|
embed["url"] = ctx.client.create_article_path(sanitize_to_url(change["title"]))
|
||||||
|
if "count" in change["logparams"] and "interwiki_title" in change["logparams"]:
|
||||||
embed["title"] = ctx.ngettext("Imported {article} with {count} revision from \"{source}\"",
|
embed["title"] = ctx.ngettext("Imported {article} with {count} revision from \"{source}\"",
|
||||||
"Imported {article} with {count} revisions from \"{source}\"",
|
"Imported {article} with {count} revisions from \"{source}\"",
|
||||||
change["logparams"]["count"]).format(
|
change["logparams"]["count"]).format(
|
||||||
article=sanitize_to_markdown(change["title"]), count=change["logparams"]["count"],
|
article=sanitize_to_markdown(change["title"]), count=change["logparams"]["count"],
|
||||||
source=sanitize_to_markdown(change["logparams"]["interwiki_title"]))
|
source=sanitize_to_markdown(change["logparams"]["interwiki_title"]))
|
||||||
|
else:
|
||||||
|
embed["title"] = ctx._("Imported {article}").format(article=sanitize_to_markdown(change["title"]))
|
||||||
return embed
|
return embed
|
||||||
|
|
||||||
|
|
||||||
|
@ -799,8 +802,9 @@ def embed_import_interwiki(ctx, change):
|
||||||
def compact_import_interwiki(ctx, change):
|
def compact_import_interwiki(ctx, change):
|
||||||
link = clean_link(ctx.client.create_article_path(sanitize_to_url(change["title"])))
|
link = clean_link(ctx.client.create_article_path(sanitize_to_url(change["title"])))
|
||||||
author, author_url = compact_author(ctx, change)
|
author, author_url = compact_author(ctx, change)
|
||||||
source_link = clean_link(ctx.client.create_article_path(change["logparams"]["interwiki_title"]))
|
|
||||||
parsed_comment = compact_summary(ctx)
|
parsed_comment = compact_summary(ctx)
|
||||||
|
if "count" in change["logparams"] and "interwiki_title" in change["logparams"]:
|
||||||
|
source_link = clean_link(ctx.client.create_article_path(change["logparams"]["interwiki_title"]))
|
||||||
content = ctx.ngettext(
|
content = ctx.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} revision from [{source}]({source_url}){comment}",
|
||||||
"[{author}]({author_url}) imported [{article}]({article_url}) with {count} revisions from [{source}]({source_url}){comment}",
|
"[{author}]({author_url}) imported [{article}]({article_url}) with {count} revisions from [{source}]({source_url}){comment}",
|
||||||
|
@ -809,6 +813,10 @@ def compact_import_interwiki(ctx, change):
|
||||||
count=change["logparams"]["count"], source=sanitize_to_markdown(change["logparams"]["interwiki_title"]),
|
count=change["logparams"]["count"], source=sanitize_to_markdown(change["logparams"]["interwiki_title"]),
|
||||||
source_url=source_link,
|
source_url=source_link,
|
||||||
comment=parsed_comment)
|
comment=parsed_comment)
|
||||||
|
else:
|
||||||
|
content = ctx._("[{author}]({author_url}) imported [{article}]({article_url}){comment}").format(
|
||||||
|
author=author, author_url=author_url, article=sanitize_to_markdown(change["title"]), article_url=link,
|
||||||
|
comment=parsed_comment)
|
||||||
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue