seyfert 0.1.0

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 (345) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +57 -0
  3. package/lib/api/CDN.d.ts +220 -0
  4. package/lib/api/CDN.js +236 -0
  5. package/lib/api/REST.d.ts +127 -0
  6. package/lib/api/REST.js +424 -0
  7. package/lib/api/Router.d.ts +17 -0
  8. package/lib/api/Router.js +63 -0
  9. package/lib/api/Routes/applications.d.ts +46 -0
  10. package/lib/api/Routes/applications.js +2 -0
  11. package/lib/api/Routes/cdn.d.ts +66 -0
  12. package/lib/api/Routes/cdn.js +2 -0
  13. package/lib/api/Routes/channels.d.ts +109 -0
  14. package/lib/api/Routes/channels.js +2 -0
  15. package/lib/api/Routes/gateway.d.ts +11 -0
  16. package/lib/api/Routes/gateway.js +2 -0
  17. package/lib/api/Routes/guilds.d.ts +171 -0
  18. package/lib/api/Routes/guilds.js +2 -0
  19. package/lib/api/Routes/index.d.ts +13 -0
  20. package/lib/api/Routes/index.js +17 -0
  21. package/lib/api/Routes/interactions.d.ts +14 -0
  22. package/lib/api/Routes/interactions.js +2 -0
  23. package/lib/api/Routes/invites.d.ts +9 -0
  24. package/lib/api/Routes/invites.js +2 -0
  25. package/lib/api/Routes/stage-instances.d.ts +13 -0
  26. package/lib/api/Routes/stage-instances.js +2 -0
  27. package/lib/api/Routes/stickers.d.ts +11 -0
  28. package/lib/api/Routes/stickers.js +2 -0
  29. package/lib/api/Routes/users.d.ts +35 -0
  30. package/lib/api/Routes/users.js +2 -0
  31. package/lib/api/Routes/voice.d.ts +10 -0
  32. package/lib/api/Routes/voice.js +2 -0
  33. package/lib/api/Routes/webhooks.d.ts +29 -0
  34. package/lib/api/Routes/webhooks.js +2 -0
  35. package/lib/api/errors/DiscordAPIError.d.ts +51 -0
  36. package/lib/api/errors/DiscordAPIError.js +81 -0
  37. package/lib/api/errors/HTTPError.d.ts +20 -0
  38. package/lib/api/errors/HTTPError.js +28 -0
  39. package/lib/api/errors/RateLimitError.d.ts +19 -0
  40. package/lib/api/errors/RateLimitError.js +37 -0
  41. package/lib/api/handlers/BurstHandler.d.ts +51 -0
  42. package/lib/api/handlers/BurstHandler.js +124 -0
  43. package/lib/api/handlers/SequentialHandler.d.ts +81 -0
  44. package/lib/api/handlers/SequentialHandler.js +365 -0
  45. package/lib/api/handlers/Shared.d.ts +14 -0
  46. package/lib/api/handlers/Shared.js +125 -0
  47. package/lib/api/index.d.ts +5 -0
  48. package/lib/api/index.js +21 -0
  49. package/lib/api/interfaces/Handler.d.ts +21 -0
  50. package/lib/api/interfaces/Handler.js +2 -0
  51. package/lib/api/shared.d.ts +7 -0
  52. package/lib/api/shared.js +27 -0
  53. package/lib/api/utils/constants.d.ts +39 -0
  54. package/lib/api/utils/constants.js +50 -0
  55. package/lib/api/utils/types.d.ts +335 -0
  56. package/lib/api/utils/types.js +14 -0
  57. package/lib/api/utils/utils.d.ts +52 -0
  58. package/lib/api/utils/utils.js +159 -0
  59. package/lib/builders/ActionRow.d.ts +40 -0
  60. package/lib/builders/ActionRow.js +58 -0
  61. package/lib/builders/Attachment.d.ts +106 -0
  62. package/lib/builders/Attachment.js +196 -0
  63. package/lib/builders/Base.d.ts +10 -0
  64. package/lib/builders/Base.js +13 -0
  65. package/lib/builders/Button.d.ts +59 -0
  66. package/lib/builders/Button.js +94 -0
  67. package/lib/builders/MessageEmbed.d.ts +116 -0
  68. package/lib/builders/MessageEmbed.js +159 -0
  69. package/lib/builders/Modal.d.ts +111 -0
  70. package/lib/builders/Modal.js +162 -0
  71. package/lib/builders/SelectMenu.d.ts +201 -0
  72. package/lib/builders/SelectMenu.js +293 -0
  73. package/lib/builders/index.d.ts +12 -0
  74. package/lib/builders/index.js +54 -0
  75. package/lib/builders/types.d.ts +21 -0
  76. package/lib/builders/types.js +2 -0
  77. package/lib/cache/adapters/default.d.ts +24 -0
  78. package/lib/cache/adapters/default.js +118 -0
  79. package/lib/cache/adapters/index.d.ts +4 -0
  80. package/lib/cache/adapters/index.js +20 -0
  81. package/lib/cache/adapters/redis.d.ts +35 -0
  82. package/lib/cache/adapters/redis.js +180 -0
  83. package/lib/cache/adapters/types.d.ts +25 -0
  84. package/lib/cache/adapters/types.js +2 -0
  85. package/lib/cache/adapters/workeradapter.d.ts +24 -0
  86. package/lib/cache/adapters/workeradapter.js +76 -0
  87. package/lib/cache/index.d.ts +97 -0
  88. package/lib/cache/index.js +394 -0
  89. package/lib/cache/resources/channels.d.ts +7 -0
  90. package/lib/cache/resources/channels.js +20 -0
  91. package/lib/cache/resources/default/base.d.ts +25 -0
  92. package/lib/cache/resources/default/base.js +75 -0
  93. package/lib/cache/resources/default/guild-based.d.ts +33 -0
  94. package/lib/cache/resources/default/guild-based.js +91 -0
  95. package/lib/cache/resources/default/guild-related.d.ts +32 -0
  96. package/lib/cache/resources/default/guild-related.js +102 -0
  97. package/lib/cache/resources/emojis.d.ts +7 -0
  98. package/lib/cache/resources/emojis.js +17 -0
  99. package/lib/cache/resources/guilds.d.ts +10 -0
  100. package/lib/cache/resources/guilds.js +117 -0
  101. package/lib/cache/resources/members.d.ts +10 -0
  102. package/lib/cache/resources/members.js +41 -0
  103. package/lib/cache/resources/presence.d.ts +9 -0
  104. package/lib/cache/resources/presence.js +14 -0
  105. package/lib/cache/resources/roles.d.ts +7 -0
  106. package/lib/cache/resources/roles.js +17 -0
  107. package/lib/cache/resources/stage-instances.d.ts +5 -0
  108. package/lib/cache/resources/stage-instances.js +8 -0
  109. package/lib/cache/resources/stickers.d.ts +7 -0
  110. package/lib/cache/resources/stickers.js +17 -0
  111. package/lib/cache/resources/threads.d.ts +7 -0
  112. package/lib/cache/resources/threads.js +17 -0
  113. package/lib/cache/resources/users.d.ts +7 -0
  114. package/lib/cache/resources/users.js +17 -0
  115. package/lib/cache/resources/voice-states.d.ts +9 -0
  116. package/lib/cache/resources/voice-states.js +13 -0
  117. package/lib/client/base.d.ts +244 -0
  118. package/lib/client/base.js +178 -0
  119. package/lib/client/client.d.ts +32 -0
  120. package/lib/client/client.js +156 -0
  121. package/lib/client/httpclient.d.ts +21 -0
  122. package/lib/client/httpclient.js +143 -0
  123. package/lib/client/index.d.ts +4 -0
  124. package/lib/client/index.js +19 -0
  125. package/lib/client/oninteraction.d.ts +4 -0
  126. package/lib/client/oninteraction.js +180 -0
  127. package/lib/client/workerclient.d.ts +28 -0
  128. package/lib/client/workerclient.js +213 -0
  129. package/lib/collection.d.ts +233 -0
  130. package/lib/collection.js +371 -0
  131. package/lib/commands/applications/chat.d.ts +139 -0
  132. package/lib/commands/applications/chat.js +173 -0
  133. package/lib/commands/applications/chatcontext.d.ts +28 -0
  134. package/lib/commands/applications/chatcontext.js +53 -0
  135. package/lib/commands/applications/menu.d.ts +39 -0
  136. package/lib/commands/applications/menu.js +87 -0
  137. package/lib/commands/applications/menucontext.d.ts +25 -0
  138. package/lib/commands/applications/menucontext.js +64 -0
  139. package/lib/commands/applications/options.d.ts +67 -0
  140. package/lib/commands/applications/options.js +44 -0
  141. package/lib/commands/applications/shared.d.ts +35 -0
  142. package/lib/commands/applications/shared.js +2 -0
  143. package/lib/commands/decorators.d.ts +107 -0
  144. package/lib/commands/decorators.js +85 -0
  145. package/lib/commands/handler.d.ts +15 -0
  146. package/lib/commands/handler.js +140 -0
  147. package/lib/commands/index.d.ts +8 -0
  148. package/lib/commands/index.js +24 -0
  149. package/lib/commands/optionresolver.d.ts +49 -0
  150. package/lib/commands/optionresolver.js +146 -0
  151. package/lib/common/bot/watcher.d.ts +53 -0
  152. package/lib/common/bot/watcher.js +104 -0
  153. package/lib/common/index.d.ts +13 -0
  154. package/lib/common/index.js +30 -0
  155. package/lib/common/it/colors.d.ts +274 -0
  156. package/lib/common/it/colors.js +453 -0
  157. package/lib/common/it/constants.d.ts +36 -0
  158. package/lib/common/it/constants.js +40 -0
  159. package/lib/common/it/logger.d.ts +114 -0
  160. package/lib/common/it/logger.js +189 -0
  161. package/lib/common/it/utils.d.ts +107 -0
  162. package/lib/common/it/utils.js +275 -0
  163. package/lib/common/shorters/base.d.ts +5 -0
  164. package/lib/common/shorters/base.js +10 -0
  165. package/lib/common/shorters/channels.d.ts +90 -0
  166. package/lib/common/shorters/channels.js +95 -0
  167. package/lib/common/shorters/guilds.d.ts +389 -0
  168. package/lib/common/shorters/guilds.js +350 -0
  169. package/lib/common/shorters/members.d.ts +115 -0
  170. package/lib/common/shorters/members.js +179 -0
  171. package/lib/common/shorters/messages.d.ts +27 -0
  172. package/lib/common/shorters/messages.js +117 -0
  173. package/lib/common/shorters/roles.d.ts +12 -0
  174. package/lib/common/shorters/roles.js +51 -0
  175. package/lib/common/shorters/templates.d.ts +12 -0
  176. package/lib/common/shorters/templates.js +29 -0
  177. package/lib/common/shorters/users.d.ts +11 -0
  178. package/lib/common/shorters/users.js +42 -0
  179. package/lib/common/shorters/webhook.d.ts +33 -0
  180. package/lib/common/shorters/webhook.js +69 -0
  181. package/lib/common/types/options.d.ts +10 -0
  182. package/lib/common/types/options.js +2 -0
  183. package/lib/common/types/resolvables.d.ts +10 -0
  184. package/lib/common/types/resolvables.js +2 -0
  185. package/lib/common/types/util.d.ts +90 -0
  186. package/lib/common/types/util.js +2 -0
  187. package/lib/common/types/write.d.ts +21 -0
  188. package/lib/common/types/write.js +2 -0
  189. package/lib/components/ActionRow.d.ts +10 -0
  190. package/lib/components/ActionRow.js +13 -0
  191. package/lib/components/ButtonComponent.d.ts +19 -0
  192. package/lib/components/ButtonComponent.js +34 -0
  193. package/lib/components/ChannelSelectMenuComponent.d.ts +6 -0
  194. package/lib/components/ChannelSelectMenuComponent.js +12 -0
  195. package/lib/components/MentionableSelectMenuComponent.d.ts +4 -0
  196. package/lib/components/MentionableSelectMenuComponent.js +7 -0
  197. package/lib/components/RoleSelectMenuComponent.d.ts +4 -0
  198. package/lib/components/RoleSelectMenuComponent.js +7 -0
  199. package/lib/components/StringSelectMenuComponent.d.ts +6 -0
  200. package/lib/components/StringSelectMenuComponent.js +12 -0
  201. package/lib/components/TextInputComponent.d.ts +7 -0
  202. package/lib/components/TextInputComponent.js +14 -0
  203. package/lib/components/UserSelectMenuComponent.d.ts +4 -0
  204. package/lib/components/UserSelectMenuComponent.js +7 -0
  205. package/lib/components/command.d.ts +23 -0
  206. package/lib/components/command.js +15 -0
  207. package/lib/components/handler.d.ts +48 -0
  208. package/lib/components/handler.js +231 -0
  209. package/lib/components/index.d.ts +20 -0
  210. package/lib/components/index.js +55 -0
  211. package/lib/components/listener.d.ts +11 -0
  212. package/lib/components/listener.js +18 -0
  213. package/lib/events/event.d.ts +23 -0
  214. package/lib/events/event.js +2 -0
  215. package/lib/events/handler.d.ts +19 -0
  216. package/lib/events/handler.js +112 -0
  217. package/lib/events/hooks/application_command.d.ts +12 -0
  218. package/lib/events/hooks/application_command.js +8 -0
  219. package/lib/events/hooks/auto_moderation.d.ts +22 -0
  220. package/lib/events/hooks/auto_moderation.js +21 -0
  221. package/lib/events/hooks/channel.d.ts +11 -0
  222. package/lib/events/hooks/channel.js +24 -0
  223. package/lib/events/hooks/custom.d.ts +4 -0
  224. package/lib/events/hooks/custom.js +11 -0
  225. package/lib/events/hooks/dispatch.d.ts +5 -0
  226. package/lib/events/hooks/dispatch.js +12 -0
  227. package/lib/events/hooks/entitlement.d.ts +35 -0
  228. package/lib/events/hooks/entitlement.js +16 -0
  229. package/lib/events/hooks/guild.d.ts +228 -0
  230. package/lib/events/hooks/guild.js +101 -0
  231. package/lib/events/hooks/index.d.ts +23 -0
  232. package/lib/events/hooks/index.js +34 -0
  233. package/lib/events/hooks/integration.d.ts +94 -0
  234. package/lib/events/hooks/integration.js +27 -0
  235. package/lib/events/hooks/interactions.d.ts +4 -0
  236. package/lib/events/hooks/interactions.js +8 -0
  237. package/lib/events/hooks/invite.d.ts +21 -0
  238. package/lib/events/hooks/invite.js +12 -0
  239. package/lib/events/hooks/message.d.ts +69 -0
  240. package/lib/events/hooks/message.js +37 -0
  241. package/lib/events/hooks/presence.d.ts +27 -0
  242. package/lib/events/hooks/presence.js +8 -0
  243. package/lib/events/hooks/stage.d.ts +29 -0
  244. package/lib/events/hooks/stage.js +16 -0
  245. package/lib/events/hooks/thread.d.ts +198 -0
  246. package/lib/events/hooks/thread.js +29 -0
  247. package/lib/events/hooks/typing.d.ts +16 -0
  248. package/lib/events/hooks/typing.js +14 -0
  249. package/lib/events/hooks/user.d.ts +4 -0
  250. package/lib/events/hooks/user.js +8 -0
  251. package/lib/events/hooks/voice.d.ts +37 -0
  252. package/lib/events/hooks/voice.js +18 -0
  253. package/lib/events/hooks/webhook.d.ts +6 -0
  254. package/lib/events/hooks/webhook.js +8 -0
  255. package/lib/events/index.d.ts +2 -0
  256. package/lib/events/index.js +18 -0
  257. package/lib/index.d.ts +79 -0
  258. package/lib/index.js +104 -0
  259. package/lib/langs/handler.d.ts +11 -0
  260. package/lib/langs/handler.js +34 -0
  261. package/lib/langs/index.d.ts +2 -0
  262. package/lib/langs/index.js +18 -0
  263. package/lib/langs/router.d.ts +18 -0
  264. package/lib/langs/router.js +42 -0
  265. package/lib/structures/AnonymousGuild.d.ts +7 -0
  266. package/lib/structures/AnonymousGuild.js +11 -0
  267. package/lib/structures/AutoModerationRule.d.ts +22 -0
  268. package/lib/structures/AutoModerationRule.js +34 -0
  269. package/lib/structures/ClientUser.d.ts +25 -0
  270. package/lib/structures/ClientUser.js +52 -0
  271. package/lib/structures/Guild.d.ts +86 -0
  272. package/lib/structures/Guild.js +66 -0
  273. package/lib/structures/GuildEmoji.d.ts +29 -0
  274. package/lib/structures/GuildEmoji.js +47 -0
  275. package/lib/structures/GuildMember.d.ts +92 -0
  276. package/lib/structures/GuildMember.js +137 -0
  277. package/lib/structures/GuildPreview.d.ts +10 -0
  278. package/lib/structures/GuildPreview.js +14 -0
  279. package/lib/structures/GuildRole.d.ts +21 -0
  280. package/lib/structures/GuildRole.js +32 -0
  281. package/lib/structures/GuildTemplate.d.ts +23 -0
  282. package/lib/structures/GuildTemplate.js +36 -0
  283. package/lib/structures/Interaction.d.ts +152 -0
  284. package/lib/structures/Interaction.js +409 -0
  285. package/lib/structures/Message.d.ts +53 -0
  286. package/lib/structures/Message.js +123 -0
  287. package/lib/structures/Sticker.d.ts +27 -0
  288. package/lib/structures/Sticker.js +44 -0
  289. package/lib/structures/User.d.ts +20 -0
  290. package/lib/structures/User.js +37 -0
  291. package/lib/structures/Webhook.d.ts +42 -0
  292. package/lib/structures/Webhook.js +63 -0
  293. package/lib/structures/channels.d.ts +232 -0
  294. package/lib/structures/channels.js +366 -0
  295. package/lib/structures/extra/Base.d.ts +7 -0
  296. package/lib/structures/extra/Base.js +39 -0
  297. package/lib/structures/extra/BaseComponent.d.ts +9 -0
  298. package/lib/structures/extra/BaseComponent.js +12 -0
  299. package/lib/structures/extra/BaseGuild.d.ts +40 -0
  300. package/lib/structures/extra/BaseGuild.js +71 -0
  301. package/lib/structures/extra/BaseSelectMenuComponent.d.ts +9 -0
  302. package/lib/structures/extra/BaseSelectMenuComponent.js +13 -0
  303. package/lib/structures/extra/BitField.d.ts +14 -0
  304. package/lib/structures/extra/BitField.js +56 -0
  305. package/lib/structures/extra/DiscordBase.d.ts +18 -0
  306. package/lib/structures/extra/DiscordBase.js +28 -0
  307. package/lib/structures/extra/Permissions.d.ts +54 -0
  308. package/lib/structures/extra/Permissions.js +9 -0
  309. package/lib/structures/extra/functions.d.ts +11 -0
  310. package/lib/structures/extra/functions.js +69 -0
  311. package/lib/structures/index.d.ts +15 -0
  312. package/lib/structures/index.js +31 -0
  313. package/lib/websocket/SharedTypes.d.ts +128 -0
  314. package/lib/websocket/SharedTypes.js +2 -0
  315. package/lib/websocket/constants/index.d.ts +26 -0
  316. package/lib/websocket/constants/index.js +31 -0
  317. package/lib/websocket/discord/basesocket.d.ts +12 -0
  318. package/lib/websocket/discord/basesocket.js +37 -0
  319. package/lib/websocket/discord/events/memberUpdate.d.ts +16 -0
  320. package/lib/websocket/discord/events/memberUpdate.js +47 -0
  321. package/lib/websocket/discord/events/presenceUpdate.d.ts +24 -0
  322. package/lib/websocket/discord/events/presenceUpdate.js +46 -0
  323. package/lib/websocket/discord/handlemessage.d.ts +0 -0
  324. package/lib/websocket/discord/handlemessage.js +1 -0
  325. package/lib/websocket/discord/index.d.ts +4 -0
  326. package/lib/websocket/discord/index.js +20 -0
  327. package/lib/websocket/discord/memberUpdate.d.ts +16 -0
  328. package/lib/websocket/discord/memberUpdate.js +47 -0
  329. package/lib/websocket/discord/shard.d.ts +46 -0
  330. package/lib/websocket/discord/shard.js +278 -0
  331. package/lib/websocket/discord/sharder.d.ts +25 -0
  332. package/lib/websocket/discord/sharder.js +153 -0
  333. package/lib/websocket/discord/shared.d.ts +99 -0
  334. package/lib/websocket/discord/shared.js +8 -0
  335. package/lib/websocket/discord/worker.d.ts +43 -0
  336. package/lib/websocket/discord/worker.js +2 -0
  337. package/lib/websocket/discord/workermanager.d.ts +69 -0
  338. package/lib/websocket/discord/workermanager.js +273 -0
  339. package/lib/websocket/index.d.ts +3 -0
  340. package/lib/websocket/index.js +19 -0
  341. package/lib/websocket/structures/index.d.ts +117 -0
  342. package/lib/websocket/structures/index.js +261 -0
  343. package/lib/websocket/structures/timeout.d.ts +20 -0
  344. package/lib/websocket/structures/timeout.js +75 -0
  345. package/package.json +70 -0
@@ -0,0 +1,366 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DirectoryChannel = exports.NewsChannel = exports.CategoryChannel = exports.ThreadChannel = exports.ForumChannel = exports.MediaChannel = exports.StageChannel = exports.VoiceChannel = exports.DMChannel = exports.TextGuildChannel = exports.WebhookChannelMethods = exports.WebhookGuildMethods = exports.VoiceChannelMethods = exports.ThreadOnlyMethods = exports.TopicableGuildChannel = exports.TextBaseGuildChannel = exports.MessagesMethods = exports.BaseGuildChannel = exports.BaseChannel = void 0;
10
+ const v10_1 = require("discord-api-types/v10");
11
+ const ts_mixer_1 = require("ts-mixer");
12
+ const builders_1 = require("../builders");
13
+ const components_1 = require("../components");
14
+ const Webhook_1 = require("./Webhook");
15
+ const DiscordBase_1 = require("./extra/DiscordBase");
16
+ const functions_1 = require("./extra/functions");
17
+ class BaseChannel extends DiscordBase_1.DiscordBase {
18
+ constructor(client, data) {
19
+ super(client, data);
20
+ }
21
+ static __intent__(id) {
22
+ return id === '@me' ? 'DirectMessages' : 'Guilds';
23
+ }
24
+ /** The URL to the channel */
25
+ get url() {
26
+ return (0, functions_1.channelLink)(this.id);
27
+ }
28
+ fetch(force = false) {
29
+ return this.client.channels.fetch(this.id, force);
30
+ }
31
+ delete(reason) {
32
+ return this.client.channels.delete(this.id, { reason });
33
+ }
34
+ edit(body, reason) {
35
+ return this.client.channels.edit(this.id, body, { reason });
36
+ }
37
+ toString() {
38
+ return `<#${this.id}>`;
39
+ }
40
+ isStage() {
41
+ return this.type === v10_1.ChannelType.GuildStageVoice;
42
+ }
43
+ isMedia() {
44
+ return this.type === v10_1.ChannelType.GuildMedia;
45
+ }
46
+ isDM() {
47
+ return [v10_1.ChannelType.DM, v10_1.ChannelType.GroupDM].includes(this.type);
48
+ }
49
+ isForum() {
50
+ return this.type === v10_1.ChannelType.GuildForum;
51
+ }
52
+ isThread() {
53
+ return [v10_1.ChannelType.PublicThread, v10_1.ChannelType.PrivateThread, v10_1.ChannelType.AnnouncementThread].includes(this.type);
54
+ }
55
+ isDirectory() {
56
+ return this.type === v10_1.ChannelType.GuildDirectory;
57
+ }
58
+ isVoice() {
59
+ return this.type === v10_1.ChannelType.GuildVoice;
60
+ }
61
+ isTextGuild() {
62
+ return this.type === v10_1.ChannelType.GuildText;
63
+ }
64
+ isCategory() {
65
+ return this.type === v10_1.ChannelType.GuildCategory;
66
+ }
67
+ isNews() {
68
+ return this.type === v10_1.ChannelType.GuildAnnouncement;
69
+ }
70
+ isTextable() {
71
+ return 'messages' in this;
72
+ }
73
+ isGuildTextable() {
74
+ return !this.isDM() && this.isTextable();
75
+ }
76
+ isThreadOnly() {
77
+ return this.isForum() || this.isMedia();
78
+ }
79
+ is(channelTypes) {
80
+ return channelTypes.some(x => v10_1.ChannelType[x] === this.type);
81
+ }
82
+ static allMethods(ctx) {
83
+ return {
84
+ list: (force = false) => ctx.client.guilds.channels.list(ctx.guildId, force),
85
+ fetch: (id, force = false) => ctx.client.guilds.channels.fetch(ctx.guildId, id, force),
86
+ create: (body) => ctx.client.guilds.channels.create(ctx.guildId, body),
87
+ delete: (id, reason) => ctx.client.guilds.channels.delete(ctx.guildId, id, reason),
88
+ edit: (id, body, reason) => ctx.client.guilds.channels.edit(ctx.guildId, id, body, reason),
89
+ editPositions: (body) => ctx.client.guilds.channels.editPositions(ctx.guildId, body),
90
+ };
91
+ }
92
+ }
93
+ exports.BaseChannel = BaseChannel;
94
+ class BaseGuildChannel extends BaseChannel {
95
+ async guild(force = false) {
96
+ return this.client.guilds.fetch(this.guildId, force);
97
+ }
98
+ get url() {
99
+ return (0, functions_1.channelLink)(this.id, this.guildId);
100
+ }
101
+ setPosition(position, reason) {
102
+ return this.edit({ position }, reason);
103
+ }
104
+ setName(name, reason) {
105
+ return this.edit({ name }, reason);
106
+ }
107
+ setParent(parent_id, reason) {
108
+ return this.edit({ parent_id }, reason);
109
+ }
110
+ }
111
+ exports.BaseGuildChannel = BaseGuildChannel;
112
+ class MessagesMethods extends DiscordBase_1.DiscordBase {
113
+ typing() {
114
+ return this.client.channels.typing(this.id);
115
+ }
116
+ messages = MessagesMethods.messages({ client: this.client, channelId: this.id });
117
+ pins = MessagesMethods.pins({ client: this.client, channelId: this.id });
118
+ reactions = MessagesMethods.reactions({ client: this.client, channelId: this.id });
119
+ static messages(ctx) {
120
+ return {
121
+ write: (body) => ctx.client.messages.write(ctx.channelId, body),
122
+ edit: (messageId, body) => ctx.client.messages.edit(messageId, ctx.channelId, body),
123
+ crosspost: (messageId, reason) => ctx.client.messages.crosspost(messageId, ctx.channelId, reason),
124
+ delete: (messageId, reason) => ctx.client.messages.delete(messageId, ctx.channelId, reason),
125
+ fetch: (messageId) => ctx.client.messages.fetch(messageId, ctx.channelId),
126
+ purge: (messages, reason) => ctx.client.messages.purge(messages, ctx.channelId, reason),
127
+ };
128
+ }
129
+ static reactions(ctx) {
130
+ return {
131
+ add: (messageId, emoji) => ctx.client.messages.reactions.add(messageId, ctx.channelId, emoji),
132
+ delete: (messageId, emoji, userId = '@me') => ctx.client.messages.reactions.delete(messageId, ctx.channelId, emoji, userId),
133
+ fetch: (messageId, emoji, query) => ctx.client.messages.reactions.fetch(messageId, ctx.channelId, emoji, query),
134
+ purge: (messageId, emoji) => ctx.client.messages.reactions.purge(messageId, ctx.channelId, emoji),
135
+ };
136
+ }
137
+ static pins(ctx) {
138
+ return {
139
+ fetch: () => ctx.client.channels.pins.fetch(ctx.channelId),
140
+ set: (messageId, reason) => ctx.client.channels.pins.set(messageId, ctx.channelId, reason),
141
+ delete: (messageId, reason) => ctx.client.channels.pins.delete(messageId, ctx.channelId, reason),
142
+ };
143
+ }
144
+ static transformMessageBody(body) {
145
+ return {
146
+ ...body,
147
+ components: body.components
148
+ ? (body?.components instanceof components_1.ComponentsListener ? body.components.components : body.components).map(x => 'toJSON' in x ? x.toJSON() : x)
149
+ : undefined,
150
+ embeds: body.embeds?.map(x => (x instanceof builders_1.Embed ? x.toJSON() : x)) ?? undefined,
151
+ //?
152
+ attachments: body.attachments?.map((x, i) => ({ id: i, ...(0, builders_1.resolveAttachment)(x) })) ?? undefined,
153
+ };
154
+ }
155
+ }
156
+ exports.MessagesMethods = MessagesMethods;
157
+ let TextBaseGuildChannel = class TextBaseGuildChannel extends BaseGuildChannel {
158
+ };
159
+ exports.TextBaseGuildChannel = TextBaseGuildChannel;
160
+ exports.TextBaseGuildChannel = TextBaseGuildChannel = __decorate([
161
+ (0, ts_mixer_1.mix)(MessagesMethods)
162
+ ], TextBaseGuildChannel);
163
+ function channelFrom(data, client) {
164
+ switch (data.type) {
165
+ case v10_1.ChannelType.GuildStageVoice:
166
+ return new StageChannel(client, data);
167
+ case v10_1.ChannelType.GuildMedia:
168
+ return new MediaChannel(client, data);
169
+ case v10_1.ChannelType.DM:
170
+ return new DMChannel(client, data);
171
+ case v10_1.ChannelType.GuildForum:
172
+ return new ForumChannel(client, data);
173
+ case v10_1.ChannelType.AnnouncementThread:
174
+ case v10_1.ChannelType.PrivateThread:
175
+ case v10_1.ChannelType.PublicThread:
176
+ return new ThreadChannel(client, data);
177
+ case v10_1.ChannelType.GuildDirectory:
178
+ return new DirectoryChannel(client, data);
179
+ case v10_1.ChannelType.GuildVoice:
180
+ return new VoiceChannel(client, data);
181
+ case v10_1.ChannelType.GuildText:
182
+ return new TextGuildChannel(client, data);
183
+ case v10_1.ChannelType.GuildCategory:
184
+ return new CategoryChannel(client, data);
185
+ case v10_1.ChannelType.GuildAnnouncement:
186
+ return new NewsChannel(client, data);
187
+ default:
188
+ if ('guild_id' in data) {
189
+ return new BaseGuildChannel(client, data);
190
+ }
191
+ return new BaseChannel(client, data);
192
+ }
193
+ }
194
+ exports.default = channelFrom;
195
+ class TopicableGuildChannel extends DiscordBase_1.DiscordBase {
196
+ setTopic(topic, reason) {
197
+ return this.edit({ topic }, reason);
198
+ }
199
+ }
200
+ exports.TopicableGuildChannel = TopicableGuildChannel;
201
+ let ThreadOnlyMethods = class ThreadOnlyMethods extends DiscordBase_1.DiscordBase {
202
+ setTags(tags, reason) {
203
+ return this.edit({ available_tags: tags }, reason);
204
+ }
205
+ setAutoArchiveDuration(duration, reason) {
206
+ return this.edit({ default_auto_archive_duration: duration }, reason);
207
+ }
208
+ setReactionEmoji(emoji, reason) {
209
+ return this.edit({ default_reaction_emoji: emoji }, reason);
210
+ }
211
+ setSortOrder(sort, reason) {
212
+ return this.edit({ default_sort_order: sort }, reason);
213
+ }
214
+ setThreadRateLimit(rate, reason) {
215
+ return this.edit({ default_thread_rate_limit_per_user: rate }, reason);
216
+ }
217
+ };
218
+ exports.ThreadOnlyMethods = ThreadOnlyMethods;
219
+ exports.ThreadOnlyMethods = ThreadOnlyMethods = __decorate([
220
+ (0, ts_mixer_1.mix)(TopicableGuildChannel)
221
+ ], ThreadOnlyMethods);
222
+ class VoiceChannelMethods extends DiscordBase_1.DiscordBase {
223
+ setBitrate(bitrate, reason) {
224
+ return this.edit({ bitrate }, reason);
225
+ }
226
+ setUserLimit(user_limit, reason) {
227
+ return this.edit({ user_limit: user_limit ?? 0 }, reason);
228
+ }
229
+ setRTC(rtc_region, reason) {
230
+ return this.edit({ rtc_region }, reason);
231
+ }
232
+ setVideoQuality(quality, reason) {
233
+ return this.edit({ video_quality_mode: v10_1.VideoQualityMode[quality] }, reason);
234
+ }
235
+ }
236
+ exports.VoiceChannelMethods = VoiceChannelMethods;
237
+ class WebhookGuildMethods extends DiscordBase_1.DiscordBase {
238
+ webhooks = WebhookGuildMethods.guild({ client: this.client, guildId: this.id });
239
+ static guild(ctx) {
240
+ return {
241
+ list: async () => {
242
+ const webhooks = await ctx.client.proxy.guilds(ctx.guildId).webhooks.get();
243
+ return webhooks.map(webhook => new Webhook_1.Webhook(ctx.client, webhook));
244
+ },
245
+ };
246
+ }
247
+ }
248
+ exports.WebhookGuildMethods = WebhookGuildMethods;
249
+ class WebhookChannelMethods extends DiscordBase_1.DiscordBase {
250
+ webhooks = WebhookChannelMethods.channel({ client: this.client, channelId: this.id });
251
+ static channel(ctx) {
252
+ return {
253
+ list: async () => {
254
+ const webhooks = await ctx.client.proxy.channels(ctx.channelId).webhooks.get();
255
+ return webhooks.map(webhook => new Webhook_1.Webhook(ctx.client, webhook));
256
+ },
257
+ create: async (body) => {
258
+ const webhook = await ctx.client.proxy.channels(ctx.channelId).webhooks.post({
259
+ body,
260
+ });
261
+ return new Webhook_1.Webhook(ctx.client, webhook);
262
+ },
263
+ };
264
+ }
265
+ }
266
+ exports.WebhookChannelMethods = WebhookChannelMethods;
267
+ let TextGuildChannel = class TextGuildChannel extends BaseGuildChannel {
268
+ setRatelimitPerUser(rate_limit_per_user) {
269
+ return this.edit({ rate_limit_per_user });
270
+ }
271
+ setNsfw(nsfw = true, reason) {
272
+ return this.edit({ nsfw }, reason);
273
+ }
274
+ };
275
+ exports.TextGuildChannel = TextGuildChannel;
276
+ exports.TextGuildChannel = TextGuildChannel = __decorate([
277
+ (0, ts_mixer_1.mix)(TextBaseGuildChannel, WebhookChannelMethods)
278
+ ], TextGuildChannel);
279
+ let DMChannel = class DMChannel extends BaseChannel {
280
+ };
281
+ exports.DMChannel = DMChannel;
282
+ exports.DMChannel = DMChannel = __decorate([
283
+ (0, ts_mixer_1.mix)(MessagesMethods)
284
+ ], DMChannel);
285
+ let VoiceChannel = class VoiceChannel extends BaseChannel {
286
+ };
287
+ exports.VoiceChannel = VoiceChannel;
288
+ exports.VoiceChannel = VoiceChannel = __decorate([
289
+ (0, ts_mixer_1.mix)(TextGuildChannel, WebhookChannelMethods, VoiceChannelMethods)
290
+ ], VoiceChannel);
291
+ let StageChannel = class StageChannel extends BaseChannel {
292
+ };
293
+ exports.StageChannel = StageChannel;
294
+ exports.StageChannel = StageChannel = __decorate([
295
+ (0, ts_mixer_1.mix)(TopicableGuildChannel, VoiceChannelMethods)
296
+ ], StageChannel);
297
+ let MediaChannel = class MediaChannel extends BaseChannel {
298
+ };
299
+ exports.MediaChannel = MediaChannel;
300
+ exports.MediaChannel = MediaChannel = __decorate([
301
+ (0, ts_mixer_1.mix)(ThreadOnlyMethods)
302
+ ], MediaChannel);
303
+ let ForumChannel = class ForumChannel extends BaseChannel {
304
+ };
305
+ exports.ForumChannel = ForumChannel;
306
+ exports.ForumChannel = ForumChannel = __decorate([
307
+ (0, ts_mixer_1.mix)(ThreadOnlyMethods, WebhookChannelMethods)
308
+ ], ForumChannel);
309
+ let ThreadChannel = class ThreadChannel extends BaseChannel {
310
+ webhooks = WebhookChannelMethods.channel({
311
+ client: this.client,
312
+ channelId: this.parentId,
313
+ });
314
+ setRatelimitPerUser(rate_limit_per_user) {
315
+ return this.edit({ rate_limit_per_user });
316
+ }
317
+ pin(reason) {
318
+ return this.edit({ flags: (this.flags ?? 0) | v10_1.ChannelFlags.Pinned }, reason);
319
+ }
320
+ unpin(reason) {
321
+ return this.edit({ flags: (this.flags ?? 0) & ~v10_1.ChannelFlags.Pinned }, reason);
322
+ }
323
+ setTags(applied_tags, reason) {
324
+ /**
325
+ * The available_tags field can be set when creating or updating a channel.
326
+ * Which determines which tags can be set on individual threads within the thread's applied_tags field.
327
+ */
328
+ return this.edit({ applied_tags }, reason);
329
+ }
330
+ setArchived(archived = true, reason) {
331
+ return this.edit({ archived }, reason);
332
+ }
333
+ setAutoArchiveDuration(auto_archive_duration, reason) {
334
+ return this.edit({ auto_archive_duration }, reason);
335
+ }
336
+ setInvitable(invitable = true, reason) {
337
+ return this.edit({ invitable }, reason);
338
+ }
339
+ setLocked(locked = true, reason) {
340
+ return this.edit({ locked }, reason);
341
+ }
342
+ };
343
+ exports.ThreadChannel = ThreadChannel;
344
+ exports.ThreadChannel = ThreadChannel = __decorate([
345
+ (0, ts_mixer_1.mix)(TextBaseGuildChannel)
346
+ ], ThreadChannel);
347
+ class CategoryChannel extends BaseGuildChannel {
348
+ }
349
+ exports.CategoryChannel = CategoryChannel;
350
+ let NewsChannel = class NewsChannel extends BaseChannel {
351
+ addFollower(webhook_channel_id, reason) {
352
+ return this.api.channels(this.id).followers.post({
353
+ body: {
354
+ webhook_channel_id,
355
+ },
356
+ reason,
357
+ });
358
+ }
359
+ };
360
+ exports.NewsChannel = NewsChannel;
361
+ exports.NewsChannel = NewsChannel = __decorate([
362
+ (0, ts_mixer_1.mix)(WebhookChannelMethods)
363
+ ], NewsChannel);
364
+ class DirectoryChannel extends BaseChannel {
365
+ }
366
+ exports.DirectoryChannel = DirectoryChannel;
@@ -0,0 +1,7 @@
1
+ import type { BaseClient } from '../../client/base';
2
+ import type { UsingClient } from '../../commands';
3
+ /** */
4
+ export declare abstract class Base {
5
+ constructor(client: BaseClient);
6
+ readonly client: UsingClient;
7
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Base = void 0;
4
+ const api_1 = require("../../api");
5
+ const common_1 = require("../../common");
6
+ /** */
7
+ class Base {
8
+ constructor(client) {
9
+ Object.assign(this, { client });
10
+ }
11
+ /**@internal */
12
+ get rest() {
13
+ return this.client.rest;
14
+ }
15
+ /**@internal */
16
+ get cache() {
17
+ return this.client.cache;
18
+ }
19
+ /**@internal */
20
+ get api() {
21
+ const rest = this.rest;
22
+ return api_1.Router.prototype.createProxy.call({
23
+ rest,
24
+ noop: () => {
25
+ return;
26
+ },
27
+ createProxy(route) {
28
+ return api_1.Router.prototype.createProxy.call({ ...this, rest }, route);
29
+ },
30
+ });
31
+ }
32
+ /**@internal */
33
+ __patchThis(data) {
34
+ Object.assign(this, (0, common_1.toCamelCase)(data));
35
+ return this;
36
+ }
37
+ client;
38
+ }
39
+ exports.Base = Base;
@@ -0,0 +1,9 @@
1
+ import type { APIBaseComponent, ComponentType } from '../../common';
2
+ export interface BaseComponent<T extends ComponentType> extends APIBaseComponent<T> {
3
+ }
4
+ export declare class BaseComponent<T extends ComponentType> {
5
+ constructor(data: APIBaseComponent<T>);
6
+ toJSON(): {
7
+ type: T;
8
+ };
9
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseComponent = void 0;
4
+ class BaseComponent {
5
+ constructor(data) {
6
+ Object.assign(this, data);
7
+ }
8
+ toJSON() {
9
+ return { type: this.type };
10
+ }
11
+ }
12
+ exports.BaseComponent = BaseComponent;
@@ -0,0 +1,40 @@
1
+ import type { APIPartialGuild, ObjectToLower } from '../../common';
2
+ import type { ImageOptions } from '../../common/types/options';
3
+ import { DiscordBase } from './DiscordBase';
4
+ export interface BaseGuild extends ObjectToLower<APIPartialGuild> {
5
+ }
6
+ /**
7
+ * Base guild class
8
+ */
9
+ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
10
+ get partnered(): boolean;
11
+ /**
12
+ * If the guild is verified.
13
+ * @link https://discord.com/developers/docs/resources/guild#guild-object-guild-features
14
+ */
15
+ get verified(): boolean;
16
+ /**
17
+ * Fetch guild on API
18
+ */
19
+ fetch(): Promise<BaseGuild>;
20
+ /**
21
+ * iconURL gets the current guild icon.
22
+ * @link https://discord.com/developers/docs/reference#image-formatting
23
+ */
24
+ iconURL(options?: ImageOptions): string | undefined;
25
+ /**
26
+ * splashURL gets the current guild splash as a string.
27
+ * @link https://discord.com/developers/docs/reference#image-formatting
28
+ * @param options - Image options for the splash url.
29
+ * @returns Splash url or void.
30
+ */
31
+ splashURL(options?: ImageOptions): string | undefined;
32
+ /**
33
+ * bannerURL gets the current guild banner as a string.
34
+ * @link https://discord.com/developers/docs/reference#image-formatting
35
+ * @param options - Image options for the banner url.
36
+ * @returns Banner url or void
37
+ */
38
+ bannerURL(options?: ImageOptions): string | undefined;
39
+ toString(): string;
40
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseGuild = void 0;
4
+ const common_1 = require("../../common");
5
+ const DiscordBase_1 = require("./DiscordBase");
6
+ /**
7
+ * Base guild class
8
+ */
9
+ class BaseGuild extends DiscordBase_1.DiscordBase {
10
+ get partnered() {
11
+ if (!this.features) {
12
+ return false;
13
+ }
14
+ return this.features.includes(common_1.GuildFeature.Partnered);
15
+ }
16
+ /**
17
+ * If the guild is verified.
18
+ * @link https://discord.com/developers/docs/resources/guild#guild-object-guild-features
19
+ */
20
+ get verified() {
21
+ if (!this.features) {
22
+ return false;
23
+ }
24
+ return this.features.includes(common_1.GuildFeature.Verified);
25
+ }
26
+ /**
27
+ * Fetch guild on API
28
+ */
29
+ async fetch() {
30
+ const data = await this.api.guilds(this.id).get();
31
+ return new BaseGuild(this.client, data);
32
+ }
33
+ /**
34
+ * iconURL gets the current guild icon.
35
+ * @link https://discord.com/developers/docs/reference#image-formatting
36
+ */
37
+ iconURL(options) {
38
+ if (!this.icon) {
39
+ return;
40
+ }
41
+ return this.rest.cdn.icon(this.id, this.icon, options);
42
+ }
43
+ /**
44
+ * splashURL gets the current guild splash as a string.
45
+ * @link https://discord.com/developers/docs/reference#image-formatting
46
+ * @param options - Image options for the splash url.
47
+ * @returns Splash url or void.
48
+ */
49
+ splashURL(options) {
50
+ if (!this.splash) {
51
+ return;
52
+ }
53
+ return this.rest.cdn.discoverySplash(this.id, this.splash, options);
54
+ }
55
+ /**
56
+ * bannerURL gets the current guild banner as a string.
57
+ * @link https://discord.com/developers/docs/reference#image-formatting
58
+ * @param options - Image options for the banner url.
59
+ * @returns Banner url or void
60
+ */
61
+ bannerURL(options) {
62
+ if (!this.banner) {
63
+ return;
64
+ }
65
+ return this.rest.cdn.banner(this.id, this.banner, options);
66
+ }
67
+ toString() {
68
+ return this.name;
69
+ }
70
+ }
71
+ exports.BaseGuild = BaseGuild;
@@ -0,0 +1,9 @@
1
+ import type { APIBaseSelectMenuComponent, ComponentType, Identify, ObjectToLower } from '../../common';
2
+ import { BaseComponent } from './BaseComponent';
3
+ export type APISelectMenuComponentTypes = ComponentType.ChannelSelect | ComponentType.MentionableSelect | ComponentType.RoleSelect | ComponentType.StringSelect | ComponentType.UserSelect;
4
+ export interface BaseSelectMenuComponent<T extends APISelectMenuComponentTypes> extends BaseComponent<T>, ObjectToLower<Identify<Omit<APIBaseSelectMenuComponent<APISelectMenuComponentTypes>, 'type'>>> {
5
+ }
6
+ export declare class BaseSelectMenuComponent<T extends APISelectMenuComponentTypes> extends BaseComponent<T> {
7
+ constructor(data: APIBaseSelectMenuComponent<T>);
8
+ toJSON(): this;
9
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseSelectMenuComponent = void 0;
4
+ const BaseComponent_1 = require("./BaseComponent");
5
+ class BaseSelectMenuComponent extends BaseComponent_1.BaseComponent {
6
+ constructor(data) {
7
+ super(data);
8
+ }
9
+ toJSON() {
10
+ return { ...this };
11
+ }
12
+ }
13
+ exports.BaseSelectMenuComponent = BaseSelectMenuComponent;
@@ -0,0 +1,14 @@
1
+ export type BitFieldResolvable<T extends object> = keyof T | number | bigint | (keyof T | number | bigint)[];
2
+ export declare class BitField<T extends object> {
3
+ static None: number;
4
+ Flags: Partial<Record<string, bigint>>;
5
+ private bit;
6
+ constructor(bitfields?: BitFieldResolvable<T>);
7
+ set bits(bits: BitFieldResolvable<T>);
8
+ get bits(): number;
9
+ add(...bits: BitFieldResolvable<T>[]): number;
10
+ remove(...bits: BitFieldResolvable<T>[]): number;
11
+ has(...bits: BitFieldResolvable<T>[]): boolean;
12
+ equals(other: BitFieldResolvable<T>): boolean;
13
+ resolve(bits?: BitFieldResolvable<T>): number;
14
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BitField = void 0;
4
+ class BitField {
5
+ static None = 0;
6
+ Flags = {};
7
+ bit;
8
+ constructor(bitfields) {
9
+ this.bit = this.resolve(bitfields);
10
+ }
11
+ set bits(bits) {
12
+ this.bit = this.resolve(bits);
13
+ }
14
+ get bits() {
15
+ return this.bit;
16
+ }
17
+ add(...bits) {
18
+ let reduced = BitField.None;
19
+ for (const bit of bits) {
20
+ reduced |= this.resolve(bit);
21
+ }
22
+ return (this.bit |= reduced);
23
+ }
24
+ remove(...bits) {
25
+ let reduced = BitField.None;
26
+ for (const bit of bits) {
27
+ reduced |= this.resolve(bit);
28
+ }
29
+ return (this.bit &= ~reduced);
30
+ }
31
+ has(...bits) {
32
+ const bitsResolved = bits.map(bit => this.resolve(bit));
33
+ return bitsResolved.every(bit => (this.bits & bit) === bit);
34
+ }
35
+ equals(other) {
36
+ return this.bits === this.resolve(other);
37
+ }
38
+ resolve(bits) {
39
+ switch (typeof bits) {
40
+ case 'number':
41
+ return bits;
42
+ case 'string':
43
+ return this.resolve(this.Flags[bits]);
44
+ case 'bigint':
45
+ return Number(bits);
46
+ case 'object':
47
+ if (!Array.isArray(bits)) {
48
+ throw new TypeError(`Cannot resolve permission: ${bits}`);
49
+ }
50
+ return bits.map(x => this.resolve(x)).reduce((acc, cur) => acc | cur, BitField.None);
51
+ default:
52
+ throw new TypeError(`Cannot resolve permission: ${typeof bits === 'symbol' ? String(bits) : bits}`);
53
+ }
54
+ }
55
+ }
56
+ exports.BitField = BitField;
@@ -0,0 +1,18 @@
1
+ import type { BaseClient } from '../../client/base';
2
+ import { Base } from './Base';
3
+ export declare class DiscordBase<Data extends Record<string, any> = {
4
+ id: string;
5
+ }> extends Base {
6
+ id: string;
7
+ constructor(client: BaseClient,
8
+ /** Unique ID of the object */
9
+ data: Data);
10
+ /**
11
+ * Create a timestamp for the current object.
12
+ */
13
+ get createdTimestamp(): number;
14
+ /**
15
+ * createdAt gets the creation Date instace of the current object.
16
+ */
17
+ get createdAt(): Date;
18
+ }