This commit is contained in:
DjDeveloperr 2021-03-29 05:41:21 -07:00
parent 5fc58bd901
commit b775d3e323
2 changed files with 8 additions and 5 deletions

View file

@ -112,6 +112,7 @@ export class Interaction extends SnowflakeBase {
deferred: boolean = false deferred: boolean = false
_httpRespond?: (d: InteractionResponsePayload) => unknown _httpRespond?: (d: InteractionResponsePayload) => unknown
_httpResponded?: boolean _httpResponded?: boolean
applicationID: string
constructor( constructor(
client: Client, client: Client,
@ -129,6 +130,7 @@ export class Interaction extends SnowflakeBase {
this.token = data.token this.token = data.token
this.member = others.member this.member = others.member
this.id = data.id this.id = data.id
this.applicationID = data.application_id
this.user = others.user this.user = others.user
this.data = data.data this.data = data.data
this.guild = others.guild this.guild = others.guild
@ -257,7 +259,7 @@ export class Interaction extends SnowflakeBase {
allowedMentions?: AllowedMentionsPayload allowedMentions?: AllowedMentionsPayload
}): Promise<Interaction> { }): Promise<Interaction> {
const url = WEBHOOK_MESSAGE( const url = WEBHOOK_MESSAGE(
this.client.user?.id as string, this.applicationID,
this.token, this.token,
'@original' '@original'
) )
@ -276,7 +278,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.client.user?.id as string, this.applicationID,
this.token, this.token,
'@original' '@original'
) )
@ -285,7 +287,7 @@ export class Interaction extends SnowflakeBase {
} }
get url(): string { get url(): string {
return `https://discord.com/api/v8/webhooks/${this.client.user?.id}/${this.token}` return `https://discord.com/api/v8/webhooks/${this.applicationID}/${this.token}`
} }
/** Send a followup message */ /** Send a followup message */
@ -367,7 +369,7 @@ export class Interaction extends SnowflakeBase {
): Promise<Interaction> { ): Promise<Interaction> {
await this.client.rest.patch( await this.client.rest.patch(
WEBHOOK_MESSAGE( WEBHOOK_MESSAGE(
this.client.user?.id as string, this.applicationID,
this.token ?? this.client.token, this.token ?? this.client.token,
typeof msg === 'string' ? msg : msg.id typeof msg === 'string' ? msg : msg.id
), ),
@ -380,7 +382,7 @@ export class Interaction extends SnowflakeBase {
async deleteMessage(msg: Message | string): Promise<Interaction> { async deleteMessage(msg: Message | string): Promise<Interaction> {
await this.client.rest.delete( await this.client.rest.delete(
WEBHOOK_MESSAGE( WEBHOOK_MESSAGE(
this.client.user?.id as string, this.applicationID,
this.token ?? this.client.token, this.token ?? this.client.token,
typeof msg === 'string' ? msg : msg.id typeof msg === 'string' ? msg : msg.id
) )

View file

@ -75,6 +75,7 @@ export interface InteractionPayload {
guild_id?: string guild_id?: string
/** ID of the Channel in which Interaction was invoked */ /** ID of the Channel in which Interaction was invoked */
channel_id?: string channel_id?: string
application_id: string
} }
export interface SlashCommandChoice { export interface SlashCommandChoice {