required changes

This commit is contained in:
DjDeveloperr 2021-04-04 10:11:00 +05:30
parent 82431168d3
commit 8bf2c1e99d

View file

@ -177,15 +177,15 @@ export class Interaction extends SnowflakeBase {
type: data.type ?? InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE, type: data.type ?? InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE,
data: data:
data.type === undefined || data.type === undefined ||
data.type === InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE || data.type === InteractionResponseType.CHANNEL_MESSAGE_WITH_SOURCE ||
data.type === InteractionResponseType.CHANNEL_MESSAGE data.type === InteractionResponseType.CHANNEL_MESSAGE
? { ? {
content: data.content ?? '', content: data.content ?? '',
embeds: data.embeds, embeds: data.embeds,
tts: data.tts ?? false, tts: data.tts ?? false,
flags, flags,
allowed_mentions: data.allowedMentions ?? undefined allowed_mentions: data.allowedMentions ?? undefined
} }
: undefined : undefined
} }
@ -239,7 +239,7 @@ export class Interaction extends SnowflakeBase {
content: options.content, content: options.content,
embeds: options.embeds, embeds: options.embeds,
flags: options.flags, flags: options.flags,
allowedMentions: options.allowedMentions, allowedMentions: options.allowedMentions
}) })
} else } else
await this.respond( await this.respond(
@ -258,11 +258,7 @@ export class Interaction extends SnowflakeBase {
flags?: number | number[] flags?: number | number[]
allowedMentions?: AllowedMentionsPayload allowedMentions?: AllowedMentionsPayload
}): Promise<Interaction> { }): Promise<Interaction> {
const url = WEBHOOK_MESSAGE( const url = WEBHOOK_MESSAGE(this.applicationID, this.token, '@original')
this.applicationID,
this.token,
'@original'
)
await this.client.rest.patch(url, { await this.client.rest.patch(url, {
content: data.content ?? '', content: data.content ?? '',
embeds: data.embeds ?? [], embeds: data.embeds ?? [],
@ -277,11 +273,7 @@ export class Interaction extends SnowflakeBase {
/** Delete the original Interaction Response */ /** Delete the original Interaction Response */
async deleteResponse(): Promise<Interaction> { async deleteResponse(): Promise<Interaction> {
const url = WEBHOOK_MESSAGE( const url = WEBHOOK_MESSAGE(this.applicationID, this.token, '@original')
this.applicationID,
this.token,
'@original'
)
await this.client.rest.delete(url) await this.client.rest.delete(url)
return this return this
} }
@ -315,8 +307,8 @@ export class Interaction extends SnowflakeBase {
(option as WebhookMessageOptions)?.embed !== undefined (option as WebhookMessageOptions)?.embed !== undefined
? [(option as WebhookMessageOptions).embed] ? [(option as WebhookMessageOptions).embed]
: (option as WebhookMessageOptions)?.embeds !== undefined : (option as WebhookMessageOptions)?.embeds !== undefined
? (option as WebhookMessageOptions).embeds ? (option as WebhookMessageOptions).embeds
: undefined, : undefined,
file: (option as WebhookMessageOptions)?.file, file: (option as WebhookMessageOptions)?.file,
files: (option as WebhookMessageOptions)?.files, files: (option as WebhookMessageOptions)?.files,
tts: (option as WebhookMessageOptions)?.tts, tts: (option as WebhookMessageOptions)?.tts,
@ -357,7 +349,7 @@ export class Interaction extends SnowflakeBase {
msg: Message | string, msg: Message | string,
data: { data: {
content?: string content?: string
embeds?: Embed[] embeds?: Array<Embed | EmbedPayload>
file?: any file?: any
allowed_mentions?: { allowed_mentions?: {
parse?: string parse?: string