From 90ae1de19e540fe3dc97945ee62c388781fccda9 Mon Sep 17 00:00:00 2001 From: Ske Date: Fri, 13 Jul 2018 21:52:16 +0200 Subject: [PATCH] Add link to message in log embed --- bot/pluralkit/proxy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot/pluralkit/proxy.py b/bot/pluralkit/proxy.py index a91815be..3fc5faea 100644 --- a/bot/pluralkit/proxy.py +++ b/bot/pluralkit/proxy.py @@ -9,15 +9,20 @@ from pluralkit import db from pluralkit.bot import client, logger async def log_message(original_message, hook_message, member, log_channel): + # hook_message is kinda broken, and doesn't include details from server or channel + # We rely on the fact that original_message must be in the same channel, this'll break if that changes + author_name = "#{}: {}".format(original_message.channel.name, member["name"]) if member["system_name"]: author_name += " ({})".format(member["system_name"]) + message_link = "https://discordapp.com/channels/{}/{}/{}".format(original_message.server.id, original_message.channel.id, hook_message.id) + embed = discord.Embed() embed.colour = discord.Colour.blue() embed.description = hook_message.clean_content embed.timestamp = hook_message.timestamp - embed.set_author(name=author_name, icon_url=member["avatar_url"] or discord.Embed.Empty) + embed.set_author(name=author_name, url=message_link, icon_url=member["avatar_url"] or discord.Embed.Empty) embed.set_footer(text="System ID: {} | Member ID: {} | Sender: {}#{} | Message ID: {}".format(member["system_hid"], member["hid"], original_message.author.name, original_message.author.discriminator, hook_message.id)) if len(hook_message.attachments) > 0: