mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-13 01:00:12 +00:00
Stop logging message contents in the database for privacy reasons. Please remove the 'content' column in the 'messages' table:
This commit is contained in:
parent
cae394b4e8
commit
ca662bd502
3 changed files with 18 additions and 9 deletions
|
|
@ -4,6 +4,17 @@ from pluralkit.bot.commands import *
|
|||
logger = logging.getLogger("pluralkit.commands")
|
||||
|
||||
|
||||
async def get_message_contents(client: discord.Client, channel_id: int, message_id: int):
|
||||
channel = client.get_channel(str(channel_id))
|
||||
if channel:
|
||||
try:
|
||||
original_message = await client.get_message(channel, str(message_id))
|
||||
return original_message.content or None
|
||||
except (discord.errors.Forbidden, discord.errors.NotFound):
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
async def message_info(ctx: CommandContext):
|
||||
mid_str = ctx.pop_str(CommandError("You must pass a message ID.", help=help.message_lookup))
|
||||
|
||||
|
|
@ -43,8 +54,9 @@ async def message_info(ctx: CommandContext):
|
|||
|
||||
embed.add_field(name="Sent by", value=sender_name)
|
||||
|
||||
if message.content: # Content can be empty string if there's an attachment
|
||||
embed.add_field(name="Content", value=message.content, inline=False)
|
||||
message_content = await get_message_contents(ctx.client, message.channel, message.mid)
|
||||
if message_content:
|
||||
embed.description = message_content
|
||||
|
||||
embed.set_author(name=message.name, icon_url=message.avatar_url or discord.Embed.Empty)
|
||||
|
||||
|
|
|
|||
|
|
@ -175,8 +175,7 @@ class Proxy:
|
|||
# Report webhook stats to Influx
|
||||
await self.stats.report_webhook(time.perf_counter() - time_before, True)
|
||||
|
||||
await db.add_message(conn, message["id"], message["channel_id"], member.id, original_message.author.id,
|
||||
text or "")
|
||||
await db.add_message(conn, message["id"], message["channel_id"], member.id, original_message.author.id)
|
||||
|
||||
try:
|
||||
await self.client.delete_message(original_message)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue