Fix broken table names in Cargo compact messages.

This commit is contained in:
Pera Pisar 2024-08-23 20:14:11 +00:00
parent d4d50d3529
commit f50332d52f

View file

@ -36,10 +36,10 @@ def embed_cargo_createtable(ctx: Context, change: dict):
@formatter.compact(event="cargo/createtable")
def compact_cargo_createtable(ctx: Context, change: dict):
author, author_url = compact_author(ctx, change)
table = re.search(r"\[(.*?)]\(<(.*?)>\)", ctx.client.parse_links(change["logparams"]["0"]))
content = ctx._("[{author}]({author_url}) created the Cargo table \"{table}\"").format(author=author,
author_url=author_url,
table=table)
table_link = ctx.client.parse_links(change["logparams"]["0"])
content = ctx._("[{author}]({author_url}) created the Cargo table {table_link}").format(author=author,
author_url=author_url,
table_link=table_link)
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
@ -59,10 +59,10 @@ def embed_cargo_recreatetable(ctx: Context, change: dict):
@formatter.compact(event="cargo/recreatetable")
def compact_cargo_recreatetable(ctx: Context, change: dict):
author, author_url = compact_author(ctx, change)
table = re.search(r"\[(.*?)]\(<(.*?)>\)", ctx.client.parse_links(change["logparams"]["0"]))
content = ctx._("[{author}]({author_url}) recreated the Cargo table \"{table}\"").format(author=author,
author_url=author_url,
table=table)
table_link = ctx.client.parse_links(change["logparams"]["0"])
content = ctx._("[{author}]({author_url}) recreated the Cargo table {table_link}").format(author=author,
author_url=author_url,
table_link=table_link)
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)
@ -82,10 +82,10 @@ def embed_cargo_replacetable(ctx: Context, change: dict):
@formatter.compact(event="cargo/replacetable")
def compact_cargo_replacetable(ctx: Context, change: dict):
author, author_url = compact_author(ctx, change)
table = re.search(r"\[(.*?)]\(<(.*?)>\)", ctx.client.parse_links(change["logparams"]["0"]))
content = ctx._("[{author}]({author_url}) replaced the Cargo table \"{table}\"").format(author=author,
author_url=author_url,
table=table)
table_link = ctx.client.parse_links(change["logparams"]["0"])
content = ctx._("[{author}]({author_url}) replaced the Cargo table {table_link}").format(author=author,
author_url=author_url,
table_link=table_link)
return DiscordMessage(ctx.message_type, ctx.event, ctx.webhook_url, content=content)