File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -197,8 +197,13 @@ class MessagePayload {
197197 waveform : file . waveform ,
198198 duration_secs : file . duration ,
199199 } ) ) ;
200+
201+ // Only passable during edits
200202 if ( Array . isArray ( this . options . attachments ) ) {
201- this . options . attachments . push ( ...( attachments ?? [ ] ) ) ;
203+ this . options . attachments = this . options . attachments
204+ // 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 ?? [ ] ) ;
202207 } else {
203208 this . options . attachments = attachments ;
204209 }
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ class TextBasedChannel {
8888 * @property {Array<(EmbedBuilder|Embed|APIEmbed)> } [embeds] The embeds for the message
8989 * @property {MessageMentionOptions } [allowedMentions] Which mentions should be parsed from the message content
9090 * (see {@link https://discord.com/developers/docs/resources/message#allowed-mentions-object here} for more details)
91- * @property {Array<(Attachment|AttachmentPayload|BufferResolvable)> } [files]
91+ * @property {Array<(Attachment|AttachmentPayload|BufferResolvable|FileBodyEncodable<APIAttachment>|Stream )> } [files]
9292 * The files to send with the message.
9393 * @property {Array<(ActionRowBuilder|MessageTopLevelComponent|APIMessageTopLevelComponent)> } [components]
9494 * Action rows containing interactive components for the message (buttons, select menus) and other
Original file line number Diff line number Diff line change @@ -6690,7 +6690,7 @@ export interface BaseMessageOptions {
66906690 ) [ ] ;
66916691 content ?: string ;
66926692 embeds ?: readonly ( APIEmbed | JSONEncodable < APIEmbed > ) [ ] ;
6693- files ?: readonly ( Attachment | AttachmentPayload | BufferResolvable | Stream ) [ ] ;
6693+ files ?: readonly ( Attachment | AttachmentPayload | BufferResolvable | FileBodyEncodable < APIAttachment > | Stream ) [ ] ;
66946694}
66956695
66966696export interface MessageOptionsPoll {
@@ -6736,12 +6736,8 @@ export interface GuildForumThreadMessageCreateOptions
67366736 MessageOptionsFlags ,
67376737 MessageOptionsStickers { }
67386738
6739- export interface MessageEditAttachmentData {
6740- id : Snowflake ;
6741- }
6742-
67436739export interface MessageEditOptions extends Omit < BaseMessageOptions , 'content' > {
6744- attachments ?: readonly ( Attachment | MessageEditAttachmentData ) [ ] ;
6740+ attachments ?: readonly ( Attachment | JSONEncodable < APIAttachment > ) [ ] ;
67456741 content ?: string | null ;
67466742 flags ?:
67476743 | BitFieldResolvable <
You can’t perform that action at this time.
0 commit comments