From 5bb0b3f48994f0798f1d7a2cc251a0c5e6fe3a8f Mon Sep 17 00:00:00 2001 From: Ske Date: Sat, 14 Jul 2018 23:22:06 +0200 Subject: [PATCH] Added escaping in system member list --- bot/pluralkit/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bot/pluralkit/utils.py b/bot/pluralkit/utils.py index 6178dfcb..8f56f84f 100644 --- a/bot/pluralkit/utils.py +++ b/bot/pluralkit/utils.py @@ -10,6 +10,8 @@ import humanize from pluralkit import db from pluralkit.bot import client, logger +def escape(s): + return s.replace("`", "\`") def generate_hid() -> str: return "".join(random.choices(string.ascii_lowercase, k=5)) @@ -224,7 +226,7 @@ async def generate_system_info_card(conn, system: asyncpg.Record) -> discord.Emb # Get names of all members member_texts = [] for member in await db.get_all_members(conn, system_id=system["id"]): - member_texts.append("{} (`{}`)".format(member["name"], member["hid"])) + member_texts.append("{} (`{}`)".format(escape(member["name"]), member["hid"])) if len(member_texts) > 0: card.add_field(name="Members", value="\n".join(