Skip to content

Commit 0a5e09d

Browse files
committed
refactor: requested change
1 parent 0aa1b40 commit 0a5e09d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/discord.js/src/structures/MessagePayload.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,10 @@ class MessagePayload {
200200

201201
// Only passable during edits
202202
if (Array.isArray(this.options.attachments)) {
203-
this.options.attachments = this.options.attachments
203+
attachments.push(
204204
// Note how we don't check for file body encodable, since we aren't expecting file data here
205-
.map(attachment => (isJSONEncodable(attachment) ? attachment.toJSON() : attachment))
206-
.concat(attachments ?? []);
207-
} else {
208-
this.options.attachments = attachments;
205+
...this.options.attachments.map(attachment => (isJSONEncodable(attachment) ? attachment.toJSON() : attachment)),
206+
);
209207
}
210208

211209
let poll;
@@ -242,7 +240,7 @@ class MessagePayload {
242240
: allowedMentions,
243241
flags,
244242
message_reference,
245-
attachments: this.options.attachments,
243+
attachments,
246244
sticker_ids: this.options.stickers?.map(sticker => sticker.id ?? sticker),
247245
thread_name: threadName,
248246
applied_tags: appliedTags,

0 commit comments

Comments
 (0)