@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,26 @@
1
+ /* eslint-disable jsdoc/check-values */
2
+
3
+ import { ActivityFlags } from 'discord-api-types/v10';
4
+ import { BitField } from './BitField.js';
5
+
6
+ /**
7
+ * Data structure that makes it easy to interact with an {@link Activity#flags} bitfield.
8
+ *
9
+ * @extends {BitField}
10
+ */
11
+ export class ActivityFlagsBitField extends BitField {
12
+ /**
13
+ * Numeric activity flags.
14
+ *
15
+ * @type {ActivityFlags}
16
+ * @memberof ActivityFlagsBitField
17
+ */
18
+ static Flags = ActivityFlags;
19
+ }
20
+
21
+ /**
22
+ * @name ActivityFlagsBitField
23
+ * @kind constructor
24
+ * @memberof ActivityFlagsBitField
25
+ * @param {BitFieldResolvable} [bits=0] Bit(s) to read from
26
+ */
@@ -0,0 +1,43 @@
1
+ /* eslint-disable jsdoc/check-values */
2
+
3
+ import { ApplicationFlags } from 'discord-api-types/v10';
4
+ import { BitField } from './BitField.js';
5
+
6
+ /**
7
+ * Data structure that makes it easy to interact with a {@link ClientApplication#flags} bitfield.
8
+ *
9
+ * @extends {BitField}
10
+ */
11
+ export class ApplicationFlagsBitField extends BitField {
12
+ /**
13
+ * Numeric application flags. All available properties:
14
+ *
15
+ * @type {ApplicationFlags}
16
+ * @memberof ApplicationFlagsBitField
17
+ */
18
+ static Flags = ApplicationFlags;
19
+ }
20
+
21
+ /**
22
+ * @name ApplicationFlagsBitField
23
+ * @kind constructor
24
+ * @memberof ApplicationFlagsBitField
25
+ * @param {BitFieldResolvable} [bits=0] Bit(s) to read from
26
+ */
27
+
28
+ /**
29
+ * Bitfield of the packed bits
30
+ *
31
+ * @type {number}
32
+ * @name ApplicationFlagsBitField#bitfield
33
+ */
34
+
35
+ /**
36
+ * Data that can be resolved to give an application flag bit field. This can be:
37
+ * - A string (see {@link ApplicationFlagsBitField.Flags})
38
+ * - An application flag
39
+ * - An instance of ApplicationFlagsBitField
40
+ * - An Array of ApplicationFlagsResolvable
41
+ *
42
+ * @typedef {string|number|ApplicationFlagsBitField|ApplicationFlagsResolvable[]} ApplicationFlagsResolvable
43
+ */
@@ -0,0 +1,26 @@
1
+ /* eslint-disable jsdoc/check-values */
2
+
3
+ import { AttachmentFlags } from 'discord-api-types/v10';
4
+ import { BitField } from './BitField.js';
5
+
6
+ /**
7
+ * Data structure that makes it easy to interact with an {@link Attachment#flags} bitfield.
8
+ *
9
+ * @extends {BitField}
10
+ */
11
+ export class AttachmentFlagsBitField extends BitField {
12
+ /**
13
+ * Numeric attachment flags.
14
+ *
15
+ * @type {AttachmentFlags}
16
+ * @memberof AttachmentFlagsBitField
17
+ */
18
+ static Flags = AttachmentFlags;
19
+ }
20
+
21
+ /**
22
+ * @name AttachmentFlagsBitField
23
+ * @kind constructor
24
+ * @memberof AttachmentFlagsBitField
25
+ * @param {BitFieldResolvable} [bits=0] Bit(s) to read from
26
+ */
@@ -0,0 +1,178 @@
1
+ /* eslint-disable unicor */
2
+
3
+ import { DiscordjsRangeError, ErrorCodes } from '../errors/index.js';
4
+
5
+ /**
6
+ * Data structure that makes it easy to interact with a bitfield.
7
+ */
8
+ export class BitField {
9
+ /**
10
+ * Numeric bitfield flags.
11
+ */
12
+ static Flags: Record<string, any> = {};
13
+
14
+ /**
15
+ * Default bit value.
16
+ */
17
+ static DefaultBit: number | bigint = 0;
18
+
19
+ /**
20
+ * Bitfield of the packed bits.
21
+ */
22
+ public bitfield: number | bigint;
23
+
24
+ /**
25
+ * @param {any} [bits] Bit(s) to read from
26
+ */
27
+ constructor(bits: any = (BitField as any).DefaultBit) {
28
+ this.bitfield = (this.constructor as any).resolve(bits);
29
+ }
30
+
31
+ /**
32
+ * Checks whether the bitfield has a bit, or any of multiple bits.
33
+ *
34
+ * @param {any} bit Bit(s) to check for
35
+ * @returns {boolean}
36
+ */
37
+ any(bit: any): boolean {
38
+ return ((this.bitfield as any) & (this.constructor as any).resolve(bit)) !== (this.constructor as any).DefaultBit;
39
+ }
40
+
41
+ /**
42
+ * Checks if this bitfield equals another
43
+ *
44
+ * @param {any} bit Bit(s) to check for
45
+ * @returns {boolean}
46
+ */
47
+ equals(bit: any): boolean {
48
+ return this.bitfield === (this.constructor as any).resolve(bit);
49
+ }
50
+
51
+ /**
52
+ * Checks whether the bitfield has a bit, or multiple bits.
53
+ *
54
+ * @param {any} bit Bit(s) to check for
55
+ * @returns {boolean}
56
+ */
57
+ has(bit: any): boolean {
58
+ const resolvedBit = (this.constructor as any).resolve(bit);
59
+ return ((this.bitfield as any) & resolvedBit) === resolvedBit;
60
+ }
61
+
62
+ /**
63
+ * Gets all given bits that are missing from the bitfield.
64
+ *
65
+ * @param {any} bits Bit(s) to check for
66
+ * @param {...any} hasParams Additional parameters for the has method, if any
67
+ * @returns {string[]}
68
+ */
69
+ missing(bits: any, ...hasParams: any[]): string[] {
70
+ return (new (this.constructor as any)(bits)).remove(this).toArray(...hasParams);
71
+ }
72
+
73
+ /**
74
+ * Freezes these bits, making them immutable.
75
+ *
76
+ * @returns {Readonly<BitField>}
77
+ */
78
+ freeze(): Readonly<this> {
79
+ return Object.freeze(this);
80
+ }
81
+
82
+ /**
83
+ * Adds bits to these ones.
84
+ *
85
+ * @param {...any} bits Bits to add
86
+ * @returns {BitField} These bits or new BitField if the instance is frozen.
87
+ */
88
+ add(...bits: any[]): this {
89
+ let total: any = (this.constructor as any).DefaultBit;
90
+ for (const bit of bits) {
91
+ total |= (this.constructor as any).resolve(bit);
92
+ }
93
+
94
+ if (Object.isFrozen(this)) return new (this.constructor as any)((this.bitfield as any) | total);
95
+ (this.bitfield as any) |= total;
96
+ return this;
97
+ }
98
+
99
+ /**
100
+ * Removes bits from these.
101
+ *
102
+ * @param {...any} bits Bits to remove
103
+ * @returns {BitField} These bits or new BitField if the instance is frozen.
104
+ */
105
+ remove(...bits: any[]): this {
106
+ let total: any = (this.constructor as any).DefaultBit;
107
+ for (const bit of bits) {
108
+ total |= (this.constructor as any).resolve(bit);
109
+ }
110
+
111
+ if (Object.isFrozen(this)) return new (this.constructor as any)((this.bitfield as any) & ~total);
112
+ (this.bitfield as any) &= ~total;
113
+ return this;
114
+ }
115
+
116
+ /**
117
+ * Gets an object mapping field names to a {@link boolean} indicating whether the
118
+ * bit is available.
119
+ *
120
+ * @param {...any} hasParams Additional parameters for the has method, if any
121
+ * @returns {Object}
122
+ */
123
+ serialize(...hasParams: any[]): Record<string, boolean> {
124
+ const serialized: Record<string, boolean> = {};
125
+ for (const [flag, bit] of Object.entries((this.constructor as any).Flags)) {
126
+ if (isNaN(flag as any)) serialized[flag] = this.has(bit);
127
+ }
128
+
129
+ return serialized;
130
+ }
131
+
132
+ /**
133
+ * Gets an {@link Array} of bitfield names based on the bits available.
134
+ *
135
+ * @param {...any} hasParams Additional parameters for the has method, if any
136
+ * @returns {string[]}
137
+ */
138
+ toArray(...hasParams: any[]): string[] {
139
+ return [...this[Symbol.iterator](...hasParams)];
140
+ }
141
+
142
+ toJSON(): string | number {
143
+ return typeof this.bitfield === 'number' ? this.bitfield : this.bitfield.toString();
144
+ }
145
+
146
+ valueOf(): number | bigint {
147
+ return this.bitfield;
148
+ }
149
+
150
+ *[Symbol.iterator](...hasParams: any[]): Generator<string> {
151
+ for (const bitName of Object.keys((this.constructor as any).Flags)) {
152
+ if (isNaN(bitName as any) && this.has(bitName)) yield bitName;
153
+ }
154
+ }
155
+
156
+ /**
157
+ * Resolves bitfields to their numeric form.
158
+ *
159
+ * @param {any} [bit] bit(s) to resolve
160
+ * @returns {number|bigint}
161
+ */
162
+ static resolve(bit: any): number | bigint {
163
+ const { DefaultBit } = this;
164
+ if (typeof DefaultBit === typeof bit && bit >= DefaultBit) return bit;
165
+ if (bit instanceof BitField) return bit.bitfield;
166
+ if (Array.isArray(bit)) {
167
+ return bit.map(bit_ => this.resolve(bit_)).reduce((prev, bit_) => (prev as any) | (bit_ as any), DefaultBit);
168
+ }
169
+
170
+ if (typeof bit === 'string') {
171
+ if (!isNaN(bit as any)) return typeof DefaultBit === 'bigint' ? BigInt(bit) : Number(bit);
172
+ if (this.Flags[bit] !== undefined) return this.Flags[bit];
173
+ }
174
+
175
+ throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit);
176
+ }
177
+ }
178
+
@@ -0,0 +1,43 @@
1
+ /* eslint-disable jsdoc/check-values */
2
+
3
+ import { ChannelFlags } from 'discord-api-types/v10';
4
+ import { BitField } from './BitField.js';
5
+
6
+ /**
7
+ * Data structure that makes it easy to interact with a {@link BaseChannel#flags} bitfield.
8
+ *
9
+ * @extends {BitField}
10
+ */
11
+ export class ChannelFlagsBitField extends BitField {
12
+ /**
13
+ * Numeric guild channel flags.
14
+ *
15
+ * @type {ChannelFlags}
16
+ * @memberof ChannelFlagsBitField
17
+ */
18
+ static Flags = ChannelFlags;
19
+ }
20
+
21
+ /**
22
+ * @name ChannelFlagsBitField
23
+ * @kind constructor
24
+ * @memberof ChannelFlagsBitField
25
+ * @param {BitFieldResolvable} [bits=0] Bit(s) to read from
26
+ */
27
+
28
+ /**
29
+ * Bitfield of the packed bits
30
+ *
31
+ * @type {number}
32
+ * @name ChannelFlagsBitField#bitfield
33
+ */
34
+
35
+ /**
36
+ * Data that can be resolved to give a channel flag bitfield. This can be:
37
+ * - A string (see {@link ChannelFlagsBitField.Flags})
38
+ * - A channel flag
39
+ * - An instance of ChannelFlagsBitField
40
+ * - An Array of ChannelFlagsResolvable
41
+ *
42
+ * @typedef {string|number|ChannelFlagsBitField|ChannelFlagsResolvable[]} ChannelFlagsResolvable
43
+ */
@@ -0,0 +1,165 @@
1
+ import { lazy } from '@ovencord/util';
2
+ import { ChannelType } from 'discord-api-types/v10';
3
+
4
+ const getCategoryChannel = lazy(() => require('../structures/CategoryChannel.js').CategoryChannel);
5
+ const getDMChannel = lazy(() => require('../structures/DMChannel.js').DMChannel);
6
+ const getAnnouncementChannel = lazy(() => require('../structures/AnnouncementChannel.js').AnnouncementChannel);
7
+ const getStageChannel = lazy(() => require('../structures/StageChannel.js').StageChannel);
8
+ const getTextChannel = lazy(() => require('../structures/TextChannel.js').TextChannel);
9
+ const getThreadChannel = lazy(() => require('../structures/ThreadChannel.js').ThreadChannel);
10
+ const getVoiceChannel = lazy(() => require('../structures/VoiceChannel.js').VoiceChannel);
11
+ const getDirectoryChannel = lazy(() => require('../structures/DirectoryChannel.js').DirectoryChannel);
12
+ const getPartialGroupDMChannel = lazy(() => require('../structures/PartialGroupDMChannel.js').PartialGroupDMChannel);
13
+ const getForumChannel = lazy(() => require('../structures/ForumChannel.js').ForumChannel);
14
+ const getMediaChannel = lazy(() => require('../structures/MediaChannel.js').MediaChannel);
15
+
16
+ /**
17
+ * Extra options for creating a channel.
18
+ *
19
+ * @typedef {Object} CreateChannelOptions
20
+ * @property {boolean} [allowFromUnknownGuild] Whether to allow creating a channel from an unknown guild
21
+ * @private
22
+ */
23
+
24
+ /**
25
+ * Creates a discord.js channel from data received from the API.
26
+ *
27
+ * @param {Client} client The client
28
+ * @param {APIChannel} data The data of the channel to create
29
+ * @param {Guild} [guild] The guild where this channel belongs
30
+ * @param {CreateChannelOptions} [extras] Extra information to supply for creating this channel
31
+ * @returns {BaseChannel} Any kind of channel.
32
+ * @ignore
33
+ */
34
+ export function createChannel(client, data, guild, { allowUnknownGuild } = {}) {
35
+ let channel;
36
+ const resolvedGuild = guild ?? client.guilds.cache.get(data.guild_id);
37
+
38
+ if (!data.guild_id && !resolvedGuild) {
39
+ if ((data.recipients && data.type !== ChannelType.GroupDM) || data.type === ChannelType.DM) {
40
+ channel = new (getDMChannel())(client, data);
41
+ } else if (data.type === ChannelType.GroupDM) {
42
+ channel = new (getPartialGroupDMChannel())(client, data);
43
+ }
44
+ } else if (resolvedGuild || allowUnknownGuild) {
45
+ switch (data.type) {
46
+ case ChannelType.GuildText: {
47
+ channel = new (getTextChannel())(resolvedGuild, data, client);
48
+ break;
49
+ }
50
+
51
+ case ChannelType.GuildVoice: {
52
+ channel = new (getVoiceChannel())(resolvedGuild, data, client);
53
+ break;
54
+ }
55
+
56
+ case ChannelType.GuildCategory: {
57
+ channel = new (getCategoryChannel())(resolvedGuild, data, client);
58
+ break;
59
+ }
60
+
61
+ case ChannelType.GuildAnnouncement: {
62
+ channel = new (getAnnouncementChannel())(resolvedGuild, data, client);
63
+ break;
64
+ }
65
+
66
+ case ChannelType.GuildStageVoice: {
67
+ channel = new (getStageChannel())(resolvedGuild, data, client);
68
+ break;
69
+ }
70
+
71
+ case ChannelType.AnnouncementThread:
72
+ case ChannelType.PublicThread:
73
+ case ChannelType.PrivateThread: {
74
+ channel = new (getThreadChannel())(resolvedGuild, data, client);
75
+ if (!allowUnknownGuild) channel.parent?.threads.cache.set(channel.id, channel);
76
+ break;
77
+ }
78
+
79
+ case ChannelType.GuildDirectory:
80
+ channel = new (getDirectoryChannel())(resolvedGuild, data, client);
81
+ break;
82
+ case ChannelType.GuildForum:
83
+ channel = new (getForumChannel())(resolvedGuild, data, client);
84
+ break;
85
+ case ChannelType.GuildMedia:
86
+ channel = new (getMediaChannel())(resolvedGuild, data, client);
87
+ break;
88
+ default:
89
+ break;
90
+ }
91
+
92
+ if (channel && !allowUnknownGuild) resolvedGuild.channels?.cache.set(channel.id, channel);
93
+ }
94
+
95
+ return channel;
96
+ }
97
+
98
+ /**
99
+ * Transforms an API guild forum tag to camel-cased guild forum tag.
100
+ *
101
+ * @param {APIGuildForumTag} tag The tag to transform
102
+ * @returns {GuildForumTag}
103
+ * @ignore
104
+ */
105
+ export function transformAPIGuildForumTag(tag) {
106
+ return {
107
+ id: tag.id,
108
+ name: tag.name,
109
+ moderated: tag.moderated,
110
+ emoji:
111
+ (tag.emoji_id ?? tag.emoji_name)
112
+ ? {
113
+ id: tag.emoji_id,
114
+ name: tag.emoji_name,
115
+ }
116
+ : null,
117
+ };
118
+ }
119
+
120
+ /**
121
+ * Transforms a camel-cased guild forum tag to an API guild forum tag.
122
+ *
123
+ * @param {GuildForumTag} tag The tag to transform
124
+ * @returns {APIGuildForumTag}
125
+ * @ignore
126
+ */
127
+ export function transformGuildForumTag(tag) {
128
+ return {
129
+ id: tag.id,
130
+ name: tag.name,
131
+ moderated: tag.moderated,
132
+ emoji_id: tag.emoji?.id ?? null,
133
+ emoji_name: tag.emoji?.name ?? null,
134
+ };
135
+ }
136
+
137
+ /**
138
+ * Transforms an API guild forum default reaction object to a
139
+ * camel-cased guild forum default reaction object.
140
+ *
141
+ * @param {APIGuildForumDefaultReactionEmoji} defaultReaction The default reaction to transform
142
+ * @returns {DefaultReactionEmoji}
143
+ * @ignore
144
+ */
145
+ export function transformAPIGuildDefaultReaction(defaultReaction) {
146
+ return {
147
+ id: defaultReaction.emoji_id,
148
+ name: defaultReaction.emoji_name,
149
+ };
150
+ }
151
+
152
+ /**
153
+ * Transforms a camel-cased guild forum default reaction object to an
154
+ * API guild forum default reaction object.
155
+ *
156
+ * @param {DefaultReactionEmoji} defaultReaction The default reaction to transform
157
+ * @returns {APIGuildForumDefaultReactionEmoji}
158
+ * @ignore
159
+ */
160
+ export function transformGuildDefaultReaction(defaultReaction) {
161
+ return {
162
+ emoji_id: defaultReaction.id,
163
+ emoji_name: defaultReaction.name,
164
+ };
165
+ }
@@ -0,0 +1,72 @@
1
+
2
+ /**
3
+ * @typedef {Object} Colors
4
+ * @property {number} Aqua 0x1ABC9C | rgb(26,188,156)
5
+ * @property {number} Blue 0x3498DB | rgb(52,152,219)
6
+ * @property {number} Blurple 0x5865F2 | rgb(88,101,242)
7
+ * @property {number} DarkAqua 0x11806A | rgb(17,128,106)
8
+ * @property {number} DarkBlue 0x206694 | rgb(32,102,148)
9
+ * @property {number} DarkButNotBlack 0x2C2F33 | rgb(44,47,51)
10
+ * @property {number} DarkerGrey 0x7F8C8D | rgb(127,140,141)
11
+ * @property {number} DarkGold 0xC27C0E | rgb(194,124,14)
12
+ * @property {number} DarkGreen 0x1F8B4C | rgb(31,139,76)
13
+ * @property {number} DarkGrey 0x979C9F | rgb(151,156,159)
14
+ * @property {number} DarkNavy 0x2C3E50 | rgb(44,62,80)
15
+ * @property {number} DarkOrange 0xA84300 | rgb(168,67,0)
16
+ * @property {number} DarkPurple 0x71368A | rgb(113,54,138)
17
+ * @property {number} DarkRed 0x992D22 | rgb(153,45,34)
18
+ * @property {number} DarkVividPink 0xAD1457 | rgb(173,20,87)
19
+ * @property {number} Default 0x000000 | rgb(0,0,0)
20
+ * @property {number} Fuchsia 0xEB459E | rgb(235,69,158)
21
+ * @property {number} Gold 0xF1C40F | rgb(241,196,15)
22
+ * @property {number} Green 0x57F287 | rgb(87,242,135)
23
+ * @property {number} Grey 0x95A5A6 | rgb(149,165,166)
24
+ * @property {number} Greyple 0x99AAb5 | rgb(153,170,181)
25
+ * @property {number} LightGrey 0xBCC0C0 | rgb(188,192,192)
26
+ * @property {number} LuminousVividPink 0xE91E63 | rgb(233,30,99)
27
+ * @property {number} Navy 0x34495E | rgb(52,73,94)
28
+ * @property {number} NotQuiteBlack 0x23272A | rgb(35,39,42)
29
+ * @property {number} Orange 0xE67E22 | rgb(230,126,34)
30
+ * @property {number} Purple 0x9B59B6 | rgb(155,89,182)
31
+ * @property {number} Red 0xED4245 | rgb(237,66,69)
32
+ * @property {number} White 0xFFFFFF | rgb(255,255,255)
33
+ * @property {number} Yellow 0xFEE75C | rgb(254,231,92)
34
+ */
35
+
36
+ // JSDoc for IntelliSense purposes
37
+ /**
38
+ * @type {Colors}
39
+ * @ignore
40
+ */
41
+ export const Colors = {
42
+ Aqua: 0x1abc9c,
43
+ Blue: 0x3498db,
44
+ Blurple: 0x5865f2,
45
+ DarkAqua: 0x11806a,
46
+ DarkBlue: 0x206694,
47
+ DarkButNotBlack: 0x2c2f33,
48
+ DarkerGrey: 0x7f8c8d,
49
+ DarkGold: 0xc27c0e,
50
+ DarkGreen: 0x1f8b4c,
51
+ DarkGrey: 0x979c9f,
52
+ DarkNavy: 0x2c3e50,
53
+ DarkOrange: 0xa84300,
54
+ DarkPurple: 0x71368a,
55
+ DarkRed: 0x992d22,
56
+ DarkVividPink: 0xad1457,
57
+ Default: 0x000000,
58
+ Fuchsia: 0xeb459e,
59
+ Gold: 0xf1c40f,
60
+ Green: 0x57f287,
61
+ Grey: 0x95a5a6,
62
+ Greyple: 0x99aab5,
63
+ LightGrey: 0xbcc0c0,
64
+ LuminousVividPink: 0xe91e63,
65
+ Navy: 0x34495e,
66
+ NotQuiteBlack: 0x23272a,
67
+ Orange: 0xe67e22,
68
+ Purple: 0x9b59b6,
69
+ Red: 0xed4245,
70
+ White: 0xffffff,
71
+ Yellow: 0xfee75c,
72
+ };