Skip to content

Commit

Permalink
Stream attachments from discord to log them
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen committed Jan 27, 2025
1 parent a542e39 commit 9b645f4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/embeds/MessageDeleteEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import EmbedWrapper from './EmbedWrapper.js';
import colors from '../util/colors.js';
import {AttachmentBuilder, escapeMarkdown} from 'discord.js';
import {EMBED_DESCRIPTION_LIMIT} from '../util/apiLimits.js';
import got from 'got';

export default class MessageDeleteEmbed extends EmbedWrapper {
#files = [];
Expand Down Expand Up @@ -31,8 +32,8 @@ export default class MessageDeleteEmbed extends EmbedWrapper {
}
}

for (const attachment of message.attachments.values()) {
this.#files.push(new AttachmentBuilder(attachment.attachment)
for (/** @type {import('discord.js').Attachment} */ const attachment of message.attachments.values()) {
this.#files.push(new AttachmentBuilder(got.stream(attachment.proxyURL))
.setDescription(attachment.description)
.setName(attachment.name)
.setSpoiler(true));
Expand All @@ -44,4 +45,4 @@ export default class MessageDeleteEmbed extends EmbedWrapper {
message.files = this.#files;
return message;
}
}
}

0 comments on commit 9b645f4

Please sign in to comment.