Add a link to the message itself in logged messages. Closes #17

This commit is contained in:
Ske 2018-09-15 15:06:55 +02:00
parent fd67945660
commit 4becc8a4e9
2 changed files with 5 additions and 10 deletions

View File

@ -32,9 +32,9 @@ class ChannelLogger:
return self.client.get_channel(str(log_channel))
async def send_to_log_channel(self, log_channel: discord.Channel, embed: discord.Embed):
async def send_to_log_channel(self, log_channel: discord.Channel, embed: discord.Embed, text: str = None):
try:
await self.client.send_message(log_channel, embed=embed)
await self.client.send_message(log_channel, embed=embed, content=text)
except discord.Forbidden:
# TODO: spew big error
self.logger.warning(
@ -75,9 +75,7 @@ class ChannelLogger:
embed.set_thumbnail(url=message_image)
message_link = "https://discordapp.com/channels/{}/{}/{}".format(server_id, channel_id, message_id)
embed.author.url = message_link
await self.send_to_log_channel(log_channel, embed)
await self.send_to_log_channel(log_channel, embed, message_link)
async def log_message_deleted(self, conn,
server_id: str,

View File

@ -1,15 +1,12 @@
import os
import discord
import logging
import re
import traceback
from typing import Tuple, Optional, Union
from pluralkit import db
from pluralkit.system import System
from pluralkit.member import Member
from pluralkit.bot import embeds, utils
from pluralkit.member import Member
from pluralkit.system import System
logger = logging.getLogger("pluralkit.bot.commands")