From 16f3d4bc56459da5565771a73cb758af6b9ac18d Mon Sep 17 00:00:00 2001 From: profitroll Date: Sun, 7 May 2023 09:57:35 +0200 Subject: [PATCH] Improved analytics --- cogs/analytics.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/cogs/analytics.py b/cogs/analytics.py index 9b36e1f..2e7ed11 100644 --- a/cogs/analytics.py +++ b/cogs/analytics.py @@ -19,10 +19,38 @@ class Analytics(commands.Cog): and (message.author.bot == False) and (message.author.system == False) ): + stickers = [] + for sticker in message.stickers: + stickers.append( + { + "id": sticker.id, + "name": sticker.name, + "format": sticker.format, + "url": sticker.url, + } + ) + + attachments = [] + for attachment in message.attachments: + attachments.append( + { + "content_type": attachment.content_type, + "description": attachment.description, + "filename": attachment.filename, + "is_spoiler": attachment.is_spoiler(), + "size": attachment.size, + "url": attachment.url, + "width": attachment.width, + "height": attachment.height, + } + ) + col_analytics.insert_one( { - "message": message.content, "user": message.author.id, "channel": message.channel.id, + "content": message.content, + "stickers": message.stickers, + "attachments": attachments, } )