Skip to content

Commit

Permalink
Add more types
Browse files Browse the repository at this point in the history
  • Loading branch information
FinlayDaG33k committed Feb 1, 2024
1 parent bc4f784 commit 7c98a33
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions discord/interaction/interaction.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Discord } from "../mod.ts";
import {Discord, DiscordInteraction, InteractionCallbackData, InteractionResponse} from "../mod.ts";

export class Interaction {
protected interaction: unknown;
protected interaction: DiscordInteraction;
private _hasReplied: boolean = false;

public constructor(opts: unknown) {
public constructor(opts: {interaction: DiscordInteraction}) {
this.interaction = opts.interaction;
}

Expand All @@ -21,20 +21,20 @@ export class Interaction {
*
* @param data
*/
protected async respond(data: unknown): Promise<void> {
protected async respond(data: InteractionResponse|InteractionCallbackData): Promise<void> {
if(!this._hasReplied) {
await Discord.getBot().helpers.sendInteractionResponse(
this.interaction.id,
this.interaction.token,
data
data as InteractionResponse
);
this._hasReplied = true;
return;
}

await Discord.getBot().helpers.editOriginalInteractionResponse(
this.interaction.token,
data
data as InteractionCallbackData
);
}
}

0 comments on commit 7c98a33

Please sign in to comment.