diff --git a/src/pluralkit/bot/embeds.py b/src/pluralkit/bot/embeds.py index f7454400..96b1efb4 100644 --- a/src/pluralkit/bot/embeds.py +++ b/src/pluralkit/bot/embeds.py @@ -185,7 +185,7 @@ async def get_message_contents(client: discord.Client, channel_id: int, message_ return None -async def message_card(client: discord.Client, message: db.MessageInfo): +async def message_card(client: discord.Client, message: db.MessageInfo, include_pronouns: bool = False): # Get the original sender of the messages try: original_sender = await client.get_user_info(message.sender) @@ -203,7 +203,10 @@ async def message_card(client: discord.Client, message: db.MessageInfo): system_value = "`{}`".format(message.system_hid) embed.add_field(name="System", value=system_value) - embed.add_field(name="Member", value="{} (`{}`)".format(message.name, message.hid)) + if include_pronouns and message.pronouns: + embed.add_field(name="Member", value="{} (`{}`)\n*(pronouns: **{}**)*".format(message.name, message.hid, message.pronouns)) + else: + embed.add_field(name="Member", value="{} (`{}`)".format(message.name, message.hid)) if original_sender: sender_name = "{}#{}".format(original_sender.name, original_sender.discriminator) diff --git a/src/pluralkit/bot/proxy.py b/src/pluralkit/bot/proxy.py index 4573fba0..6f556080 100644 --- a/src/pluralkit/bot/proxy.py +++ b/src/pluralkit/bot/proxy.py @@ -240,7 +240,7 @@ async def do_query_message(conn, client: discord.Client, queryer_id: int, messag return False # Then DM the queryer the message embed - card = await embeds.message_card(client, msg) + card = await embeds.message_card(client, msg, include_pronouns=True) user = client.get_user(queryer_id) if not user: # We couldn't find this user in the cache - bail diff --git a/src/pluralkit/db.py b/src/pluralkit/db.py index e721f24b..fc348e53 100644 --- a/src/pluralkit/db.py +++ b/src/pluralkit/db.py @@ -203,7 +203,7 @@ async def get_members_by_account(conn, account_id: int) -> List[ProxyMember]: and members.system = systems.id""", account_id) return [ProxyMember(**row) for row in rows] -class MessageInfo(namedtuple("MemberInfo", ["mid", "channel", "member", "sender", "name", "hid", "avatar_url", "system_name", "system_hid"])): +class MessageInfo(namedtuple("MemberInfo", ["mid", "channel", "member", "sender", "name", "hid", "avatar_url", "system_name", "system_hid", "pronouns"])): mid: int channel: int member: int @@ -213,6 +213,7 @@ class MessageInfo(namedtuple("MemberInfo", ["mid", "channel", "member", "sender" avatar_url: str system_name: str system_hid: str + pronouns: str def to_json(self): return { @@ -228,7 +229,7 @@ class MessageInfo(namedtuple("MemberInfo", ["mid", "channel", "member", "sender" async def get_message_by_sender_and_id(conn, message_id: int, sender_id: int) -> MessageInfo: row = await conn.fetchrow("""select messages.*, - members.name, members.hid, members.avatar_url, + members.name, members.hid, members.avatar_url, members.pronouns, systems.name as system_name, systems.hid as system_hid from messages, members, systems @@ -244,7 +245,7 @@ async def get_message_by_sender_and_id(conn, message_id: int, sender_id: int) -> async def get_message(conn, message_id: int) -> MessageInfo: row = await conn.fetchrow("""select messages.*, - members.name, members.hid, members.avatar_url, + members.name, members.hid, members.avatar_url, members.pronouns, systems.name as system_name, systems.hid as system_hid from messages, members, systems