Skip to content

Commit 7a05d1c

Browse files
committed
Imrpove attachment handling
1 parent 8d29300 commit 7a05d1c

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

core/clients.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,15 @@ def append_log(self, message, channel_id='', type='thread_message'):
167167
},
168168
# message properties
169169
'content': message.content,
170-
'attachments': [i.url for i in message.attachments],
171-
'type': type
170+
'type': type,
171+
'attachments': [
172+
{
173+
'id': a.id,
174+
'filename': a.filename,
175+
'is_image': a.width is not None,
176+
'size': a.size,
177+
'url': a.url
178+
} for a in message.attachments ]
172179
}
173180
}
174181
return self.request(self.logs + f'/{channel_id}', method='PATCH', payload=payload)
@@ -253,18 +260,23 @@ async def append_log(self, message, channel_id='', type='thread_message'):
253260
payload = {
254261
'timestamp': str(message.created_at),
255262
'message_id': str(message.id),
256-
# author
257263
'author': {
258264
'id': str(message.author.id),
259265
'name': message.author.name,
260266
'discriminator': message.author.discriminator,
261267
'avatar_url': message.author.avatar_url,
262268
'mod': not isinstance(message.channel, discord.DMChannel),
263269
},
264-
# message properties
265270
'content': message.content,
266-
'attachments': [i.url for i in message.attachments],
267-
'type': type
271+
'type': type,
272+
'attachments': [
273+
{
274+
'id': a.id,
275+
'filename': a.filename,
276+
'is_image': a.width is not None,
277+
'size': a.size,
278+
'url': a.url
279+
} for a in message.attachments ]
268280
}
269281

270282
return await self.logs.find_one_and_update(

0 commit comments

Comments
 (0)