@ovencord/discord.js 14.16.3

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 (332) hide show
  1. package/LICENSE +191 -0
  2. package/README.md +148 -0
  3. package/package.json +73 -0
  4. package/src/client/Client.ts +967 -0
  5. package/src/client/actions/Action.ts +141 -0
  6. package/src/client/actions/ActionsManager.ts +138 -0
  7. package/src/client/actions/ChannelCreate.ts +21 -0
  8. package/src/client/actions/ChannelDelete.ts +20 -0
  9. package/src/client/actions/ChannelUpdate.ts +38 -0
  10. package/src/client/actions/GuildChannelsPositionUpdate.ts +17 -0
  11. package/src/client/actions/GuildEmojiCreate.ts +17 -0
  12. package/src/client/actions/GuildEmojiDelete.ts +16 -0
  13. package/src/client/actions/GuildEmojiUpdate.ts +17 -0
  14. package/src/client/actions/GuildEmojisUpdate.ts +30 -0
  15. package/src/client/actions/GuildMemberRemove.ts +29 -0
  16. package/src/client/actions/GuildMemberUpdate.ts +41 -0
  17. package/src/client/actions/GuildRoleCreate.ts +23 -0
  18. package/src/client/actions/GuildRoleDelete.ts +26 -0
  19. package/src/client/actions/GuildRolesPositionUpdate.ts +17 -0
  20. package/src/client/actions/GuildScheduledEventDelete.ts +28 -0
  21. package/src/client/actions/GuildScheduledEventUserAdd.ts +29 -0
  22. package/src/client/actions/GuildScheduledEventUserRemove.ts +29 -0
  23. package/src/client/actions/GuildSoundboardSoundDelete.ts +26 -0
  24. package/src/client/actions/GuildStickerCreate.ts +17 -0
  25. package/src/client/actions/GuildStickerDelete.ts +16 -0
  26. package/src/client/actions/GuildStickerUpdate.ts +17 -0
  27. package/src/client/actions/GuildStickersUpdate.ts +30 -0
  28. package/src/client/actions/GuildUpdate.ts +30 -0
  29. package/src/client/actions/InteractionCreate.ts +104 -0
  30. package/src/client/actions/MessageCreate.ts +38 -0
  31. package/src/client/actions/MessageDelete.ts +29 -0
  32. package/src/client/actions/MessageDeleteBulk.ts +45 -0
  33. package/src/client/actions/MessagePollVoteAdd.ts +37 -0
  34. package/src/client/actions/MessagePollVoteRemove.ts +35 -0
  35. package/src/client/actions/MessageReactionAdd.ts +68 -0
  36. package/src/client/actions/MessageReactionRemove.ts +47 -0
  37. package/src/client/actions/MessageReactionRemoveAll.ts +30 -0
  38. package/src/client/actions/MessageReactionRemoveEmoji.ts +25 -0
  39. package/src/client/actions/MessageUpdate.ts +22 -0
  40. package/src/client/actions/StageInstanceCreate.ts +25 -0
  41. package/src/client/actions/StageInstanceDelete.ts +28 -0
  42. package/src/client/actions/StageInstanceUpdate.ts +27 -0
  43. package/src/client/actions/ThreadCreate.ts +22 -0
  44. package/src/client/actions/ThreadMembersUpdate.ts +45 -0
  45. package/src/client/actions/TypingStart.ts +26 -0
  46. package/src/client/actions/UserUpdate.ts +33 -0
  47. package/src/client/voice/ClientVoiceManager.ts +46 -0
  48. package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.ts +19 -0
  49. package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.ts +17 -0
  50. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.ts +18 -0
  51. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.ts +21 -0
  52. package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.ts +20 -0
  53. package/src/client/websocket/handlers/CHANNEL_CREATE.ts +4 -0
  54. package/src/client/websocket/handlers/CHANNEL_DELETE.ts +4 -0
  55. package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.ts +22 -0
  56. package/src/client/websocket/handlers/CHANNEL_UPDATE.ts +16 -0
  57. package/src/client/websocket/handlers/ENTITLEMENT_CREATE.ts +14 -0
  58. package/src/client/websocket/handlers/ENTITLEMENT_DELETE.ts +18 -0
  59. package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.ts +16 -0
  60. package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.ts +19 -0
  61. package/src/client/websocket/handlers/GUILD_BAN_ADD.ts +15 -0
  62. package/src/client/websocket/handlers/GUILD_BAN_REMOVE.ts +20 -0
  63. package/src/client/websocket/handlers/GUILD_CREATE.ts +34 -0
  64. package/src/client/websocket/handlers/GUILD_DELETE.ts +36 -0
  65. package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.ts +4 -0
  66. package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.ts +15 -0
  67. package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.ts +40 -0
  68. package/src/client/websocket/handlers/GUILD_MEMBER_ADD.ts +17 -0
  69. package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.ts +4 -0
  70. package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.ts +4 -0
  71. package/src/client/websocket/handlers/GUILD_ROLE_CREATE.ts +4 -0
  72. package/src/client/websocket/handlers/GUILD_ROLE_DELETE.ts +4 -0
  73. package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.ts +21 -0
  74. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.ts +17 -0
  75. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.ts +4 -0
  76. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.ts +19 -0
  77. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.ts +4 -0
  78. package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +4 -0
  79. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.ts +24 -0
  80. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.ts +18 -0
  81. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.ts +4 -0
  82. package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.ts +20 -0
  83. package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.ts +4 -0
  84. package/src/client/websocket/handlers/GUILD_UPDATE.ts +4 -0
  85. package/src/client/websocket/handlers/INTERACTION_CREATE.ts +4 -0
  86. package/src/client/websocket/handlers/INVITE_CREATE.ts +20 -0
  87. package/src/client/websocket/handlers/INVITE_DELETE.ts +23 -0
  88. package/src/client/websocket/handlers/MESSAGE_CREATE.ts +4 -0
  89. package/src/client/websocket/handlers/MESSAGE_DELETE.ts +4 -0
  90. package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.ts +4 -0
  91. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.ts +4 -0
  92. package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.ts +4 -0
  93. package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.ts +4 -0
  94. package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.ts +4 -0
  95. package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.ts +4 -0
  96. package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.ts +4 -0
  97. package/src/client/websocket/handlers/MESSAGE_UPDATE.ts +16 -0
  98. package/src/client/websocket/handlers/PRESENCE_UPDATE.ts +42 -0
  99. package/src/client/websocket/handlers/RATE_LIMITED.ts +23 -0
  100. package/src/client/websocket/handlers/READY.ts +29 -0
  101. package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.ts +24 -0
  102. package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.ts +4 -0
  103. package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.ts +4 -0
  104. package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.ts +4 -0
  105. package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.ts +14 -0
  106. package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.ts +16 -0
  107. package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.ts +16 -0
  108. package/src/client/websocket/handlers/THREAD_CREATE.ts +4 -0
  109. package/src/client/websocket/handlers/THREAD_DELETE.ts +17 -0
  110. package/src/client/websocket/handlers/THREAD_LIST_SYNC.ts +50 -0
  111. package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.ts +4 -0
  112. package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.ts +25 -0
  113. package/src/client/websocket/handlers/THREAD_UPDATE.ts +16 -0
  114. package/src/client/websocket/handlers/TYPING_START.ts +4 -0
  115. package/src/client/websocket/handlers/USER_UPDATE.ts +4 -0
  116. package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.ts +16 -0
  117. package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.ts +5 -0
  118. package/src/client/websocket/handlers/VOICE_STATE_UPDATE.ts +37 -0
  119. package/src/client/websocket/handlers/WEBHOOKS_UPDATE.ts +16 -0
  120. package/src/client/websocket/handlers/index.ts +74 -0
  121. package/src/errors/DJSError.ts +50 -0
  122. package/src/errors/ErrorCodes.ts +277 -0
  123. package/src/errors/Messages.ts +155 -0
  124. package/src/errors/index.ts +6 -0
  125. package/src/index.ts +241 -0
  126. package/src/managers/ApplicationCommandManager.ts +303 -0
  127. package/src/managers/ApplicationCommandPermissionsManager.ts +453 -0
  128. package/src/managers/ApplicationEmojiManager.ts +149 -0
  129. package/src/managers/AutoModerationRuleManager.ts +307 -0
  130. package/src/managers/BaseManager.ts +13 -0
  131. package/src/managers/CachedManager.ts +56 -0
  132. package/src/managers/CategoryChannelChildManager.ts +81 -0
  133. package/src/managers/ChannelManager.ts +194 -0
  134. package/src/managers/DMMessageManager.ts +15 -0
  135. package/src/managers/DataManager.ts +38 -0
  136. package/src/managers/EntitlementManager.ts +182 -0
  137. package/src/managers/GuildApplicationCommandManager.ts +29 -0
  138. package/src/managers/GuildBanManager.ts +221 -0
  139. package/src/managers/GuildChannelManager.ts +552 -0
  140. package/src/managers/GuildEmojiManager.ts +262 -0
  141. package/src/managers/GuildEmojiRoleManager.ts +134 -0
  142. package/src/managers/GuildForumThreadManager.ts +84 -0
  143. package/src/managers/GuildInviteManager.ts +236 -0
  144. package/src/managers/GuildManager.ts +265 -0
  145. package/src/managers/GuildMemberManager.ts +619 -0
  146. package/src/managers/GuildMemberRoleManager.ts +230 -0
  147. package/src/managers/GuildMessageManager.ts +31 -0
  148. package/src/managers/GuildScheduledEventManager.ts +330 -0
  149. package/src/managers/GuildSoundboardSoundManager.ts +157 -0
  150. package/src/managers/GuildStickerManager.ts +192 -0
  151. package/src/managers/GuildTextThreadManager.ts +91 -0
  152. package/src/managers/MessageManager.ts +352 -0
  153. package/src/managers/PartialGroupDMMessageManager.ts +15 -0
  154. package/src/managers/PermissionOverwriteManager.ts +174 -0
  155. package/src/managers/PollAnswerVoterManager.ts +59 -0
  156. package/src/managers/PresenceManager.ts +60 -0
  157. package/src/managers/ReactionManager.ts +72 -0
  158. package/src/managers/ReactionUserManager.ts +82 -0
  159. package/src/managers/RoleManager.ts +432 -0
  160. package/src/managers/StageInstanceManager.ts +166 -0
  161. package/src/managers/SubscriptionManager.ts +83 -0
  162. package/src/managers/ThreadManager.ts +210 -0
  163. package/src/managers/ThreadMemberManager.ts +194 -0
  164. package/src/managers/UserManager.ts +139 -0
  165. package/src/managers/VoiceStateManager.ts +61 -0
  166. package/src/sharding/Shard.ts +513 -0
  167. package/src/sharding/ShardClientUtil.ts +293 -0
  168. package/src/sharding/ShardingManager.ts +374 -0
  169. package/src/structures/ActionRow.ts +31 -0
  170. package/src/structures/AnnouncementChannel.ts +25 -0
  171. package/src/structures/AnonymousGuild.ts +110 -0
  172. package/src/structures/ApplicationCommand.ts +675 -0
  173. package/src/structures/ApplicationEmoji.ts +189 -0
  174. package/src/structures/ApplicationRoleConnectionMetadata.ts +54 -0
  175. package/src/structures/Attachment.ts +189 -0
  176. package/src/structures/AuthorizingIntegrationOwners.ts +63 -0
  177. package/src/structures/AutoModerationActionExecution.ts +138 -0
  178. package/src/structures/AutoModerationRule.ts +325 -0
  179. package/src/structures/AutocompleteInteraction.ts +115 -0
  180. package/src/structures/Base.ts +37 -0
  181. package/src/structures/BaseChannel.ts +188 -0
  182. package/src/structures/BaseGuild.ts +134 -0
  183. package/src/structures/BaseGuildEmoji.ts +113 -0
  184. package/src/structures/BaseGuildTextChannel.ts +230 -0
  185. package/src/structures/BaseGuildVoiceChannel.ts +270 -0
  186. package/src/structures/BaseInteraction.ts +393 -0
  187. package/src/structures/BaseInvite.ts +192 -0
  188. package/src/structures/BaseSelectMenuComponent.ts +58 -0
  189. package/src/structures/ButtonComponent.ts +68 -0
  190. package/src/structures/ButtonInteraction.ts +8 -0
  191. package/src/structures/CategoryChannel.ts +46 -0
  192. package/src/structures/ChannelSelectMenuComponent.ts +18 -0
  193. package/src/structures/ChannelSelectMenuInteraction.ts +34 -0
  194. package/src/structures/ChatInputCommandInteraction.ts +43 -0
  195. package/src/structures/ClientApplication.ts +470 -0
  196. package/src/structures/ClientPresence.ts +87 -0
  197. package/src/structures/ClientUser.ts +219 -0
  198. package/src/structures/CommandInteraction.ts +193 -0
  199. package/src/structures/CommandInteractionOptionResolver.ts +336 -0
  200. package/src/structures/Component.ts +59 -0
  201. package/src/structures/ContainerComponent.ts +63 -0
  202. package/src/structures/ContextMenuCommandInteraction.ts +68 -0
  203. package/src/structures/DMChannel.ts +148 -0
  204. package/src/structures/DirectoryChannel.ts +40 -0
  205. package/src/structures/Embed.ts +251 -0
  206. package/src/structures/Emoji.ts +61 -0
  207. package/src/structures/Entitlement.ts +206 -0
  208. package/src/structures/FileComponent.ts +41 -0
  209. package/src/structures/ForumChannel.ts +31 -0
  210. package/src/structures/GroupDMInvite.ts +34 -0
  211. package/src/structures/Guild.ts +1605 -0
  212. package/src/structures/GuildAuditLogs.ts +99 -0
  213. package/src/structures/GuildAuditLogsEntry.ts +557 -0
  214. package/src/structures/GuildBan.ts +65 -0
  215. package/src/structures/GuildChannel.ts +515 -0
  216. package/src/structures/GuildEmoji.ts +159 -0
  217. package/src/structures/GuildInvite.ts +233 -0
  218. package/src/structures/GuildMember.ts +643 -0
  219. package/src/structures/GuildOnboarding.ts +73 -0
  220. package/src/structures/GuildOnboardingPrompt.ts +93 -0
  221. package/src/structures/GuildOnboardingPromptOption.ts +100 -0
  222. package/src/structures/GuildPreview.ts +218 -0
  223. package/src/structures/GuildPreviewEmoji.ts +28 -0
  224. package/src/structures/GuildScheduledEvent.ts +593 -0
  225. package/src/structures/GuildTemplate.ts +229 -0
  226. package/src/structures/Integration.ts +257 -0
  227. package/src/structures/IntegrationApplication.ts +84 -0
  228. package/src/structures/InteractionCallback.ts +86 -0
  229. package/src/structures/InteractionCallbackResource.ts +57 -0
  230. package/src/structures/InteractionCallbackResponse.ts +35 -0
  231. package/src/structures/InteractionCollector.ts +260 -0
  232. package/src/structures/InteractionWebhook.ts +65 -0
  233. package/src/structures/InviteGuild.ts +22 -0
  234. package/src/structures/LabelComponent.ts +51 -0
  235. package/src/structures/MediaChannel.ts +8 -0
  236. package/src/structures/MediaGalleryComponent.ts +31 -0
  237. package/src/structures/MediaGalleryItem.ts +54 -0
  238. package/src/structures/MentionableSelectMenuComponent.ts +8 -0
  239. package/src/structures/MentionableSelectMenuInteraction.ts +76 -0
  240. package/src/structures/Message.ts +1202 -0
  241. package/src/structures/MessageCollector.ts +155 -0
  242. package/src/structures/MessageComponentInteraction.ts +132 -0
  243. package/src/structures/MessageContextMenuCommandInteraction.ts +18 -0
  244. package/src/structures/MessageMentions.ts +327 -0
  245. package/src/structures/MessagePayload.ts +325 -0
  246. package/src/structures/MessageReaction.ts +219 -0
  247. package/src/structures/ModalComponentResolver.ts +237 -0
  248. package/src/structures/ModalSubmitInteraction.ts +260 -0
  249. package/src/structures/OAuth2Guild.ts +30 -0
  250. package/src/structures/PartialGroupDMChannel.ts +151 -0
  251. package/src/structures/PermissionOverwrites.ts +222 -0
  252. package/src/structures/Poll.ts +195 -0
  253. package/src/structures/PollAnswer.ts +100 -0
  254. package/src/structures/Presence.ts +448 -0
  255. package/src/structures/PrimaryEntryPointCommandInteraction.ts +8 -0
  256. package/src/structures/ReactionCollector.ts +245 -0
  257. package/src/structures/ReactionEmoji.ts +30 -0
  258. package/src/structures/Role.ts +543 -0
  259. package/src/structures/RoleSelectMenuComponent.ts +8 -0
  260. package/src/structures/RoleSelectMenuInteraction.ts +34 -0
  261. package/src/structures/SKU.ts +62 -0
  262. package/src/structures/SectionComponent.ts +44 -0
  263. package/src/structures/SeparatorComponent.ts +29 -0
  264. package/src/structures/SoundboardSound.ts +176 -0
  265. package/src/structures/StageChannel.ts +118 -0
  266. package/src/structures/StageInstance.ts +173 -0
  267. package/src/structures/Sticker.ts +300 -0
  268. package/src/structures/StickerPack.ts +111 -0
  269. package/src/structures/StringSelectMenuComponent.ts +18 -0
  270. package/src/structures/StringSelectMenuInteraction.ts +21 -0
  271. package/src/structures/Subscription.ts +138 -0
  272. package/src/structures/Team.ts +131 -0
  273. package/src/structures/TeamMember.ts +77 -0
  274. package/src/structures/TextChannel.ts +33 -0
  275. package/src/structures/TextDisplayComponent.ts +18 -0
  276. package/src/structures/TextInputComponent.ts +28 -0
  277. package/src/structures/ThreadChannel.ts +680 -0
  278. package/src/structures/ThreadMember.ts +125 -0
  279. package/src/structures/ThreadOnlyChannel.ts +276 -0
  280. package/src/structures/ThumbnailComponent.ts +51 -0
  281. package/src/structures/Typing.ts +81 -0
  282. package/src/structures/UnfurledMediaItem.ts +33 -0
  283. package/src/structures/User.ts +511 -0
  284. package/src/structures/UserContextMenuCommandInteraction.ts +28 -0
  285. package/src/structures/UserSelectMenuComponent.ts +8 -0
  286. package/src/structures/UserSelectMenuInteraction.ts +54 -0
  287. package/src/structures/VoiceChannel.ts +119 -0
  288. package/src/structures/VoiceChannelEffect.ts +92 -0
  289. package/src/structures/VoiceRegion.ts +52 -0
  290. package/src/structures/VoiceState.ts +346 -0
  291. package/src/structures/Webhook.ts +526 -0
  292. package/src/structures/WelcomeChannel.ts +67 -0
  293. package/src/structures/WelcomeScreen.ts +53 -0
  294. package/src/structures/Widget.ts +110 -0
  295. package/src/structures/WidgetMember.ts +124 -0
  296. package/src/structures/interfaces/Application.ts +179 -0
  297. package/src/structures/interfaces/Collector.ts +372 -0
  298. package/src/structures/interfaces/InteractionResponses.ts +384 -0
  299. package/src/structures/interfaces/TextBasedChannel.ts +430 -0
  300. package/src/util/APITypes.ts +690 -0
  301. package/src/util/ActivityFlagsBitField.ts +26 -0
  302. package/src/util/ApplicationFlagsBitField.ts +43 -0
  303. package/src/util/AttachmentFlagsBitField.ts +26 -0
  304. package/src/util/BitField.ts +178 -0
  305. package/src/util/ChannelFlagsBitField.ts +43 -0
  306. package/src/util/Channels.ts +165 -0
  307. package/src/util/Colors.ts +72 -0
  308. package/src/util/Components.ts +285 -0
  309. package/src/util/Constants.ts +251 -0
  310. package/src/util/DataResolver.ts +146 -0
  311. package/src/util/Enums.ts +10 -0
  312. package/src/util/Events.ts +178 -0
  313. package/src/util/GuildMemberFlagsBitField.ts +43 -0
  314. package/src/util/IntentsBitField.ts +35 -0
  315. package/src/util/InviteFlagsBitField.ts +26 -0
  316. package/src/util/Invites.ts +27 -0
  317. package/src/util/LimitedCollection.ts +73 -0
  318. package/src/util/MessageFlagsBitField.ts +43 -0
  319. package/src/util/Options.ts +215 -0
  320. package/src/util/Partials.ts +50 -0
  321. package/src/util/PermissionsBitField.ts +113 -0
  322. package/src/util/RoleFlagsBitField.ts +26 -0
  323. package/src/util/SKUFlagsBitField.ts +26 -0
  324. package/src/util/ShardEvents.ts +26 -0
  325. package/src/util/Status.ts +16 -0
  326. package/src/util/Sweepers.ts +532 -0
  327. package/src/util/Symbols.ts +1 -0
  328. package/src/util/SystemChannelFlagsBitField.ts +45 -0
  329. package/src/util/ThreadMemberFlagsBitField.ts +33 -0
  330. package/src/util/Transformers.ts +123 -0
  331. package/src/util/UserFlagsBitField.ts +33 -0
  332. package/src/util/Util.ts +519 -0
@@ -0,0 +1,35 @@
1
+ import { InteractionCallback } from './InteractionCallback.js';
2
+ import { InteractionCallbackResource } from './InteractionCallbackResource.js';
3
+
4
+ /**
5
+ * Represents an interaction's response
6
+ */
7
+ export class InteractionCallbackResponse {
8
+ public client: any;
9
+ public interaction: any;
10
+ public resource: any;
11
+ constructor(client, data) {
12
+ /**
13
+ * The client that instantiated this
14
+ *
15
+ * @name InteractionCallbackResponse#client
16
+ * @type {Client}
17
+ * @readonly
18
+ */
19
+ Object.defineProperty(this, 'client', { value: client });
20
+
21
+ /**
22
+ * The interaction object associated with the interaction callback response
23
+ *
24
+ * @type {InteractionCallback}
25
+ */
26
+ this.interaction = new InteractionCallback(client, data.interaction);
27
+
28
+ /**
29
+ * The resource that was created by the interaction response
30
+ *
31
+ * @type {?InteractionCallbackResource}
32
+ */
33
+ this.resource = data.resource ? new InteractionCallbackResource(client, data.resource) : null;
34
+ }
35
+ }
@@ -0,0 +1,260 @@
1
+ import { Collection } from '@ovencord/collection';
2
+ import { Events } from '../util/Events.js';
3
+ import { Collector } from './interfaces/Collector.js';
4
+
5
+ /**
6
+ * @typedef {CollectorOptions} InteractionCollectorOptions
7
+ * @property {TextBasedChannelsResolvable} [channel] The channel to listen to interactions from
8
+ * @property {ComponentType} [componentType] The type of component to listen for
9
+ * @property {GuildResolvable} [guild] The guild to listen to interactions from
10
+ * @property {InteractionType} [interactionType] The type of interaction to listen for
11
+ * @property {number} [max] The maximum total amount of interactions to collect
12
+ * @property {number} [maxComponents] The maximum number of components to collect
13
+ * @property {number} [maxUsers] The maximum number of users to interact
14
+ * @property {Message|APIMessage} [message] The message to listen to interactions from
15
+ */
16
+
17
+ /**
18
+ * Collects interactions.
19
+ * Will automatically stop if the message ({@link Client#event:messageDelete messageDelete} or
20
+ * {@link Client#event:messageDeleteBulk messageDeleteBulk}),
21
+ * channel ({@link Client#event:channelDelete channelDelete}), or
22
+ * guild ({@link Client#event:guildDelete guildDelete}) is deleted.
23
+ * <info>Interaction collectors that do not specify `time` or `idle` may be prone to always running.
24
+ * Ensure your interaction collectors end via either of these options or manual cancellation.</info>
25
+ *
26
+ * @extends {Collector}
27
+ */
28
+ export class InteractionCollector extends Collector {
29
+ public client: any;
30
+ public messageId: any;
31
+ public channelId: any;
32
+ public guildId: any;
33
+ public interactionType: any;
34
+ public componentType: any;
35
+ public users: any;
36
+ public total: any;
37
+ /**
38
+ * @param {Client} client The client on which to collect interactions
39
+ * @param {InteractionCollectorOptions} [options={}] The options to apply to this collector
40
+ */
41
+ constructor(client, options = {}) {
42
+ super(client, options);
43
+
44
+ /**
45
+ * The message from which to collect interactions, if provided
46
+ *
47
+ * @type {?Snowflake}
48
+ */
49
+ this.messageId = options.message?.id ?? null;
50
+
51
+ /**
52
+ * The channel from which to collect interactions, if provided
53
+ *
54
+ * @type {?Snowflake}
55
+ */
56
+ this.channelId =
57
+ options.message?.channelId ?? options.message?.channel_id ?? this.client.channels.resolveId(options.channel);
58
+
59
+ /**
60
+ * The guild from which to collect interactions, if provided
61
+ *
62
+ * @type {?Snowflake}
63
+ */
64
+ this.guildId =
65
+ options.message?.guildId ??
66
+ options.message?.guild_id ??
67
+ this.client.guilds.resolveId(options.channel?.guild) ??
68
+ this.client.guilds.resolveId(options.guild);
69
+
70
+ /**
71
+ * The type of interaction to collect
72
+ *
73
+ * @type {?InteractionType}
74
+ */
75
+ this.interactionType = options.interactionType ?? null;
76
+
77
+ /**
78
+ * The type of component to collect
79
+ *
80
+ * @type {?ComponentType}
81
+ */
82
+ this.componentType = options.componentType ?? null;
83
+
84
+ /**
85
+ * The users that have interacted with this collector
86
+ *
87
+ * @type {Collection<Snowflake, User>}
88
+ */
89
+ this.users = new Collection();
90
+
91
+ /**
92
+ * The total number of interactions collected
93
+ *
94
+ * @type {number}
95
+ */
96
+ this.total = 0;
97
+
98
+ this.client.incrementMaxListeners();
99
+
100
+ const bulkDeleteListener = messages => {
101
+ if (messages.has(this.messageId)) this.stop('messageDelete');
102
+ };
103
+
104
+ if (this.messageId) {
105
+ this._handleMessageDeletion = this._handleMessageDeletion.bind(this);
106
+ this.client.on(Events.MessageDelete, this._handleMessageDeletion);
107
+ this.client.on(Events.MessageBulkDelete, bulkDeleteListener);
108
+ }
109
+
110
+ if (this.channelId) {
111
+ this._handleChannelDeletion = this._handleChannelDeletion.bind(this);
112
+ this._handleThreadDeletion = this._handleThreadDeletion.bind(this);
113
+ this.client.on(Events.ChannelDelete, this._handleChannelDeletion);
114
+ this.client.on(Events.ThreadDelete, this._handleThreadDeletion);
115
+ }
116
+
117
+ if (this.guildId) {
118
+ this._handleGuildDeletion = this._handleGuildDeletion.bind(this);
119
+ this.client.on(Events.GuildDelete, this._handleGuildDeletion);
120
+ }
121
+
122
+ this.client.on(Events.InteractionCreate, this.handleCollect);
123
+
124
+ this.once('end', () => {
125
+ this.client.removeListener(Events.InteractionCreate, this.handleCollect);
126
+ this.client.removeListener(Events.MessageDelete, this._handleMessageDeletion);
127
+ this.client.removeListener(Events.MessageBulkDelete, bulkDeleteListener);
128
+ this.client.removeListener(Events.ChannelDelete, this._handleChannelDeletion);
129
+ this.client.removeListener(Events.ThreadDelete, this._handleThreadDeletion);
130
+ this.client.removeListener(Events.GuildDelete, this._handleGuildDeletion);
131
+ this.client.decrementMaxListeners();
132
+ });
133
+
134
+ this.on('collect', interaction => {
135
+ this.total++;
136
+ this.users.set(interaction.user.id, interaction.user);
137
+ });
138
+ }
139
+
140
+ /**
141
+ * Handles an incoming interaction for possible collection.
142
+ *
143
+ * @param {BaseInteraction} interaction The interaction to possibly collect
144
+ * @returns {?Snowflake}
145
+ * @private
146
+ */
147
+ collect(interaction) {
148
+ /**
149
+ * Emitted whenever an interaction is collected.
150
+ *
151
+ * @event InteractionCollector#collect
152
+ * @param {BaseInteraction} interaction The interaction that was collected
153
+ */
154
+
155
+ if (this.interactionType && interaction.type !== this.interactionType) return null;
156
+ if (this.componentType && interaction.componentType !== this.componentType) return null;
157
+ if (this.messageId && interaction.message?.id !== this.messageId) return null;
158
+ if (this.channelId && interaction.channelId !== this.channelId) return null;
159
+ if (this.guildId && interaction.guildId !== this.guildId) return null;
160
+
161
+ return interaction.id;
162
+ }
163
+
164
+ /**
165
+ * Handles an interaction for possible disposal.
166
+ *
167
+ * @param {BaseInteraction} interaction The interaction that could be disposed of
168
+ * @returns {?Snowflake}
169
+ */
170
+ dispose(interaction) {
171
+ /**
172
+ * Emitted whenever an interaction is disposed of.
173
+ *
174
+ * @event InteractionCollector#dispose
175
+ * @param {BaseInteraction} interaction The interaction that was disposed of
176
+ */
177
+ if (this.type && interaction.type !== this.type) return null;
178
+ if (this.componentType && interaction.componentType !== this.componentType) return null;
179
+ if (this.messageId && interaction.message?.id !== this.messageId) return null;
180
+ if (this.channelId && interaction.channelId !== this.channelId) return null;
181
+ if (this.guildId && interaction.guildId !== this.guildId) return null;
182
+
183
+ return interaction.id;
184
+ }
185
+
186
+ /**
187
+ * Empties this interaction collector.
188
+ */
189
+ empty() {
190
+ this.total = 0;
191
+ this.collected.clear();
192
+ this.users.clear();
193
+ this.checkEnd();
194
+ }
195
+
196
+ /**
197
+ * The reason this collector has ended with, or null if it hasn't ended yet
198
+ *
199
+ * @type {?string}
200
+ * @readonly
201
+ */
202
+ get endReason() {
203
+ if (this.options.max && this.total >= this.options.max) return 'limit';
204
+ if (this.options.maxComponents && this.collected.size >= this.options.maxComponents) return 'componentLimit';
205
+ if (this.options.maxUsers && this.users.size >= this.options.maxUsers) return 'userLimit';
206
+ return super.endReason;
207
+ }
208
+
209
+ /**
210
+ * Handles checking if the message has been deleted, and if so, stops the collector with the reason 'messageDelete'.
211
+ *
212
+ * @private
213
+ * @param {Message} message The message that was deleted
214
+ * @returns {void}
215
+ */
216
+ _handleMessageDeletion(message) {
217
+ if (message.id === this.messageId) {
218
+ this.stop('messageDelete');
219
+ }
220
+ }
221
+
222
+ /**
223
+ * Handles checking if the channel has been deleted, and if so, stops the collector with the reason 'channelDelete'.
224
+ *
225
+ * @private
226
+ * @param {GuildChannel} channel The channel that was deleted
227
+ * @returns {void}
228
+ */
229
+ _handleChannelDeletion(channel) {
230
+ if (channel.id === this.channelId || channel.threads?.cache.has(this.channelId)) {
231
+ this.stop('channelDelete');
232
+ }
233
+ }
234
+
235
+ /**
236
+ * Handles checking if the thread has been deleted, and if so, stops the collector with the reason 'threadDelete'.
237
+ *
238
+ * @private
239
+ * @param {ThreadChannel} thread The thread that was deleted
240
+ * @returns {void}
241
+ */
242
+ _handleThreadDeletion(thread) {
243
+ if (thread.id === this.channelId) {
244
+ this.stop('threadDelete');
245
+ }
246
+ }
247
+
248
+ /**
249
+ * Handles checking if the guild has been deleted, and if so, stops the collector with the reason 'guildDelete'.
250
+ *
251
+ * @private
252
+ * @param {Guild} guild The guild that was deleted
253
+ * @returns {void}
254
+ */
255
+ _handleGuildDeletion(guild) {
256
+ if (guild.id === this.guildId) {
257
+ this.stop('guildDelete');
258
+ }
259
+ }
260
+ }
@@ -0,0 +1,65 @@
1
+ import { Webhook } from './Webhook.js';
2
+
3
+ /**
4
+ * Represents a webhook for an Interaction
5
+ *
6
+ * @implements {Webhook}
7
+ */
8
+ export class InteractionWebhook {
9
+ public client: any;
10
+ public id: any;
11
+ /**
12
+ * @param {Client} client The instantiating client
13
+ * @param {Snowflake} id The application's id
14
+ * @param {string} token The interaction's token
15
+ */
16
+ constructor(client, id, token) {
17
+ /**
18
+ * The client that instantiated the interaction webhook
19
+ *
20
+ * @name InteractionWebhook#client
21
+ * @type {Client}
22
+ * @readonly
23
+ */
24
+ Object.defineProperty(this, 'client', { value: client });
25
+ this.id = id;
26
+ Object.defineProperty(this, 'token', { value: token, writable: true, configurable: true });
27
+ }
28
+
29
+ // These are here only for documentation purposes - they are implemented by Webhook
30
+
31
+ /**
32
+ * Sends a message with this webhook.
33
+ *
34
+ * @param {string|MessagePayload|InteractionReplyOptions} options The content for the reply
35
+ * @returns {Promise<Message>}
36
+ */
37
+
38
+ async send() {}
39
+
40
+ /**
41
+ * Gets a message that was sent by this webhook.
42
+ *
43
+ * @param {Snowflake|'@original'} message The id of the message to fetch
44
+ * @returns {Promise<Message>} Returns the message sent by this webhook
45
+ */
46
+
47
+ async fetchMessage() {}
48
+
49
+ /**
50
+ * Edits a message that was sent by this webhook.
51
+ *
52
+ * @param {MessageResolvable|'@original'} message The message to edit
53
+ * @param {string|MessagePayload|WebhookMessageEditOptions} options The options to provide
54
+ * @returns {Promise<Message>} Returns the message edited by this webhook
55
+ */
56
+
57
+ async editMessage() {}
58
+
59
+ deleteMessage() {}
60
+
61
+ // eslint-disable-next-line getter-return
62
+ get url() {}
63
+ }
64
+
65
+ Webhook.applyToClass(InteractionWebhook, ['sendSlackMessage', 'edit', 'delete', 'createdTimestamp', 'createdAt']);
@@ -0,0 +1,22 @@
1
+ import { AnonymousGuild } from './AnonymousGuild.js';
2
+ import { WelcomeScreen } from './WelcomeScreen.js';
3
+
4
+ /**
5
+ * Represents a guild received from an invite, includes welcome screen data if available.
6
+ *
7
+ * @extends {AnonymousGuild}
8
+ */
9
+ export class InviteGuild extends AnonymousGuild {
10
+ public client: any;
11
+ public welcomeScreen: any;
12
+ constructor(client, data) {
13
+ super(client, data);
14
+
15
+ /**
16
+ * The welcome screen for this invite guild
17
+ *
18
+ * @type {?WelcomeScreen}
19
+ */
20
+ this.welcomeScreen = data.welcome_screen === undefined ? null : new WelcomeScreen(this, data.welcome_screen);
21
+ }
22
+ }
@@ -0,0 +1,51 @@
1
+ import { createComponent } from '../util/Components.js';
2
+ import { Component } from './Component.js';
3
+
4
+ /**
5
+ * Represents a label component
6
+ *
7
+ * @extends {Component}
8
+ */
9
+ export class LabelComponent extends Component {
10
+ public component: any;
11
+ constructor({ component, ...data }) {
12
+ super(data);
13
+
14
+ /**
15
+ * The component in this label
16
+ *
17
+ * @type {Component}
18
+ * @readonly
19
+ */
20
+ this.component = createComponent(component);
21
+ }
22
+
23
+ /**
24
+ * The label of the component
25
+ *
26
+ * @type {string}
27
+ * @readonly
28
+ */
29
+ get label() {
30
+ return this.data.label;
31
+ }
32
+
33
+ /**
34
+ * The description of this component
35
+ *
36
+ * @type {?string}
37
+ * @readonly
38
+ */
39
+ get description() {
40
+ return this.data.description ?? null;
41
+ }
42
+
43
+ /**
44
+ * Returns the API-compatible JSON for this component
45
+ *
46
+ * @returns {APILabelComponent}
47
+ */
48
+ toJSON() {
49
+ return { ...this.data, component: this.component.toJSON() };
50
+ }
51
+ }
@@ -0,0 +1,8 @@
1
+ import { ThreadOnlyChannel } from './ThreadOnlyChannel.js';
2
+
3
+ /**
4
+ * Represents a media channel.
5
+ *
6
+ * @extends {ThreadOnlyChannel}
7
+ */
8
+ export class MediaChannel extends ThreadOnlyChannel {}
@@ -0,0 +1,31 @@
1
+ import { Component } from './Component.js';
2
+ import { MediaGalleryItem } from './MediaGalleryItem.js';
3
+
4
+ /**
5
+ * Represents a media gallery component
6
+ *
7
+ * @extends {Component}
8
+ */
9
+ export class MediaGalleryComponent extends Component {
10
+ public items: any;
11
+ constructor({ items, ...data }) {
12
+ super(data);
13
+
14
+ /**
15
+ * The items in this media gallery
16
+ *
17
+ * @type {MediaGalleryItem[]}
18
+ * @readonly
19
+ */
20
+ this.items = items.map(item => new MediaGalleryItem(item));
21
+ }
22
+
23
+ /**
24
+ * Returns the API-compatible JSON for this component
25
+ *
26
+ * @returns {APIMediaGalleryComponent}
27
+ */
28
+ toJSON() {
29
+ return { ...this.data, items: this.items.map(item => item.toJSON()) };
30
+ }
31
+ }
@@ -0,0 +1,54 @@
1
+ import { UnfurledMediaItem } from './UnfurledMediaItem.js';
2
+
3
+ /**
4
+ * Represents an item in a media gallery
5
+ */
6
+ export class MediaGalleryItem {
7
+ public data: any;
8
+ public media: any;
9
+ constructor({ media, ...data }) {
10
+ /**
11
+ * The API data associated with this component
12
+ *
13
+ * @type {APIMediaGalleryItem}
14
+ */
15
+ this.data = data;
16
+
17
+ /**
18
+ * The media associated with this media gallery item
19
+ *
20
+ * @type {UnfurledMediaItem}
21
+ * @readonly
22
+ */
23
+ this.media = new UnfurledMediaItem(media);
24
+ }
25
+
26
+ /**
27
+ * The description of this media gallery item
28
+ *
29
+ * @type {?string}
30
+ * @readonly
31
+ */
32
+ get description() {
33
+ return this.data.description ?? null;
34
+ }
35
+
36
+ /**
37
+ * Whether this media gallery item is spoilered
38
+ *
39
+ * @type {boolean}
40
+ * @readonly
41
+ */
42
+ get spoiler() {
43
+ return this.data.spoiler ?? false;
44
+ }
45
+
46
+ /**
47
+ * Returns the API-compatible JSON for this component
48
+ *
49
+ * @returns {APIMediaGalleryItem}
50
+ */
51
+ toJSON() {
52
+ return { ...this.data, media: this.media.toJSON() };
53
+ }
54
+ }
@@ -0,0 +1,8 @@
1
+ import { BaseSelectMenuComponent } from './BaseSelectMenuComponent.js';
2
+
3
+ /**
4
+ * Represents a mentionable select menu component
5
+ *
6
+ * @extends {BaseSelectMenuComponent}
7
+ */
8
+ export class MentionableSelectMenuComponent extends BaseSelectMenuComponent {}
@@ -0,0 +1,76 @@
1
+ import { Collection } from '@ovencord/collection';
2
+ import { Events } from '../util/Events.js';
3
+ import { MessageComponentInteraction } from './MessageComponentInteraction.js';
4
+
5
+ /**
6
+ * Represents a {@link ComponentType.MentionableSelect} select menu interaction.
7
+ *
8
+ * @extends {MessageComponentInteraction}
9
+ */
10
+ export class MentionableSelectMenuInteraction extends MessageComponentInteraction {
11
+ public client: any;
12
+ public users: any;
13
+ public members: any;
14
+ public roles: any;
15
+ constructor(client, data) {
16
+ super(client, data);
17
+ const { resolved, values } = data.data;
18
+ const { members, users, roles } = resolved ?? {};
19
+
20
+ /**
21
+ * An array of the selected user and role ids
22
+ *
23
+ * @type {Snowflake[]}
24
+ */
25
+ this.values = values ?? [];
26
+
27
+ /**
28
+ * Collection of the selected users
29
+ *
30
+ * @type {Collection<Snowflake, User>}
31
+ */
32
+ this.users = new Collection();
33
+
34
+ /**
35
+ * Collection of the selected users
36
+ *
37
+ * @type {Collection<Snowflake, GuildMember|APIGuildMember>}
38
+ */
39
+ this.members = new Collection();
40
+
41
+ /**
42
+ * Collection of the selected roles
43
+ *
44
+ * @type {Collection<Snowflake, Role|APIRole>}
45
+ */
46
+ this.roles = new Collection();
47
+
48
+ if (members) {
49
+ for (const [id, member] of Object.entries(members)) {
50
+ const user = users[id];
51
+ if (!user) {
52
+ this.client.emit(
53
+ Events.Debug,
54
+ `[MentionableSelectMenuInteraction] Received a member without a user, skipping ${id}`,
55
+ );
56
+
57
+ continue;
58
+ }
59
+
60
+ this.members.set(id, this.guild?.members._add({ user, ...member }) ?? { user, ...member });
61
+ }
62
+ }
63
+
64
+ if (users) {
65
+ for (const user of Object.values(users)) {
66
+ this.users.set(user.id, this.client.users._add(user));
67
+ }
68
+ }
69
+
70
+ if (roles) {
71
+ for (const role of Object.values(roles)) {
72
+ this.roles.set(role.id, this.guild?.roles._add(role) ?? role);
73
+ }
74
+ }
75
+ }
76
+ }