import type { ComponentBuilder, EmbedBuilder, ModalBuilder } from "@discordjs/builders"; import { APIAllowedMentions, APIButtonComponent, APIEmbed, APIInteraction, APIModalInteractionResponseCallbackData, APISelectMenuComponent, InteractionType, LocaleString } from "discord-api-types/v10"; import { PartialChannel, Permissions } from "../index.mjs"; import { InteractionGuildMember } from "../payloads/Member.mjs"; import User from "../payloads/User.mjs"; import type ApplicationCommandInteraction from "./ApplicationCommandInteraction.mjs"; import type AutocompleteInteraction from "./AutocompleteInteraction.mjs"; import type ButtonInteraction from "./ButtonComponentInteraction.mjs"; import type ChatInputInteraction from "./ChatInputInteraction.mjs"; import type MessageCommandInteraction from "./MessageCommandInteraction.mjs"; import type MessageComponentInteraction from "./MessageComponentInteraction.mjs"; import type ModalSubmitInteraction from "./ModalSubmitInteraction.mjs"; import type SelectMenuInteraction from "./SelectMenuComponentInteraction.mjs"; import type UserCommandInteraction from "./UserCommandInteraction.mjs"; import type PingInteraction from "./PingInteraction.mjs"; import AttachmentBuilder from "../basic/AttachmentBuilder.mjs"; export default class BaseInteraction { /** ID of the interaction */ id: string; /** A continuation token for responding to the interaction */ token: string; /** ID of the application this interaction is for */ applicationId: string; /** The channel it was sent from */ channel?: PartialChannel; /** The guild it was sent from */ guildId?: string; /** Guild member data for the invoking user, including permissions */ member?: InteractionGuildMember; /** User object for the invoking user */ user: User; /** The user id for the invoking user */ userId: string; /** The type of interaction */ type: InteractionType; /** Set of permissions the app or bot has within the channel the interaction was sent from */ applicationPermissions?: Permissions; /** The guild's preferred locale */ guildLocale?: LocaleString; constructor(interaction: APIInteraction); /** The webhook url for this interaction */ get webhookUrl(): string; /** The time the interaction was made */ get createdAt(): Date; /** * Indicates whether this interaction is a {@link ApplicationCommandInteraction}. */ isApplicationCommand(): this is ApplicationCommandInteraction; /** * Indicates whether this interaction is a {@link ChatInputInteraction}. */ isChatInputCommand(): this is ChatInputInteraction; /** * Indicates whether this interaction is a {@link UserCommandInteraction}. */ isUserCommand(): this is UserCommandInteraction; /** * Indicates whether this interaction is a {@link MessageCommandInteraction}. */ isMessageCommand(): this is MessageCommandInteraction; /** * Indicates whether this interaction is a {@link MessageComponentInteraction}. */ isMessageComponent(): this is MessageComponentInteraction; /** * Indicates whether this interaction is a {@link ButtonInteraction}. */ isButton(): this is ButtonInteraction; /** * Indicates whether this interaction is a {@link SelectMenuInteraction}. */ isSelectMenu(): this is SelectMenuInteraction; /** * Indicates whether this interaction is a {@link AutocompleteInteraction}. */ isAutocomplete(): this is AutocompleteInteraction; /** * Indicates whether this interaction is a {@link ModalSubmitInteraction}. */ isModalSubmit(): this is ModalSubmitInteraction; /** * Indicates whether this interaction is a {@link PingInteraction}. */ isPingInteraction(): this is PingInteraction; } export type InteractionResponseData = { /** The content of a message */ content?: string; /** The embeds of a message */ embeds?: (APIEmbed | EmbedBuilder)[]; /** The components of a message */ components?: (APIButtonComponent | APISelectMenuComponent | ComponentBuilder)[]; /** Is the message ephemeral? */ ephemeral?: boolean; /** Who can be mentioned? */ allowed_mentions?: APIAllowedMentions; /** The attachments to send */ attachments?: AttachmentBuilder[]; }; export type InteractionModalResponseData = APIModalInteractionResponseCallbackData | ModalBuilder;