oceanic.js 1.10.3-dev.c6c9f52 → 1.10.3-dev.ca8b6e8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/lib/Client.d.ts +99 -0
  2. package/dist/lib/Client.js +263 -0
  3. package/dist/lib/Constants.d.ts +1215 -0
  4. package/dist/lib/Constants.js +1513 -0
  5. package/dist/lib/gateway/Shard.d.ts +83 -0
  6. package/dist/lib/gateway/Shard.js +1621 -0
  7. package/dist/lib/gateway/ShardManager.d.ts +29 -0
  8. package/dist/lib/gateway/ShardManager.js +300 -0
  9. package/dist/lib/index.d.ts +84 -0
  10. package/dist/lib/index.js +168 -0
  11. package/dist/lib/rest/Bucket.d.ts +33 -0
  12. package/dist/lib/rest/Bucket.js +78 -0
  13. package/dist/lib/rest/DiscordHTTPError.d.ts +16 -0
  14. package/dist/lib/rest/DiscordHTTPError.js +65 -0
  15. package/dist/lib/rest/DiscordRESTError.d.ts +19 -0
  16. package/dist/lib/rest/DiscordRESTError.js +89 -0
  17. package/dist/lib/rest/OAuthHelper.d.ts +62 -0
  18. package/dist/lib/rest/OAuthHelper.js +183 -0
  19. package/dist/lib/rest/RESTManager.d.ts +42 -0
  20. package/dist/lib/rest/RESTManager.js +82 -0
  21. package/dist/lib/rest/RequestHandler.d.ts +28 -0
  22. package/dist/lib/rest/RequestHandler.js +313 -0
  23. package/dist/lib/rest/SequentialBucket.d.ts +25 -0
  24. package/dist/lib/rest/SequentialBucket.js +76 -0
  25. package/dist/lib/routes/Applications.d.ts +171 -0
  26. package/dist/lib/routes/Applications.js +447 -0
  27. package/dist/lib/routes/Channels.d.ts +408 -0
  28. package/dist/lib/routes/Channels.js +1160 -0
  29. package/dist/lib/routes/Guilds.d.ts +606 -0
  30. package/dist/lib/routes/Guilds.js +1669 -0
  31. package/dist/lib/routes/Interactions.d.ts +74 -0
  32. package/dist/lib/routes/Interactions.js +141 -0
  33. package/dist/lib/routes/Miscellaneous.d.ts +31 -0
  34. package/dist/lib/routes/Miscellaneous.js +69 -0
  35. package/dist/lib/routes/OAuth.d.ts +108 -0
  36. package/dist/lib/routes/OAuth.js +312 -0
  37. package/dist/lib/routes/Users.d.ts +32 -0
  38. package/dist/lib/routes/Users.js +59 -0
  39. package/dist/lib/routes/Webhooks.d.ts +128 -0
  40. package/dist/lib/routes/Webhooks.js +265 -0
  41. package/dist/lib/structures/AnnouncementChannel.d.ts +36 -0
  42. package/dist/lib/structures/AnnouncementChannel.js +47 -0
  43. package/dist/lib/structures/AnnouncementThreadChannel.d.ts +18 -0
  44. package/dist/lib/structures/AnnouncementThreadChannel.js +27 -0
  45. package/dist/lib/structures/Application.d.ts +102 -0
  46. package/dist/lib/structures/Application.js +189 -0
  47. package/dist/lib/structures/ApplicationCommand.d.ts +74 -0
  48. package/dist/lib/structures/ApplicationCommand.js +141 -0
  49. package/dist/lib/structures/Attachment.d.ts +34 -0
  50. package/dist/lib/structures/Attachment.js +64 -0
  51. package/dist/lib/structures/AuditLogEntry.d.ts +25 -0
  52. package/dist/lib/structures/AuditLogEntry.js +53 -0
  53. package/dist/lib/structures/AutoModerationRule.d.ts +49 -0
  54. package/dist/lib/structures/AutoModerationRule.js +139 -0
  55. package/dist/lib/structures/AutocompleteInteraction.d.ts +62 -0
  56. package/dist/lib/structures/AutocompleteInteraction.js +115 -0
  57. package/dist/lib/structures/Base.d.ts +20 -0
  58. package/dist/lib/structures/Base.js +58 -0
  59. package/dist/lib/structures/BaseEntitlement.d.ts +19 -0
  60. package/dist/lib/structures/BaseEntitlement.js +44 -0
  61. package/dist/lib/structures/CategoryChannel.d.ts +41 -0
  62. package/dist/lib/structures/CategoryChannel.js +105 -0
  63. package/dist/lib/structures/Channel.d.ts +20 -0
  64. package/dist/lib/structures/Channel.js +91 -0
  65. package/dist/lib/structures/ClientApplication.d.ts +153 -0
  66. package/dist/lib/structures/ClientApplication.js +220 -0
  67. package/dist/lib/structures/CommandInteraction.d.ts +127 -0
  68. package/dist/lib/structures/CommandInteraction.js +297 -0
  69. package/dist/lib/structures/ComponentInteraction.d.ts +137 -0
  70. package/dist/lib/structures/ComponentInteraction.js +311 -0
  71. package/dist/lib/structures/Entitlement.d.ts +12 -0
  72. package/dist/lib/structures/Entitlement.js +26 -0
  73. package/dist/lib/structures/ExtendedUser.d.ts +26 -0
  74. package/dist/lib/structures/ExtendedUser.js +57 -0
  75. package/dist/lib/structures/ForumChannel.d.ts +11 -0
  76. package/dist/lib/structures/ForumChannel.js +19 -0
  77. package/dist/lib/structures/GroupChannel.d.ts +62 -0
  78. package/dist/lib/structures/GroupChannel.js +133 -0
  79. package/dist/lib/structures/Guild.d.ts +654 -0
  80. package/dist/lib/structures/Guild.js +1319 -0
  81. package/dist/lib/structures/GuildChannel.d.ts +34 -0
  82. package/dist/lib/structures/GuildChannel.js +75 -0
  83. package/dist/lib/structures/GuildPreview.d.ts +50 -0
  84. package/dist/lib/structures/GuildPreview.js +119 -0
  85. package/dist/lib/structures/GuildScheduledEvent.d.ts +60 -0
  86. package/dist/lib/structures/GuildScheduledEvent.js +154 -0
  87. package/dist/lib/structures/GuildTemplate.d.ts +55 -0
  88. package/dist/lib/structures/GuildTemplate.js +126 -0
  89. package/dist/lib/structures/Integration.d.ts +54 -0
  90. package/dist/lib/structures/Integration.js +156 -0
  91. package/dist/lib/structures/Interaction.d.ts +40 -0
  92. package/dist/lib/structures/Interaction.js +90 -0
  93. package/dist/lib/structures/InteractionResolvedChannel.d.ts +28 -0
  94. package/dist/lib/structures/InteractionResolvedChannel.js +45 -0
  95. package/dist/lib/structures/Invite.d.ts +64 -0
  96. package/dist/lib/structures/Invite.js +193 -0
  97. package/dist/lib/structures/InviteGuild.d.ts +52 -0
  98. package/dist/lib/structures/InviteGuild.js +88 -0
  99. package/dist/lib/structures/MediaChannel.d.ts +11 -0
  100. package/dist/lib/structures/MediaChannel.js +19 -0
  101. package/dist/lib/structures/Member.d.ts +122 -0
  102. package/dist/lib/structures/Member.js +255 -0
  103. package/dist/lib/structures/Message.d.ts +194 -0
  104. package/dist/lib/structures/Message.js +477 -0
  105. package/dist/lib/structures/ModalSubmitInteraction.d.ts +128 -0
  106. package/dist/lib/structures/ModalSubmitInteraction.js +240 -0
  107. package/dist/lib/structures/OAuthApplication.d.ts +79 -0
  108. package/dist/lib/structures/OAuthApplication.js +210 -0
  109. package/dist/lib/structures/OAuthGuild.d.ts +35 -0
  110. package/dist/lib/structures/OAuthGuild.js +61 -0
  111. package/dist/lib/structures/PartialApplication.d.ts +30 -0
  112. package/dist/lib/structures/PartialApplication.js +67 -0
  113. package/dist/lib/structures/Permission.d.ts +21 -0
  114. package/dist/lib/structures/Permission.js +68 -0
  115. package/dist/lib/structures/PermissionOverwrite.d.ts +26 -0
  116. package/dist/lib/structures/PermissionOverwrite.js +49 -0
  117. package/dist/lib/structures/PingInteraction.d.ts +16 -0
  118. package/dist/lib/structures/PingInteraction.js +26 -0
  119. package/dist/lib/structures/Poll.d.ts +28 -0
  120. package/dist/lib/structures/Poll.js +78 -0
  121. package/dist/lib/structures/PrivateChannel.d.ts +90 -0
  122. package/dist/lib/structures/PrivateChannel.js +131 -0
  123. package/dist/lib/structures/PrivateThreadChannel.d.ts +18 -0
  124. package/dist/lib/structures/PrivateThreadChannel.js +27 -0
  125. package/dist/lib/structures/PublicThreadChannel.d.ts +21 -0
  126. package/dist/lib/structures/PublicThreadChannel.js +37 -0
  127. package/dist/lib/structures/Role.d.ts +52 -0
  128. package/dist/lib/structures/Role.js +137 -0
  129. package/dist/lib/structures/SKU.d.ts +32 -0
  130. package/dist/lib/structures/SKU.js +53 -0
  131. package/dist/lib/structures/StageChannel.d.ts +33 -0
  132. package/dist/lib/structures/StageChannel.js +44 -0
  133. package/dist/lib/structures/StageInstance.d.ts +36 -0
  134. package/dist/lib/structures/StageInstance.js +94 -0
  135. package/dist/lib/structures/Team.d.ts +22 -0
  136. package/dist/lib/structures/Team.js +67 -0
  137. package/dist/lib/structures/TestEntitlement.d.ts +10 -0
  138. package/dist/lib/structures/TestEntitlement.js +21 -0
  139. package/dist/lib/structures/TextChannel.d.ts +34 -0
  140. package/dist/lib/structures/TextChannel.js +46 -0
  141. package/dist/lib/structures/TextableChannel.d.ts +158 -0
  142. package/dist/lib/structures/TextableChannel.js +276 -0
  143. package/dist/lib/structures/TextableVoiceChannel.d.ts +39 -0
  144. package/dist/lib/structures/TextableVoiceChannel.js +81 -0
  145. package/dist/lib/structures/ThreadChannel.d.ts +159 -0
  146. package/dist/lib/structures/ThreadChannel.js +295 -0
  147. package/dist/lib/structures/ThreadOnlyChannel.d.ts +99 -0
  148. package/dist/lib/structures/ThreadOnlyChannel.js +233 -0
  149. package/dist/lib/structures/ThreadableChannel.d.ts +36 -0
  150. package/dist/lib/structures/ThreadableChannel.js +58 -0
  151. package/dist/lib/structures/UnavailableGuild.d.ts +11 -0
  152. package/dist/lib/structures/UnavailableGuild.js +21 -0
  153. package/dist/lib/structures/User.d.ts +82 -0
  154. package/dist/lib/structures/User.js +168 -0
  155. package/dist/lib/structures/VoiceChannel.d.ts +20 -0
  156. package/dist/lib/structures/VoiceChannel.js +35 -0
  157. package/dist/lib/structures/VoiceState.d.ts +51 -0
  158. package/dist/lib/structures/VoiceState.js +140 -0
  159. package/dist/lib/structures/Webhook.d.ts +129 -0
  160. package/dist/lib/structures/Webhook.js +206 -0
  161. package/dist/lib/types/applications.d.ts +466 -0
  162. package/dist/lib/types/audit-log.d.ts +122 -0
  163. package/dist/lib/types/auto-moderation.d.ts +99 -0
  164. package/dist/lib/types/channels.d.ts +1244 -0
  165. package/dist/lib/types/client.d.ts +228 -0
  166. package/dist/lib/types/events.d.ts +265 -0
  167. package/dist/lib/types/gateway-raw.d.ts +584 -0
  168. package/dist/lib/types/gateway.d.ts +351 -0
  169. package/dist/lib/types/guild-template.d.ts +33 -0
  170. package/dist/lib/types/guilds.d.ts +855 -0
  171. package/dist/lib/types/index.d.ts +18 -0
  172. package/dist/lib/types/interactions.d.ts +377 -0
  173. package/dist/lib/types/json.d.ts +742 -0
  174. package/dist/lib/types/misc.d.ts +28 -0
  175. package/dist/lib/types/oauth.d.ts +201 -0
  176. package/dist/lib/types/request-handler.d.ts +52 -0
  177. package/dist/lib/types/scheduled-events.d.ts +88 -0
  178. package/dist/lib/types/shared.d.ts +9 -0
  179. package/dist/lib/types/users.d.ts +45 -0
  180. package/dist/lib/types/voice.d.ts +45 -0
  181. package/dist/lib/types/webhooks.d.ts +74 -0
  182. package/dist/lib/util/Collection.d.ts +47 -0
  183. package/dist/lib/util/Collection.js +78 -0
  184. package/dist/lib/util/Errors.d.ts +29 -0
  185. package/dist/lib/util/Errors.js +56 -0
  186. package/dist/lib/util/Routes.d.ts +127 -0
  187. package/dist/lib/util/Routes.js +248 -0
  188. package/dist/lib/util/SimpleCollection.d.ts +12 -0
  189. package/dist/lib/util/SimpleCollection.js +81 -0
  190. package/dist/lib/util/TypedCollection.d.ts +24 -0
  191. package/dist/lib/util/TypedCollection.js +76 -0
  192. package/dist/lib/util/TypedEmitter.d.ts +19 -0
  193. package/dist/lib/util/TypedEmitter.js +19 -0
  194. package/dist/lib/util/Util.d.ts +58 -0
  195. package/dist/lib/util/Util.js +535 -0
  196. package/dist/lib/util/interactions/InteractionOptionsWrapper.d.ts +170 -0
  197. package/dist/lib/util/interactions/InteractionOptionsWrapper.js +213 -0
  198. package/dist/lib/util/interactions/MessageInteractionResponse.d.ts +24 -0
  199. package/dist/lib/util/interactions/MessageInteractionResponse.js +28 -0
  200. package/dist/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.d.ts +24 -0
  201. package/dist/lib/util/interactions/ModalSubmitInteractionComponentsWrapper.js +34 -0
  202. package/dist/lib/util/interactions/SelectMenuValuesWrapper.d.ts +60 -0
  203. package/dist/lib/util/interactions/SelectMenuValuesWrapper.js +124 -0
  204. package/dist/package.json +1 -1
  205. package/package.json +1 -1
@@ -0,0 +1,127 @@
1
+ /** @module CommandInteraction */
2
+ import Interaction from "./Interaction";
3
+ import Member from "./Member";
4
+ import Message from "./Message";
5
+ import User from "./User";
6
+ import type Guild from "./Guild";
7
+ import Permission from "./Permission";
8
+ import type PrivateChannel from "./PrivateChannel";
9
+ import type Entitlement from "./Entitlement";
10
+ import type TestEntitlement from "./TestEntitlement";
11
+ import { ApplicationCommandTypes, type InteractionTypes, type InteractionContextTypes } from "../Constants";
12
+ import type { ApplicationCommandInteractionData, InteractionContent, ModalData, RawApplicationCommandInteraction, InitialInteractionContent, InteractionGuild, AuthorizingIntegrationOwners, EditInteractionContent } from "../types/interactions";
13
+ import type Client from "../Client";
14
+ import type { AnyTextableGuildChannel, AnyInteractionChannel } from "../types/channels";
15
+ import type { JSONCommandInteraction } from "../types/json";
16
+ import type { Uncached } from "../types/shared";
17
+ import MessageInteractionResponse, { type FollowupMessageInteractionResponse, type InitialMessagedInteractionResponse } from "../util/interactions/MessageInteractionResponse";
18
+ /** Represents a command interaction. */
19
+ export default class CommandInteraction<T extends AnyInteractionChannel | Uncached = AnyInteractionChannel | Uncached, C extends ApplicationCommandTypes = ApplicationCommandTypes> extends Interaction {
20
+ private _cachedChannel;
21
+ private _cachedGuild?;
22
+ /** The permissions the bot has in the channel this interaction was sent from. If in a dm/group dm, this will contain `ATTACH_FILES`, `EMBED_LINKS`, and `MENTION_EVERYONE`. In addition, `USE_EXTERNAL_EMOJIS` will be included for DMs with the app's bot user. */
23
+ appPermissions: Permission;
24
+ /** Details about the authorizing user or server for the installation(s) relevant to the interaction. See [Discord's docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for more information. */
25
+ authorizingIntegrationOwners: AuthorizingIntegrationOwners;
26
+ /** The ID of the channel this interaction was sent from. */
27
+ channelID: string;
28
+ /** The context this interaction was sent from. */
29
+ context?: InteractionContextTypes;
30
+ /** The data associated with the interaction. */
31
+ data: ApplicationCommandInteractionData<T, C>;
32
+ /** The entitlements for the user that created this interaction, and the guild it was created in. */
33
+ entitlements: Array<Entitlement | TestEntitlement>;
34
+ /** The id of the guild this interaction was sent from, if applicable. */
35
+ guildID: T extends AnyTextableGuildChannel ? string : string | null;
36
+ /** The preferred [locale](https://discord.com/developers/docs/reference#locales) of the guild this interaction was sent from, if applicable. */
37
+ guildLocale: T extends AnyTextableGuildChannel ? string : string | undefined;
38
+ /** The partial guild this interaction was sent from, if applicable. */
39
+ guildPartial?: T extends AnyTextableGuildChannel ? InteractionGuild : InteractionGuild | undefined;
40
+ /** The [locale](https://discord.com/developers/docs/reference#locales) of the invoking user. */
41
+ locale: string;
42
+ /** The member associated with the invoking user, if this interaction is sent from a guild. */
43
+ member: T extends AnyTextableGuildChannel ? Member : Member | null;
44
+ /** The permissions of the member associated with the invoking user, if this interaction is sent from a guild. */
45
+ memberPermissions: T extends AnyTextableGuildChannel ? Permission : Permission | null;
46
+ type: InteractionTypes.APPLICATION_COMMAND;
47
+ /** The user that invoked this interaction. */
48
+ user: User;
49
+ constructor(data: RawApplicationCommandInteraction, client: Client);
50
+ /** The channel this interaction was sent from. */
51
+ get channel(): T extends AnyInteractionChannel ? T : undefined;
52
+ /** The guild this interaction was sent from, if applicable. This will throw an error if the guild is not cached. */
53
+ get guild(): T extends AnyTextableGuildChannel ? Guild : Guild | null;
54
+ /**
55
+ * Create a followup message. Note that the returned class is not a message. The message is located in the property {@link MessageInteractionResponse#message | message}.
56
+ * @param options The options for creating the followup message.
57
+ */
58
+ createFollowup(options: InteractionContent): Promise<FollowupMessageInteractionResponse<this>>;
59
+ /**
60
+ * Create a message through this interaction. This is an initial response, and more than one initial response cannot be used. Use {@link CommandInteraction#createFollowup | createFollowup}.
61
+ * Note that the returned class is not a message. This initial response does not return a message. You will need to call {@link MessageInteractionResponse#getMessage | MessageInteractionResponse#getMessage} on the returned class,
62
+ * or {@link CommandInteraction#getOriginal | getOriginal}.
63
+ * @note You cannot attach files in an initial response. Defer the interaction, then use {@link CommandInteraction#createFollowup | createFollowup}.
64
+ * @param options The options for the message.
65
+ */
66
+ createMessage(options: InitialInteractionContent): Promise<InitialMessagedInteractionResponse<this>>;
67
+ /**
68
+ * Respond to this interaction with a modal. This is an initial response, and more than one initial response cannot be used.
69
+ * @param options The options for the modal.
70
+ */
71
+ createModal(options: ModalData): Promise<void>;
72
+ /**
73
+ * Defer this interaction. This is an initial response, and more than one initial response cannot be used.
74
+ * @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with.
75
+ */
76
+ defer(flags?: number): Promise<void>;
77
+ /**
78
+ * Delete a follow-up message.
79
+ * @param messageID The ID of the message.
80
+ */
81
+ deleteFollowup(messageID: string): Promise<void>;
82
+ /**
83
+ * Delete the original interaction response.
84
+ */
85
+ deleteOriginal(): Promise<void>;
86
+ /**
87
+ * Edit a followup message.
88
+ * @param messageID The ID of the message.
89
+ * @param options The options for editing the followup message.
90
+ */
91
+ editFollowup(messageID: string, options: EditInteractionContent): Promise<Message<T>>;
92
+ /**
93
+ * Edit the original interaction response.
94
+ * @param options The options for editing the original message.
95
+ */
96
+ editOriginal(options: EditInteractionContent): Promise<Message<T>>;
97
+ /**
98
+ * Get a followup message.
99
+ * @param messageID The ID of the message.
100
+ */
101
+ getFollowup(messageID: string): Promise<Message<T>>;
102
+ /**
103
+ * Get the original interaction response.
104
+ */
105
+ getOriginal(): Promise<Message<T>>;
106
+ /** Whether this interaction belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
107
+ inCachedGuildChannel(): this is CommandInteraction<AnyTextableGuildChannel>;
108
+ /** Whether this interaction belongs to a private channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
109
+ inPrivateChannel(): this is CommandInteraction<PrivateChannel | Uncached>;
110
+ /** A type guard, checking if this command interaction is a {@link Constants~ApplicationCommandTypes.CHAT_INPUT | Chat Input} command. */
111
+ isChatInputCommand(): this is CommandInteraction<T, ApplicationCommandTypes.CHAT_INPUT>;
112
+ /** A type guard, checking if this command interaction is a {@link Constants~ApplicationCommandTypes.MESSAGE | Message} command. */
113
+ isMessageCommand(): this is CommandInteraction<T, ApplicationCommandTypes.MESSAGE>;
114
+ /** A type guard, checking if this command interaction is a {@link Constants~ApplicationCommandTypes.USER | User} command. */
115
+ isUserCommand(): this is CommandInteraction<T, ApplicationCommandTypes.USER>;
116
+ /** Show a "premium required" response to the user. This is an initial response, and more than one initial response cannot be used. */
117
+ premiumRequired(): Promise<void>;
118
+ /**
119
+ * Reply to this interaction. If the interaction hasn't been acknowledged, {@link CommandInteraction#createMessage | createMessage} is used. Else, {@link CommandInteraction#createFollowup | createFollowup} is used.
120
+ * Note the returned class is not a message. Depending on which method was used, the returned class may or may not have the sent message. {@link MessageInteractionResponse#hasMessage | hasMessage} can be used for type narrowing
121
+ * to check if {@link MessageInteractionResponse#message | message} is present. If it is not, the {@link MessageInteractionResponse#getMessage | getMessage} can be used.
122
+ * @note Due to atachments not being able to be sent in initial responses, attachments will cause a deferred response, if the interaction has not been acknowledged.
123
+ * @param options The options for the message.
124
+ */
125
+ reply(options: InteractionContent): Promise<MessageInteractionResponse<this>>;
126
+ toJSON(): JSONCommandInteraction;
127
+ }
@@ -0,0 +1,297 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /** @module CommandInteraction */
5
+ const Interaction_1 = tslib_1.__importDefault(require("./Interaction"));
6
+ const Attachment_1 = tslib_1.__importDefault(require("./Attachment"));
7
+ const Member_1 = tslib_1.__importDefault(require("./Member"));
8
+ const Message_1 = tslib_1.__importDefault(require("./Message"));
9
+ const Role_1 = tslib_1.__importDefault(require("./Role"));
10
+ const User_1 = tslib_1.__importDefault(require("./User"));
11
+ const Permission_1 = tslib_1.__importDefault(require("./Permission"));
12
+ const GuildChannel_1 = tslib_1.__importDefault(require("./GuildChannel"));
13
+ const InteractionResolvedChannel_1 = tslib_1.__importDefault(require("./InteractionResolvedChannel"));
14
+ const TypedCollection_1 = tslib_1.__importDefault(require("../util/TypedCollection"));
15
+ const Constants_1 = require("../Constants");
16
+ const InteractionOptionsWrapper_1 = tslib_1.__importDefault(require("../util/interactions/InteractionOptionsWrapper"));
17
+ const Errors_1 = require("../util/Errors");
18
+ const MessageInteractionResponse_1 = tslib_1.__importDefault(require("../util/interactions/MessageInteractionResponse"));
19
+ /** Represents a command interaction. */
20
+ class CommandInteraction extends Interaction_1.default {
21
+ _cachedChannel;
22
+ _cachedGuild;
23
+ /** The permissions the bot has in the channel this interaction was sent from. If in a dm/group dm, this will contain `ATTACH_FILES`, `EMBED_LINKS`, and `MENTION_EVERYONE`. In addition, `USE_EXTERNAL_EMOJIS` will be included for DMs with the app's bot user. */
24
+ appPermissions;
25
+ /** Details about the authorizing user or server for the installation(s) relevant to the interaction. See [Discord's docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for more information. */
26
+ authorizingIntegrationOwners;
27
+ /** The ID of the channel this interaction was sent from. */
28
+ channelID;
29
+ /** The context this interaction was sent from. */
30
+ context;
31
+ /** The data associated with the interaction. */
32
+ data;
33
+ /** The entitlements for the user that created this interaction, and the guild it was created in. */
34
+ entitlements;
35
+ /** The id of the guild this interaction was sent from, if applicable. */
36
+ guildID;
37
+ /** The preferred [locale](https://discord.com/developers/docs/reference#locales) of the guild this interaction was sent from, if applicable. */
38
+ guildLocale;
39
+ /** The partial guild this interaction was sent from, if applicable. */
40
+ guildPartial;
41
+ /** The [locale](https://discord.com/developers/docs/reference#locales) of the invoking user. */
42
+ locale;
43
+ /** The member associated with the invoking user, if this interaction is sent from a guild. */
44
+ member;
45
+ /** The permissions of the member associated with the invoking user, if this interaction is sent from a guild. */
46
+ memberPermissions;
47
+ /** The user that invoked this interaction. */
48
+ user;
49
+ constructor(data, client) {
50
+ super(data, client);
51
+ this.appPermissions = new Permission_1.default(data.app_permissions ?? "0");
52
+ this.authorizingIntegrationOwners = data.authorizing_integration_owners;
53
+ this.channelID = data.channel_id;
54
+ this.context = data.context;
55
+ const resolved = {
56
+ attachments: new TypedCollection_1.default(Attachment_1.default, client),
57
+ channels: new TypedCollection_1.default(InteractionResolvedChannel_1.default, client),
58
+ members: new TypedCollection_1.default(Member_1.default, client),
59
+ messages: new TypedCollection_1.default(Message_1.default, client),
60
+ roles: new TypedCollection_1.default(Role_1.default, client),
61
+ users: new TypedCollection_1.default(User_1.default, client)
62
+ };
63
+ this.entitlements = data.entitlements?.map(entitlement => client.util.updateEntitlement(entitlement)) ?? [];
64
+ this.guildID = (data.guild_id ?? null);
65
+ this.guildLocale = data.guild_locale;
66
+ this.guildPartial = data.guild;
67
+ this.locale = data.locale;
68
+ this.member = (data.member === undefined ? null : this.client.util.updateMember(data.guild_id, data.member.user.id, data.member));
69
+ this.memberPermissions = (data.member === undefined ? null : new Permission_1.default(data.member.permissions));
70
+ this.user = client.users.update((data.user ?? data.member.user));
71
+ if (data.data.resolved) {
72
+ if (data.data.resolved.attachments) {
73
+ for (const attachment of Object.values(data.data.resolved.attachments))
74
+ resolved.attachments.update(attachment);
75
+ }
76
+ if (data.data.resolved.channels) {
77
+ for (const channel of Object.values(data.data.resolved.channels))
78
+ resolved.channels.update(channel);
79
+ }
80
+ if (data.data.resolved.members) {
81
+ for (const [id, member] of Object.entries(data.data.resolved.members)) {
82
+ const m = member;
83
+ m.user = data.data.resolved.users[id];
84
+ resolved.members.add(client.util.updateMember(data.guild_id, id, m));
85
+ }
86
+ }
87
+ if (data.data.resolved.messages) {
88
+ for (const message of Object.values(data.data.resolved.messages)) {
89
+ const channel = client.getChannel(message.channel_id);
90
+ if (channel && "messages" in channel) {
91
+ resolved.messages.add(channel.messages.update(message));
92
+ }
93
+ else {
94
+ resolved.messages.update(message);
95
+ }
96
+ }
97
+ }
98
+ if (data.data.resolved.roles) {
99
+ for (const role of Object.values(data.data.resolved.roles)) {
100
+ try {
101
+ resolved.roles.add(this.guild?.roles.update(role, this.guildID) ?? new Role_1.default(role, client, this.guildID));
102
+ }
103
+ catch {
104
+ resolved.roles.add(new Role_1.default(role, client, this.guildID));
105
+ }
106
+ }
107
+ }
108
+ if (data.data.resolved.users) {
109
+ for (const user of Object.values(data.data.resolved.users))
110
+ resolved.users.add(client.users.update(user));
111
+ }
112
+ }
113
+ this.data = {
114
+ guildID: data.data.guild_id,
115
+ id: data.data.id,
116
+ name: data.data.name,
117
+ options: new InteractionOptionsWrapper_1.default(data.data.options ?? [], resolved ?? null),
118
+ resolved,
119
+ target: null,
120
+ targetID: data.data.target_id,
121
+ type: data.data.type
122
+ };
123
+ if (this.data.targetID) {
124
+ if (this.data.type === Constants_1.ApplicationCommandTypes.USER) {
125
+ this.data.target = resolved.users.get(this.data.targetID);
126
+ }
127
+ else if (this.data.type === Constants_1.ApplicationCommandTypes.MESSAGE) {
128
+ this.data.target = resolved.messages.get(this.data.targetID);
129
+ }
130
+ }
131
+ }
132
+ /** The channel this interaction was sent from. */
133
+ get channel() {
134
+ return this._cachedChannel ??= this.client.getChannel(this.channelID);
135
+ }
136
+ /** The guild this interaction was sent from, if applicable. This will throw an error if the guild is not cached. */
137
+ get guild() {
138
+ if (this.guildID !== null && this._cachedGuild !== null) {
139
+ this._cachedGuild ??= this.client.guilds.get(this.guildID);
140
+ if (!this._cachedGuild) {
141
+ throw new Errors_1.UncachedError(this, "guild", "GUILDS", this.client);
142
+ }
143
+ return this._cachedGuild;
144
+ }
145
+ return this._cachedGuild === null ? this._cachedGuild : (this._cachedGuild = null);
146
+ }
147
+ /**
148
+ * Create a followup message. Note that the returned class is not a message. The message is located in the property {@link MessageInteractionResponse#message | message}.
149
+ * @param options The options for creating the followup message.
150
+ */
151
+ async createFollowup(options) {
152
+ const message = await this.client.rest.interactions.createFollowupMessage(this.applicationID, this.token, options);
153
+ return new MessageInteractionResponse_1.default(this, message, "followup");
154
+ }
155
+ /**
156
+ * Create a message through this interaction. This is an initial response, and more than one initial response cannot be used. Use {@link CommandInteraction#createFollowup | createFollowup}.
157
+ * Note that the returned class is not a message. This initial response does not return a message. You will need to call {@link MessageInteractionResponse#getMessage | MessageInteractionResponse#getMessage} on the returned class,
158
+ * or {@link CommandInteraction#getOriginal | getOriginal}.
159
+ * @note You cannot attach files in an initial response. Defer the interaction, then use {@link CommandInteraction#createFollowup | createFollowup}.
160
+ * @param options The options for the message.
161
+ */
162
+ async createMessage(options) {
163
+ if (this.acknowledged) {
164
+ throw new TypeError("Interactions cannot have more than one initial response.");
165
+ }
166
+ if ("files" in options && options.files.length !== 0) {
167
+ this.client.emit("warn", "You cannot attach files in an initial response. Defer the interaction, then use createFollowup.");
168
+ }
169
+ this.acknowledged = true;
170
+ await this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.CHANNEL_MESSAGE_WITH_SOURCE, data: options });
171
+ return new MessageInteractionResponse_1.default(this, null, "initial");
172
+ }
173
+ /**
174
+ * Respond to this interaction with a modal. This is an initial response, and more than one initial response cannot be used.
175
+ * @param options The options for the modal.
176
+ */
177
+ async createModal(options) {
178
+ if (this.acknowledged) {
179
+ throw new TypeError("Interactions cannot have more than one initial response.");
180
+ }
181
+ this.acknowledged = true;
182
+ return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.MODAL, data: options });
183
+ }
184
+ /**
185
+ * Defer this interaction. This is an initial response, and more than one initial response cannot be used.
186
+ * @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with.
187
+ */
188
+ async defer(flags) {
189
+ if (this.acknowledged) {
190
+ throw new TypeError("Interactions cannot have more than one initial response.");
191
+ }
192
+ this.acknowledged = true;
193
+ return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE, data: { flags } });
194
+ }
195
+ /**
196
+ * Delete a follow-up message.
197
+ * @param messageID The ID of the message.
198
+ */
199
+ async deleteFollowup(messageID) {
200
+ return this.client.rest.interactions.deleteFollowupMessage(this.applicationID, this.token, messageID);
201
+ }
202
+ /**
203
+ * Delete the original interaction response.
204
+ */
205
+ async deleteOriginal() {
206
+ return this.client.rest.interactions.deleteOriginalMessage(this.applicationID, this.token);
207
+ }
208
+ /**
209
+ * Edit a followup message.
210
+ * @param messageID The ID of the message.
211
+ * @param options The options for editing the followup message.
212
+ */
213
+ async editFollowup(messageID, options) {
214
+ return this.client.rest.interactions.editFollowupMessage(this.applicationID, this.token, messageID, options);
215
+ }
216
+ /**
217
+ * Edit the original interaction response.
218
+ * @param options The options for editing the original message.
219
+ */
220
+ async editOriginal(options) {
221
+ return this.client.rest.interactions.editOriginalMessage(this.applicationID, this.token, options);
222
+ }
223
+ /**
224
+ * Get a followup message.
225
+ * @param messageID The ID of the message.
226
+ */
227
+ async getFollowup(messageID) {
228
+ return this.client.rest.interactions.getFollowupMessage(this.applicationID, this.token, messageID);
229
+ }
230
+ /**
231
+ * Get the original interaction response.
232
+ */
233
+ async getOriginal() {
234
+ return this.client.rest.interactions.getOriginalMessage(this.applicationID, this.token);
235
+ }
236
+ /** Whether this interaction belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
237
+ inCachedGuildChannel() {
238
+ return this.channel instanceof GuildChannel_1.default;
239
+ }
240
+ /** Whether this interaction belongs to a private channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
241
+ inPrivateChannel() {
242
+ return this.guildID === null;
243
+ }
244
+ /** A type guard, checking if this command interaction is a {@link Constants~ApplicationCommandTypes.CHAT_INPUT | Chat Input} command. */
245
+ isChatInputCommand() {
246
+ return this.data.type === Constants_1.ApplicationCommandTypes.CHAT_INPUT;
247
+ }
248
+ /** A type guard, checking if this command interaction is a {@link Constants~ApplicationCommandTypes.MESSAGE | Message} command. */
249
+ isMessageCommand() {
250
+ return this.data.type === Constants_1.ApplicationCommandTypes.MESSAGE;
251
+ }
252
+ /** A type guard, checking if this command interaction is a {@link Constants~ApplicationCommandTypes.USER | User} command. */
253
+ isUserCommand() {
254
+ return this.data.type === Constants_1.ApplicationCommandTypes.USER;
255
+ }
256
+ /** Show a "premium required" response to the user. This is an initial response, and more than one initial response cannot be used. */
257
+ async premiumRequired() {
258
+ if (this.acknowledged) {
259
+ throw new TypeError("Interactions cannot have more than one initial response.");
260
+ }
261
+ this.acknowledged = true;
262
+ return this.client.rest.interactions.createInteractionResponse(this.id, this.token, { type: Constants_1.InteractionResponseTypes.PREMIUM_REQUIRED, data: {} });
263
+ }
264
+ /**
265
+ * Reply to this interaction. If the interaction hasn't been acknowledged, {@link CommandInteraction#createMessage | createMessage} is used. Else, {@link CommandInteraction#createFollowup | createFollowup} is used.
266
+ * Note the returned class is not a message. Depending on which method was used, the returned class may or may not have the sent message. {@link MessageInteractionResponse#hasMessage | hasMessage} can be used for type narrowing
267
+ * to check if {@link MessageInteractionResponse#message | message} is present. If it is not, the {@link MessageInteractionResponse#getMessage | getMessage} can be used.
268
+ * @note Due to atachments not being able to be sent in initial responses, attachments will cause a deferred response, if the interaction has not been acknowledged.
269
+ * @param options The options for the message.
270
+ */
271
+ async reply(options) {
272
+ let useFollowup = this.acknowledged;
273
+ if (!useFollowup && options.files && options.files.length !== 0) {
274
+ await this.defer(options.flags);
275
+ useFollowup = true;
276
+ }
277
+ return useFollowup ? this.createFollowup(options) : this.createMessage(options);
278
+ }
279
+ toJSON() {
280
+ return {
281
+ ...super.toJSON(),
282
+ appPermissions: this.appPermissions.toJSON(),
283
+ authorizingIntegrationOwners: this.authorizingIntegrationOwners,
284
+ channelID: this.channelID,
285
+ context: this.context,
286
+ data: this.data,
287
+ guildID: this.guildID ?? undefined,
288
+ guildLocale: this.guildLocale,
289
+ locale: this.locale,
290
+ member: this.member?.toJSON(),
291
+ type: this.type,
292
+ user: this.user.toJSON()
293
+ };
294
+ }
295
+ }
296
+ exports.default = CommandInteraction;
297
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29tbWF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QyxPQUFPLENBQUMsQ0FBQztJQUNwRixDQUFDO0lBRVEsTUFBTTtRQUNYLE9BQU87WUFDSCxHQUFHLEtBQUssQ0FBQyxNQUFNLEVBQUU7WUFDakIsY0FBYyxFQUFnQixJQUFJLENBQUMsY0FBYyxDQUFDLE1BQU0sRUFBRTtZQUMxRCw0QkFBNEIsRUFBRSxJQUFJLENBQUMsNEJBQTRCO1lBQy9ELFNBQVMsRUFBcUIsSUFBSSxDQUFDLFNBQVM7WUFDNUMsT0FBTyxFQUF1QixJQUFJLENBQUMsT0FBTztZQUMxQyxJQUFJLEVBQTBCLElBQUksQ0FBQyxJQUFJO1lBQ3ZDLE9BQU8sRUFBdUIsSUFBSSxDQUFDLE9BQU8sSUFBSSxTQUFTO1lBQ3ZELFdBQVcsRUFBbUIsSUFBSSxDQUFDLFdBQVc7WUFDOUMsTUFBTSxFQUF3QixJQUFJLENBQUMsTUFBTTtZQUN6QyxNQUFNLEVBQXdCLElBQUksQ0FBQyxNQUFNLEVBQUUsTUFBTSxFQUFFO1lBQ25ELElBQUksRUFBMEIsSUFBSSxDQUFDLElBQUk7WUFDdkMsSUFBSSxFQUEwQixJQUFJLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRTtTQUNuRCxDQUFDO0lBQ04sQ0FBQztDQUNKO0FBN1NELHFDQTZTQyJ9
@@ -0,0 +1,137 @@
1
+ /** @module ComponentInteraction */
2
+ import Interaction from "./Interaction";
3
+ import Message from "./Message";
4
+ import type Guild from "./Guild";
5
+ import Member from "./Member";
6
+ import Permission from "./Permission";
7
+ import type PrivateChannel from "./PrivateChannel";
8
+ import User from "./User";
9
+ import type Entitlement from "./Entitlement";
10
+ import type TestEntitlement from "./TestEntitlement";
11
+ import type Client from "../Client";
12
+ import type { AuthorizingIntegrationOwners, EditInteractionContent, InitialInteractionContent, InteractionContent, InteractionGuild, MessageComponentButtonInteractionData, MessageComponentSelectMenuInteractionData, ModalData, RawMessageComponentInteraction } from "../types/interactions";
13
+ import type { AnyTextableGuildChannel, AnyInteractionChannel } from "../types/channels";
14
+ import type { JSONComponentInteraction } from "../types/json";
15
+ import type { Uncached } from "../types/shared";
16
+ import { ComponentTypes, type SelectMenuTypes, type InteractionTypes, type InteractionContextTypes } from "../Constants";
17
+ import MessageInteractionResponse, { type InitialMessagedInteractionResponse, type FollowupMessageInteractionResponse } from "../util/interactions/MessageInteractionResponse";
18
+ /** Represents a component interaction. */
19
+ export default class ComponentInteraction<V extends ComponentTypes.BUTTON | SelectMenuTypes = ComponentTypes.BUTTON | SelectMenuTypes, T extends AnyInteractionChannel | Uncached = AnyInteractionChannel | Uncached> extends Interaction {
20
+ private _cachedChannel;
21
+ private _cachedGuild?;
22
+ /** The permissions the bot has in the channel this interaction was sent from. If in a dm/group dm, this will contain `ATTACH_FILES`, `EMBED_LINKS`, and `MENTION_EVERYONE`. In addition, `USE_EXTERNAL_EMOJIS` will be included for DMs with the app's bot user. */
23
+ appPermissions: Permission;
24
+ /** Details about the authorizing user or server for the installation(s) relevant to the interaction. See [Discord's docs](https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-authorizing-integration-owners-object) for more information. */
25
+ authorizingIntegrationOwners: AuthorizingIntegrationOwners;
26
+ /** The ID of the channel this interaction was sent from. */
27
+ channelID: string;
28
+ /** The context this interaction was sent from. */
29
+ context?: InteractionContextTypes;
30
+ /** The data associated with the interaction. */
31
+ data: V extends ComponentTypes.BUTTON ? MessageComponentButtonInteractionData : MessageComponentSelectMenuInteractionData;
32
+ /** The entitlements for the user that created this interaction, and the guild it was created in. */
33
+ entitlements: Array<Entitlement | TestEntitlement>;
34
+ /** The id of the guild this interaction was sent from, if applicable. */
35
+ guildID: T extends AnyTextableGuildChannel ? string : string | null;
36
+ /** The preferred [locale](https://discord.com/developers/docs/reference#locales) of the guild this interaction was sent from, if applicable. */
37
+ guildLocale: T extends AnyTextableGuildChannel ? string : string | undefined;
38
+ /** The partial guild this interaction was sent from, if applicable. */
39
+ guildPartial?: T extends AnyTextableGuildChannel ? InteractionGuild : InteractionGuild | undefined;
40
+ /** The [locale](https://discord.com/developers/docs/reference#locales) of the invoking user. */
41
+ locale: string;
42
+ /** The member associated with the invoking user, if this interaction is sent from a guild. */
43
+ member: T extends AnyTextableGuildChannel ? Member : Member | null;
44
+ /** The permissions of the member associated with the invoking user, if this interaction is sent from a guild. */
45
+ memberPermissions: T extends AnyTextableGuildChannel ? Permission : Permission | null;
46
+ /** The message the interaction is from. */
47
+ message: Message<T>;
48
+ type: InteractionTypes.MESSAGE_COMPONENT;
49
+ /** The user that invoked this interaction. */
50
+ user: User;
51
+ constructor(data: RawMessageComponentInteraction, client: Client);
52
+ /** The channel this interaction was sent from. */
53
+ get channel(): T extends AnyInteractionChannel ? T : undefined;
54
+ /** The guild this interaction was sent from, if applicable. This will throw an error if the guild is not cached. */
55
+ get guild(): T extends AnyTextableGuildChannel ? Guild : Guild | null;
56
+ /**
57
+ * Create a followup message. Note that the returned class is not a message. The message is located in the property {@link MessageInteractionResponse#message | message}.
58
+ * @param options The options for creating the followup message.
59
+ */
60
+ createFollowup(options: InteractionContent): Promise<FollowupMessageInteractionResponse<this>>;
61
+ /**
62
+ * Create a message through this interaction. This is an initial response, and more than one initial response cannot be used. Use {@link ComponentInteraction#createFollowup | createFollowup}.
63
+ * Note that the returned class is not a message. This initial response does not return a message. You will need to call {@link MessageInteractionResponse#getMessage | MessageInteractionResponse#getMessage} on the returned class,
64
+ * or {@link ComponentInteraction#getOriginal | getOriginal}.
65
+ * @note You cannot attach files in an initial response. Defer the interaction, then use {@link ComponentInteraction#createFollowup | createFollowup}.
66
+ * @param options The options for the message.
67
+ */
68
+ createMessage(options: InitialInteractionContent): Promise<InitialMessagedInteractionResponse<this>>;
69
+ /**
70
+ * Respond to this interaction with a modal. This is an initial response, and more than one initial response cannot be used.
71
+ * @param options The options for the modal.
72
+ */
73
+ createModal(options: ModalData): Promise<void>;
74
+ /**
75
+ * Defer this interaction with a `DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE` response. This is an initial response, and more than one initial response cannot be used.
76
+ * @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with.
77
+ */
78
+ defer(flags?: number): Promise<void>;
79
+ /**
80
+ * Defer this interaction with a `DEFERRED_UPDATE_MESSAGE` response. This is an initial response, and more than one initial response cannot be used.
81
+ * @param flags The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to respond with.
82
+ */
83
+ deferUpdate(flags?: number): Promise<void>;
84
+ /**
85
+ * Delete a follow-up message.
86
+ * @param messageID The ID of the message.
87
+ */
88
+ deleteFollowup(messageID: string): Promise<void>;
89
+ /**
90
+ * Delete the original interaction response.
91
+ */
92
+ deleteOriginal(): Promise<void>;
93
+ /**
94
+ * Edit a followup message.
95
+ * @param messageID The ID of the message.
96
+ * @param options The options for editing the followup message.
97
+ */
98
+ editFollowup(messageID: string, options: EditInteractionContent): Promise<Message<T>>;
99
+ /**
100
+ * Edit the original interaction response.
101
+ * @param options The options for editing the original message.
102
+ */
103
+ editOriginal(options: EditInteractionContent): Promise<Message<T>>;
104
+ /**
105
+ * Edit the message this interaction is from. If this interaction has already been acknowledged, use `editOriginal`.
106
+ * @param options The options for editing the message.
107
+ */
108
+ editParent(options: InteractionContent): Promise<void>;
109
+ /**
110
+ * Get a followup message.
111
+ * @param messageID The ID of the message.
112
+ */
113
+ getFollowup(messageID: string): Promise<Message<T>>;
114
+ /**
115
+ * Get the original interaction response.
116
+ */
117
+ getOriginal(): Promise<Message<T>>;
118
+ /** Whether this interaction belongs to a cached guild channel. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
119
+ inCachedGuildChannel(): this is ComponentInteraction<V, AnyTextableGuildChannel>;
120
+ /** Whether this interaction belongs to a private channel (PrivateChannel or uncached). The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the channel it belongs to. */
121
+ inPrivateChannel(): this is ComponentInteraction<V, PrivateChannel | Uncached>;
122
+ /** Whether this interaction is a button interaction. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the component type. */
123
+ isButtonComponentInteraction(): this is ComponentInteraction<ComponentTypes.BUTTON, T>;
124
+ /** Whether this interaction is a select menu interaction. The only difference on using this method over a simple if statement is to easily update all the interaction properties typing definitions based on the component type. */
125
+ isSelectMenuComponentInteraction(): this is ComponentInteraction<SelectMenuTypes, T>;
126
+ /** Show a "premium required" response to the user. This is an initial response, and more than one initial response cannot be used. */
127
+ premiumRequired(): Promise<void>;
128
+ /**
129
+ * Reply to this interaction. If the interaction hasn't been acknowledged, {@link ComponentInteraction#createMessage | createMessage} is used. Else, {@link ComponentInteraction#createFollowup | createFollowup} is used.
130
+ * Note the returned class is not a message. Depending on which method was used, the returned class may or may not have the sent message. {@link MessageInteractionResponse#hasMessage | hasMessage} can be used for type narrowing
131
+ * to check if {@link MessageInteractionResponse#message | message} is present. If it is not, the {@link MessageInteractionResponse#getMessage | getMessage} can be used.
132
+ * @note Due to atachments not being able to be sent in initial responses, attachments will cause a deferred response, if the interaction has not been acknowledged.
133
+ * @param options The options for the message.
134
+ */
135
+ reply(options: InteractionContent): Promise<MessageInteractionResponse<this>>;
136
+ toJSON(): JSONComponentInteraction;
137
+ }