File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,7 +34,6 @@ import {
3434 createDiscordMessageNonce ,
3535 resolveChannelId ,
3636 resolveDiscordChannel ,
37- stripUndefinedFields ,
3837 SUPPRESS_NOTIFICATIONS_FLAG ,
3938 type DiscordAllowedMentions ,
4039} from "./send.shared.js" ;
@@ -201,10 +200,7 @@ async function buildDiscordComponentPayload(params: {
201200 spec : DiscordComponentMessageSpec ;
202201 opts : DiscordComponentSendOpts ;
203202 accountId : string ;
204- } ) : Promise < {
205- body : ReturnType < typeof stripUndefinedFields > ;
206- buildResult : ReturnType < typeof buildDiscordComponentMessage > ;
207- } > {
203+ } ) {
208204 const messageReference = params . opts . reply
209205 ? { message_id : params . opts . reply . messageId , fail_if_not_exists : false }
210206 : undefined ;
@@ -260,10 +256,10 @@ async function buildDiscordComponentPayload(params: {
260256 ...( finalFlags ? { flags : finalFlags } : { } ) ,
261257 ...( files ? { files } : { } ) ,
262258 } ;
263- const body = stripUndefinedFields ( {
259+ const body = {
264260 ...serializePayload ( payload ) ,
265261 ...( messageReference ? { message_reference : messageReference } : { } ) ,
266- } ) ;
262+ } ;
267263
268264 return { body, buildResult } ;
269265}
Original file line number Diff line number Diff line change 88 type MessagePayloadObject ,
99 type TopLevelComponents ,
1010} from "./internal/discord.js" ;
11- import { stripUndefinedFields } from "./internal/undefined-fields.js" ;
1211
13- export { stripUndefinedFields } ;
12+ export { stripUndefinedFields } from "./internal/undefined-fields.js" ;
1413
1514const SUPPRESS_EMBEDS_FLAG = MessageFlags . SuppressEmbeds ;
1615export const SUPPRESS_NOTIFICATIONS_FLAG = MessageFlags . SuppressNotifications ;
@@ -123,14 +122,14 @@ export function buildDiscordMessageRequest(params: DiscordMessageRequestParams)
123122 params . endpoint === "create-message"
124123 ? ( params . nonce ?? createDiscordMessageNonce ( ) )
125124 : undefined ;
126- return stripUndefinedFields ( {
125+ return {
127126 ...serializePayload ( payload ) ,
128127 ...( params . replyTo
129128 ? { message_reference : { message_id : params . replyTo , fail_if_not_exists : false } }
130129 : { } ) ,
131- nonce,
132- enforce_nonce : nonce ? true : undefined ,
133- } ) ;
130+ ... ( nonce !== undefined ? { nonce } : { } ) ,
131+ ... ( nonce ? { enforce_nonce : true } : { } ) ,
132+ } ;
134133}
135134
136135function hasV2Components ( components ?: TopLevelComponents [ ] ) : boolean {
You can’t perform that action at this time.
0 commit comments