seyfert 2.1.0 → 2.1.1-dev-11316886063.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 (241) hide show
  1. package/lib/api/Router.d.ts +2 -2
  2. package/lib/api/Router.js +2 -1
  3. package/lib/api/Routes/applications.d.ts +29 -30
  4. package/lib/api/Routes/cdn.d.ts +6 -1
  5. package/lib/api/Routes/channels.d.ts +44 -45
  6. package/lib/api/Routes/gateway.d.ts +3 -4
  7. package/lib/api/Routes/guilds.d.ts +81 -80
  8. package/lib/api/Routes/index.d.ts +3 -1
  9. package/lib/api/Routes/interactions.d.ts +6 -6
  10. package/lib/api/Routes/invites.d.ts +3 -4
  11. package/lib/api/Routes/skus.d.ts +4 -5
  12. package/lib/api/Routes/soundboard.d.ts +23 -0
  13. package/lib/api/Routes/soundboard.js +2 -0
  14. package/lib/api/Routes/stage-instances.d.ts +5 -6
  15. package/lib/api/Routes/stickers.d.ts +3 -4
  16. package/lib/api/Routes/users.d.ts +11 -12
  17. package/lib/api/Routes/voice.d.ts +2 -3
  18. package/lib/api/Routes/webhooks.d.ts +16 -15
  19. package/lib/api/api.d.ts +17 -11
  20. package/lib/api/api.js +12 -10
  21. package/lib/api/shared.d.ts +1 -1
  22. package/lib/api/utils/constants.d.ts +2 -0
  23. package/lib/api/utils/constants.js +2 -1
  24. package/lib/builders/ActionRow.d.ts +1 -1
  25. package/lib/builders/Attachment.d.ts +2 -2
  26. package/lib/builders/Attachment.js +1 -1
  27. package/lib/builders/Button.d.ts +1 -1
  28. package/lib/builders/Button.js +1 -1
  29. package/lib/builders/Embed.d.ts +1 -1
  30. package/lib/builders/Embed.js +2 -2
  31. package/lib/builders/Modal.d.ts +1 -1
  32. package/lib/builders/Poll.d.ts +1 -1
  33. package/lib/builders/Poll.js +1 -1
  34. package/lib/builders/SelectMenu.d.ts +1 -1
  35. package/lib/builders/SelectMenu.js +1 -1
  36. package/lib/builders/types.d.ts +2 -1
  37. package/lib/cache/adapters/default.js +5 -3
  38. package/lib/cache/adapters/limited.d.ts +1 -2
  39. package/lib/cache/adapters/limited.js +34 -30
  40. package/lib/cache/adapters/workeradapter.js +3 -1
  41. package/lib/cache/index.d.ts +8 -11
  42. package/lib/cache/index.js +38 -37
  43. package/lib/cache/resources/bans.d.ts +2 -2
  44. package/lib/cache/resources/bans.js +1 -1
  45. package/lib/cache/resources/channels.d.ts +1 -1
  46. package/lib/cache/resources/default/guild-related.d.ts +1 -2
  47. package/lib/cache/resources/emojis.d.ts +2 -2
  48. package/lib/cache/resources/emojis.js +1 -1
  49. package/lib/cache/resources/guilds.d.ts +2 -2
  50. package/lib/cache/resources/guilds.js +7 -11
  51. package/lib/cache/resources/members.d.ts +2 -2
  52. package/lib/cache/resources/members.js +1 -1
  53. package/lib/cache/resources/messages.d.ts +2 -2
  54. package/lib/cache/resources/messages.js +3 -3
  55. package/lib/cache/resources/overwrites.d.ts +1 -1
  56. package/lib/cache/resources/roles.d.ts +2 -2
  57. package/lib/cache/resources/roles.js +1 -1
  58. package/lib/cache/resources/stickers.d.ts +2 -2
  59. package/lib/cache/resources/stickers.js +1 -1
  60. package/lib/cache/resources/users.d.ts +2 -2
  61. package/lib/cache/resources/users.js +1 -1
  62. package/lib/cache/resources/voice-states.d.ts +2 -2
  63. package/lib/cache/resources/voice-states.js +1 -1
  64. package/lib/client/base.d.ts +9 -14
  65. package/lib/client/base.js +43 -44
  66. package/lib/client/client.d.ts +3 -7
  67. package/lib/client/client.js +24 -41
  68. package/lib/client/collectors.js +1 -1
  69. package/lib/client/httpclient.d.ts +1 -1
  70. package/lib/client/transformers.d.ts +37 -34
  71. package/lib/client/transformers.js +66 -63
  72. package/lib/client/workerclient.d.ts +10 -11
  73. package/lib/client/workerclient.js +180 -75
  74. package/lib/collection.d.ts +3 -3
  75. package/lib/commands/applications/chat.d.ts +12 -32
  76. package/lib/commands/applications/chat.js +5 -6
  77. package/lib/commands/applications/chatcontext.d.ts +6 -6
  78. package/lib/commands/applications/chatcontext.js +16 -8
  79. package/lib/commands/applications/entryPoint.d.ts +1 -1
  80. package/lib/commands/applications/entrycontext.d.ts +6 -6
  81. package/lib/commands/applications/entrycontext.js +4 -4
  82. package/lib/commands/applications/menu.d.ts +1 -1
  83. package/lib/commands/applications/menucontext.d.ts +5 -5
  84. package/lib/commands/applications/menucontext.js +6 -6
  85. package/lib/commands/applications/options.d.ts +104 -28
  86. package/lib/commands/applications/options.js +4 -4
  87. package/lib/commands/applications/shared.d.ts +5 -2
  88. package/lib/commands/basecontext.d.ts +1 -1
  89. package/lib/commands/decorators.d.ts +10 -10
  90. package/lib/commands/decorators.js +5 -4
  91. package/lib/commands/handle.d.ts +9 -9
  92. package/lib/commands/handle.js +94 -68
  93. package/lib/commands/handler.d.ts +5 -5
  94. package/lib/commands/handler.js +21 -17
  95. package/lib/commands/optionresolver.d.ts +4 -4
  96. package/lib/commands/optionresolver.js +3 -3
  97. package/lib/common/it/formatter.d.ts +21 -21
  98. package/lib/common/it/formatter.js +40 -41
  99. package/lib/common/it/logger.js +1 -1
  100. package/lib/common/it/utils.d.ts +4 -3
  101. package/lib/common/it/utils.js +52 -27
  102. package/lib/common/shorters/application.d.ts +2 -3
  103. package/lib/common/shorters/application.js +3 -3
  104. package/lib/common/shorters/bans.js +1 -1
  105. package/lib/common/shorters/channels.d.ts +3 -3
  106. package/lib/common/shorters/channels.js +3 -3
  107. package/lib/common/shorters/emojis.js +4 -4
  108. package/lib/common/shorters/guilds.d.ts +3 -3
  109. package/lib/common/shorters/guilds.js +5 -9
  110. package/lib/common/shorters/interaction.d.ts +3 -3
  111. package/lib/common/shorters/interaction.js +6 -5
  112. package/lib/common/shorters/members.d.ts +4 -5
  113. package/lib/common/shorters/members.js +6 -7
  114. package/lib/common/shorters/messages.d.ts +1 -1
  115. package/lib/common/shorters/messages.js +4 -4
  116. package/lib/common/shorters/reactions.d.ts +1 -1
  117. package/lib/common/shorters/reactions.js +1 -1
  118. package/lib/common/shorters/roles.js +1 -1
  119. package/lib/common/shorters/templates.js +2 -2
  120. package/lib/common/shorters/threads.d.ts +1 -1
  121. package/lib/common/shorters/threads.js +17 -11
  122. package/lib/common/shorters/webhook.d.ts +1 -1
  123. package/lib/common/shorters/webhook.js +4 -4
  124. package/lib/common/types/options.d.ts +2 -2
  125. package/lib/common/types/resolvables.d.ts +1 -1
  126. package/lib/common/types/util.d.ts +4 -1
  127. package/lib/common/types/write.d.ts +1 -1
  128. package/lib/components/BaseComponent.js +1 -1
  129. package/lib/components/ButtonComponent.d.ts +1 -1
  130. package/lib/components/componentcommand.d.ts +1 -1
  131. package/lib/components/componentcontext.d.ts +4 -4
  132. package/lib/components/componentcontext.js +1 -1
  133. package/lib/components/handler.d.ts +10 -8
  134. package/lib/components/handler.js +16 -13
  135. package/lib/components/index.js +2 -1
  136. package/lib/components/modalcontext.d.ts +2 -2
  137. package/lib/components/modalcontext.js +1 -1
  138. package/lib/deps/mixer.d.ts +1 -1
  139. package/lib/events/handler.d.ts +5 -5
  140. package/lib/events/handler.js +66 -16
  141. package/lib/events/hooks/application_command.d.ts +1 -1
  142. package/lib/events/hooks/auto_moderation.d.ts +1 -1
  143. package/lib/events/hooks/auto_moderation.js +1 -1
  144. package/lib/events/hooks/channel.d.ts +1 -1
  145. package/lib/events/hooks/dispatch.d.ts +1 -1
  146. package/lib/events/hooks/entitlement.d.ts +4 -5
  147. package/lib/events/hooks/entitlement.js +4 -4
  148. package/lib/events/hooks/guild.d.ts +3 -3
  149. package/lib/events/hooks/guild.js +1 -1
  150. package/lib/events/hooks/index.d.ts +1 -0
  151. package/lib/events/hooks/index.js +1 -0
  152. package/lib/events/hooks/integration.d.ts +1 -1
  153. package/lib/events/hooks/integration.js +1 -1
  154. package/lib/events/hooks/interactions.d.ts +3 -3
  155. package/lib/events/hooks/invite.d.ts +1 -1
  156. package/lib/events/hooks/message.d.ts +3 -3
  157. package/lib/events/hooks/message.js +1 -1
  158. package/lib/events/hooks/presence.d.ts +2 -2
  159. package/lib/events/hooks/soundboard.d.ts +155 -0
  160. package/lib/events/hooks/soundboard.js +28 -0
  161. package/lib/events/hooks/stage.d.ts +2 -2
  162. package/lib/events/hooks/thread.d.ts +2 -2
  163. package/lib/events/hooks/thread.js +2 -2
  164. package/lib/events/hooks/typing.d.ts +1 -1
  165. package/lib/events/hooks/typing.js +1 -1
  166. package/lib/events/hooks/user.d.ts +2 -2
  167. package/lib/events/hooks/voice.d.ts +2 -2
  168. package/lib/events/hooks/voice.js +1 -1
  169. package/lib/events/hooks/webhook.d.ts +1 -1
  170. package/lib/index.d.ts +2 -2
  171. package/lib/index.js +3 -5
  172. package/lib/langs/handler.d.ts +2 -2
  173. package/lib/structures/Guild.d.ts +7 -4
  174. package/lib/structures/Guild.js +1 -1
  175. package/lib/structures/GuildBan.d.ts +1 -1
  176. package/lib/structures/GuildMember.d.ts +7 -5
  177. package/lib/structures/GuildMember.js +5 -3
  178. package/lib/structures/GuildRole.d.ts +1 -1
  179. package/lib/structures/GuildTemplate.d.ts +1 -1
  180. package/lib/structures/Interaction.d.ts +17 -14
  181. package/lib/structures/Interaction.js +28 -21
  182. package/lib/structures/Message.d.ts +4 -7
  183. package/lib/structures/Message.js +5 -5
  184. package/lib/structures/Poll.d.ts +3 -3
  185. package/lib/structures/Sticker.d.ts +2 -2
  186. package/lib/structures/Sticker.js +1 -1
  187. package/lib/structures/VoiceState.d.ts +2 -1
  188. package/lib/structures/VoiceState.js +1 -1
  189. package/lib/structures/Webhook.d.ts +3 -3
  190. package/lib/structures/Webhook.js +1 -1
  191. package/lib/structures/channels.d.ts +4 -4
  192. package/lib/structures/channels.js +6 -5
  193. package/lib/structures/extra/BitField.d.ts +3 -3
  194. package/lib/structures/extra/BitField.js +34 -33
  195. package/lib/structures/extra/DiscordBase.js +1 -1
  196. package/lib/structures/extra/Permissions.d.ts +2 -0
  197. package/lib/structures/extra/Permissions.js +21 -0
  198. package/lib/types/gateway.d.ts +53 -5
  199. package/lib/types/payloads/_interactions/base.d.ts +1 -1
  200. package/lib/types/payloads/channel.d.ts +2 -2
  201. package/lib/types/payloads/guild.d.ts +9 -1
  202. package/lib/types/payloads/guild.js +8 -0
  203. package/lib/types/payloads/index.d.ts +1 -0
  204. package/lib/types/payloads/index.js +1 -0
  205. package/lib/types/payloads/soundboard.d.ts +23 -0
  206. package/lib/types/payloads/soundboard.js +5 -0
  207. package/lib/types/payloads/user.js +0 -1
  208. package/lib/types/rest/application.d.ts +3 -3
  209. package/lib/types/rest/auditLog.d.ts +1 -1
  210. package/lib/types/rest/channel.d.ts +2 -2
  211. package/lib/types/rest/guild.d.ts +2 -2
  212. package/lib/types/rest/guildScheduledEvent.d.ts +1 -1
  213. package/lib/types/rest/index.d.ts +1 -0
  214. package/lib/types/rest/index.js +1 -0
  215. package/lib/types/rest/oauth2.d.ts +1 -1
  216. package/lib/types/rest/poll.d.ts +1 -1
  217. package/lib/types/rest/soundboard.d.ts +64 -0
  218. package/lib/types/rest/soundboard.js +2 -0
  219. package/lib/types/rest/stageInstance.d.ts +1 -1
  220. package/lib/types/rest/template.d.ts +1 -1
  221. package/lib/types/rest/user.d.ts +1 -1
  222. package/lib/types/rest/webhook.d.ts +1 -1
  223. package/lib/types/utils/index.d.ts +11 -2
  224. package/lib/types/utils/index.js +10 -2
  225. package/lib/websocket/SharedTypes.d.ts +11 -2
  226. package/lib/websocket/constants/index.js +0 -10
  227. package/lib/websocket/discord/basesocket.d.ts +1 -1
  228. package/lib/websocket/discord/shard.d.ts +1 -1
  229. package/lib/websocket/discord/shard.js +25 -16
  230. package/lib/websocket/discord/sharder.d.ts +9 -6
  231. package/lib/websocket/discord/sharder.js +91 -74
  232. package/lib/websocket/discord/shared.d.ts +3 -14
  233. package/lib/websocket/discord/socket/custom.js +19 -6
  234. package/lib/websocket/discord/worker.d.ts +8 -2
  235. package/lib/websocket/discord/workermanager.d.ts +42 -17
  236. package/lib/websocket/discord/workermanager.js +144 -37
  237. package/lib/websocket/structures/timeout.d.ts +4 -5
  238. package/lib/websocket/structures/timeout.js +23 -24
  239. package/package.json +72 -70
  240. package/lib/cache/resources/threads.d.ts +0 -14
  241. package/lib/cache/resources/threads.js +0 -32
package/lib/api/api.js CHANGED
@@ -15,7 +15,6 @@ class ApiHandler {
15
15
  ratelimits = new Map();
16
16
  readyQueue = [];
17
17
  cdn = Router_1.CDNRouter.createProxy();
18
- debugger;
19
18
  workerPromises;
20
19
  constructor(options) {
21
20
  this.options = {
@@ -41,6 +40,9 @@ class ApiHandler {
41
40
  parentPort = worker_threads.parentPort;
42
41
  }
43
42
  }
43
+ get proxy() {
44
+ return (this._proxy_ ??= new Router_1.Router(this).createProxy());
45
+ }
44
46
  globalUnblock() {
45
47
  this.globalBlock = false;
46
48
  let cb;
@@ -118,7 +120,7 @@ class ApiHandler {
118
120
  this.clearResetInterval(route);
119
121
  next();
120
122
  if (result.length > 0) {
121
- if (response.headers.get('content-type') === 'application/json') {
123
+ if (response.headers.get('content-type')?.includes('application/json')) {
122
124
  try {
123
125
  result = JSON.parse(result);
124
126
  }
@@ -135,7 +137,7 @@ class ApiHandler {
135
137
  return;
136
138
  }
137
139
  if (result.length > 0) {
138
- if (response.headers.get('content-type') === 'application/json') {
140
+ if (response.headers.get('content-type')?.includes('application/json')) {
139
141
  try {
140
142
  result = JSON.parse(result);
141
143
  }
@@ -148,7 +150,7 @@ class ApiHandler {
148
150
  }
149
151
  }
150
152
  next();
151
- return resolve((result || undefined));
153
+ return resolve(result || undefined);
152
154
  };
153
155
  return new Promise((resolve, reject) => {
154
156
  if (this.globalBlock && auth) {
@@ -177,10 +179,10 @@ class ApiHandler {
177
179
  errMessage += `${JSON.stringify(result.errors, null, 2)}\n`;
178
180
  }
179
181
  }
180
- if (response.status) {
181
- return new Error(errMessage ?? response.statusText);
182
+ if (errMessage.length) {
183
+ return new Error(errMessage);
182
184
  }
183
- return new Error('Unknown error');
185
+ return new Error(response.statusText);
184
186
  }
185
187
  async handle50X(method, url, request, next) {
186
188
  const wait = Math.floor(Math.random() * 1900 + 100);
@@ -257,13 +259,13 @@ class ApiHandler {
257
259
  }
258
260
  }
259
261
  setRatelimitsBucket(route, resp) {
260
- if (resp.headers.get('x-ratelimit-limit')) {
262
+ if (resp.headers.has('x-ratelimit-limit')) {
261
263
  this.ratelimits.get(route).limit = +resp.headers.get('x-ratelimit-limit');
262
264
  }
263
265
  this.ratelimits.get(route).remaining =
264
266
  resp.headers.get('x-ratelimit-remaining') === undefined ? 1 : +resp.headers.get('x-ratelimit-remaining');
265
267
  if (this.options.smartBucket) {
266
- if (resp.headers.get('x-ratelimit-reset-after') &&
268
+ if (resp.headers.has('x-ratelimit-reset-after') &&
267
269
  !this.ratelimits.get(route).resetAfter &&
268
270
  Number(resp.headers.get('x-ratelimit-limit')) === Number(resp.headers.get('x-ratelimit-remaining')) + 1) {
269
271
  this.ratelimits.get(route).resetAfter = +resp.headers.get('x-ratelimit-reset-after') * 1000;
@@ -282,7 +284,7 @@ class ApiHandler {
282
284
  if (options.request.query) {
283
285
  finalUrl += `?${new URLSearchParams(options.request.query)}`;
284
286
  }
285
- if (options.request.files) {
287
+ if (options.request.files?.length) {
286
288
  const formData = new FormData();
287
289
  for (const [index, file] of options.request.files.entries()) {
288
290
  const fileKey = file.key ?? `files[${index}]`;
@@ -18,7 +18,7 @@ export interface ApiHandlerInternalOptions extends MakeRequired<ApiHandlerOption
18
18
  }
19
19
  export interface RawFile {
20
20
  contentType?: string;
21
- data: Buffer | Uint8Array | boolean | number | string;
21
+ data: ArrayBuffer | Buffer | Uint8Array | boolean | number | string;
22
22
  key?: string;
23
23
  filename: string;
24
24
  }
@@ -2,6 +2,8 @@ export declare const DefaultUserAgent = "DiscordBot (https://seyfert.dev, v2.1.0
2
2
  export declare const ALLOWED_EXTENSIONS: readonly ["webp", "png", "jpg", "jpeg", "gif"];
3
3
  export declare const ALLOWED_STICKER_EXTENSIONS: readonly ["png", "json", "gif"];
4
4
  export declare const ALLOWED_SIZES: readonly [16, 32, 64, 100, 128, 256, 512, 1024, 2048, 4096];
5
+ export declare const ALLOWED_SOUNDS_EXTENSIONS: readonly ["mp3", "ogg"];
5
6
  export type ImageExtension = (typeof ALLOWED_EXTENSIONS)[number];
6
7
  export type StickerExtension = (typeof ALLOWED_STICKER_EXTENSIONS)[number];
7
8
  export type ImageSize = (typeof ALLOWED_SIZES)[number];
9
+ export type SoundExtension = (typeof ALLOWED_SOUNDS_EXTENSIONS)[number];
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALLOWED_SIZES = exports.ALLOWED_STICKER_EXTENSIONS = exports.ALLOWED_EXTENSIONS = exports.DefaultUserAgent = void 0;
3
+ exports.ALLOWED_SOUNDS_EXTENSIONS = exports.ALLOWED_SIZES = exports.ALLOWED_STICKER_EXTENSIONS = exports.ALLOWED_EXTENSIONS = exports.DefaultUserAgent = void 0;
4
4
  exports.DefaultUserAgent = 'DiscordBot (https://seyfert.dev, v2.1.0)';
5
5
  exports.ALLOWED_EXTENSIONS = ['webp', 'png', 'jpg', 'jpeg', 'gif'];
6
6
  exports.ALLOWED_STICKER_EXTENSIONS = ['png', 'json', 'gif'];
7
7
  exports.ALLOWED_SIZES = [16, 32, 64, 100, 128, 256, 512, 1_024, 2_048, 4_096];
8
+ exports.ALLOWED_SOUNDS_EXTENSIONS = ['mp3', 'ogg'];
@@ -1,5 +1,5 @@
1
- import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIMessageActionRowComponent } from '../types';
2
1
  import type { RestOrArray } from '../common/types/util';
2
+ import { type APIActionRowComponent, type APIActionRowComponentTypes, type APIMessageActionRowComponent } from '../types';
3
3
  import { BaseComponentBuilder } from './Base';
4
4
  import type { BuilderComponents, FixedComponents } from './types';
5
5
  /**
@@ -1,7 +1,7 @@
1
- import type { APIAttachment, RESTAPIAttachment } from '../types';
2
- import type { UsingClient, RawFile } from '..';
1
+ import type { RawFile, UsingClient } from '..';
3
2
  import type { ImageResolvable, ObjectToLower } from '../common';
4
3
  import { Base } from '../structures/extra/Base';
4
+ import type { APIAttachment, RESTAPIAttachment } from '../types';
5
5
  export interface AttachmentResolvableMap {
6
6
  url: string;
7
7
  buffer: Buffer | ArrayBuffer;
@@ -10,9 +10,9 @@ exports.resolveAttachmentData = resolveAttachmentData;
10
10
  exports.resolveBase64 = resolveBase64;
11
11
  exports.resolveImage = resolveImage;
12
12
  const node_crypto_1 = require("node:crypto");
13
+ const node_fs_1 = require("node:fs");
13
14
  const node_path_1 = __importDefault(require("node:path"));
14
15
  const Base_1 = require("../structures/extra/Base");
15
- const node_fs_1 = require("node:fs");
16
16
  class Attachment extends Base_1.Base {
17
17
  data;
18
18
  constructor(client, data) {
@@ -1,5 +1,5 @@
1
- import { type ButtonStyle, type APIButtonComponent } from '../types';
2
1
  import { type EmojiResolvable } from '../common';
2
+ import { type APIButtonComponent, type ButtonStyle } from '../types';
3
3
  /**
4
4
  * Represents a button component.
5
5
  * @template Type - The type of the button component.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Button = void 0;
4
- const types_1 = require("../types");
5
4
  const common_1 = require("../common");
5
+ const types_1 = require("../types");
6
6
  /**
7
7
  * Represents a button component.
8
8
  * @template Type - The type of the button component.
@@ -1,5 +1,5 @@
1
- import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter } from '../types';
2
1
  import { type ColorResolvable, type ObjectToLower, type RestOrArray } from '../common';
2
+ import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter } from '../types';
3
3
  /**
4
4
  * Represents a message embed.
5
5
  * @example
@@ -20,8 +20,8 @@ class Embed {
20
20
  * const embed = new Embed({ title: 'Hello', description: 'This is an example embed' });
21
21
  */
22
22
  constructor(data = {}) {
23
- this.data = data;
24
- if (!data.fields)
23
+ this.data = { ...data };
24
+ if (!this.data.fields)
25
25
  this.data.fields = [];
26
26
  }
27
27
  /**
@@ -1,5 +1,5 @@
1
- import { type APIModalInteractionResponseCallbackData, type APITextInputComponent, type TextInputStyle } from '../types';
2
1
  import type { RestOrArray } from '../common';
2
+ import { type APIModalInteractionResponseCallbackData, type APITextInputComponent, type TextInputStyle } from '../types';
3
3
  import type { ActionRow } from './ActionRow';
4
4
  import { BaseComponentBuilder, type OptionValuesLength } from './Base';
5
5
  import type { ModalBuilderComponents, ModalSubmitCallback } from './types';
@@ -1,5 +1,5 @@
1
- import { type APIPollMedia, type RESTAPIPollCreate } from '../types';
2
1
  import { type DeepPartial, type EmojiResolvable, type RestOrArray } from '../common';
2
+ import { type APIPollMedia, type RESTAPIPollCreate } from '../types';
3
3
  export declare class PollBuilder {
4
4
  data: DeepPartial<RESTAPIPollCreate>;
5
5
  constructor(data?: DeepPartial<RESTAPIPollCreate>);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PollBuilder = void 0;
4
- const types_1 = require("../types");
5
4
  const common_1 = require("../common");
5
+ const types_1 = require("../types");
6
6
  class PollBuilder {
7
7
  data;
8
8
  constructor(data = {}) {
@@ -1,6 +1,6 @@
1
- import { type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APISelectMenuComponent, type APISelectMenuOption, type APIStringSelectComponent, type APIUserSelectComponent, type ChannelType, SelectMenuDefaultValueType } from '../types';
2
1
  import type { EmojiResolvable, RestOrArray, ToClass } from '../common';
3
2
  import type { ChannelSelectMenuInteraction, ComponentInteraction, MentionableSelectMenuInteraction, RoleSelectMenuInteraction, StringSelectMenuInteraction, UserSelectMenuInteraction } from '../structures';
3
+ import { type APIChannelSelectComponent, type APIMentionableSelectComponent, type APIRoleSelectComponent, type APISelectMenuComponent, type APISelectMenuOption, type APIStringSelectComponent, type APIUserSelectComponent, type ChannelType, SelectMenuDefaultValueType } from '../types';
4
4
  import { BaseComponentBuilder, type OptionValuesLength } from './Base';
5
5
  export type BuilderSelectMenus = RoleSelectMenu | UserSelectMenu | MentionableSelectMenu | ChannelSelectMenu | StringSelectMenu;
6
6
  /**
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StringSelectOption = exports.StringSelectMenu = exports.ChannelSelectMenu = exports.MentionableSelectMenu = exports.RoleSelectMenu = exports.UserSelectMenu = exports.SelectMenu = void 0;
4
- const types_1 = require("../types");
5
4
  const utils_1 = require("../common/it/utils");
5
+ const types_1 = require("../types");
6
6
  const Base_1 = require("./Base");
7
7
  /**
8
8
  * Maps default values for Select Menus.
@@ -4,7 +4,7 @@ import type { TextInput } from './Modal';
4
4
  import type { BuilderSelectMenus } from './SelectMenu';
5
5
  export type ComponentCallback<T extends ComponentInteraction | StringSelectMenuInteraction = ComponentInteraction | StringSelectMenuInteraction> = (interaction: T, stop: ComponentStopCallback, refresh: ComponentRefreshCallback) => any;
6
6
  export type ComponentFilterCallback<T = ComponentInteraction> = (interaction: T) => any;
7
- export type ComponentStopCallback = (reason?: string, refresh?: ComponentRefreshCallback) => any;
7
+ export type ComponentStopCallback = (reason: 'messageDelete' | 'channelDelete' | 'guildDelete' | (string & {}) | undefined, refresh: ComponentRefreshCallback) => any;
8
8
  export type ComponentRefreshCallback = () => any;
9
9
  export type ModalSubmitCallback<T = ModalSubmitInteraction> = (interaction: T) => any;
10
10
  export type ButtonLink = Omit<Button, 'setCustomId'>;
@@ -17,5 +17,6 @@ export interface ListenerOptions {
17
17
  timeout?: number;
18
18
  idle?: number;
19
19
  filter?: ComponentFilterCallback;
20
+ onPass?: ComponentFilterCallback;
20
21
  onStop?: ComponentStopCallback;
21
22
  }
@@ -8,15 +8,17 @@ class MemoryAdapter {
8
8
  relationships = new Map();
9
9
  constructor(options = {
10
10
  encode(data) {
11
- return JSON.stringify(data);
11
+ return data;
12
12
  },
13
13
  decode(data) {
14
- return JSON.parse(data);
14
+ return data;
15
15
  },
16
16
  }) {
17
17
  this.options = options;
18
18
  }
19
- start() { }
19
+ start() {
20
+ //
21
+ }
20
22
  scan(query, keys = false) {
21
23
  const values = [];
22
24
  const sq = query.split('.');
@@ -18,7 +18,6 @@ export interface LimitedMemoryAdapterOptions<T> {
18
18
  role?: ResourceLimitedMemoryAdapter;
19
19
  stage_instance?: ResourceLimitedMemoryAdapter;
20
20
  sticker?: ResourceLimitedMemoryAdapter;
21
- thread?: ResourceLimitedMemoryAdapter;
22
21
  overwrite?: ResourceLimitedMemoryAdapter;
23
22
  message?: ResourceLimitedMemoryAdapter;
24
23
  encode?(data: any): T;
@@ -34,7 +33,7 @@ export declare class LimitedMemoryAdapter<T> implements Adapter {
34
33
  scan(query: string, keys?: false): any[];
35
34
  scan(query: string, keys: true): string[];
36
35
  bulkGet(keys: string[]): unknown[];
37
- get(keys: string): unknown;
36
+ get(key: string): unknown;
38
37
  private __set;
39
38
  bulkSet(keys: [string, any][]): void;
40
39
  set(keys: string, data: any): void;
@@ -15,37 +15,41 @@ class LimitedMemoryAdapter {
15
15
  limit: Number.POSITIVE_INFINITY,
16
16
  },
17
17
  encode(data) {
18
- return JSON.stringify(data);
18
+ return data;
19
19
  },
20
20
  decode(data) {
21
- return JSON.parse(data);
21
+ return data;
22
22
  },
23
23
  }, options);
24
24
  }
25
- start() { }
25
+ start() {
26
+ //
27
+ }
26
28
  scan(query, keys = false) {
27
- const values = [];
28
29
  const sq = query.split('.');
29
- for (const iterator of [...this.storage.values()].flatMap(x => x.entries()))
30
- for (const [key, value] of iterator) {
31
- if (key.split('.').every((value, i) => (sq[i] === '*' ? !!value : sq[i] === value))) {
32
- values.push(keys ? key : this.options.decode(value.value));
33
- }
34
- }
35
- return values;
30
+ const isWildcard = sq.map(segment => segment === '*');
31
+ return [...this.storage.values()].flatMap(storageEntry => Array.from(storageEntry.entries())
32
+ .filter(([key]) => key.split('.').every((value, i) => isWildcard[i] || sq[i] === value))
33
+ .map(([key, value]) => (keys ? key : this.options.decode(value.value))));
36
34
  }
37
35
  bulkGet(keys) {
38
- const iterator = [...this.storage.values()];
39
- return keys
40
- .map(key => {
41
- const data = iterator.find(x => x.has(key))?.get(key);
42
- return data ? this.options.decode(data) : null;
36
+ const storageArray = Array.from(this.storage.values());
37
+ const keySet = new Set(keys);
38
+ return storageArray
39
+ .flatMap(storageEntry => {
40
+ const entries = Array.from(storageEntry.entries());
41
+ return entries.filter(([key]) => keySet.has(key)).map(([, value]) => this.options.decode(value.value));
43
42
  })
44
- .filter(x => x);
43
+ .filter(Boolean);
45
44
  }
46
- get(keys) {
47
- const data = [...this.storage.values()].find(x => x.has(keys))?.get(keys);
48
- return data ? this.options.decode(data) : null;
45
+ get(key) {
46
+ for (const storageEntry of this.storage.values()) {
47
+ if (storageEntry.has(key)) {
48
+ const data = storageEntry.get(key);
49
+ return data ? this.options.decode(data) : null;
50
+ }
51
+ }
52
+ return null;
49
53
  }
50
54
  __set(key, data) {
51
55
  const __guildId = Array.isArray(data) ? data[0].guild_id : data.guild_id;
@@ -63,10 +67,6 @@ class LimitedMemoryAdapter {
63
67
  const existsRelation = self.relationships.has(relationshipNamespace);
64
68
  if (existsRelation) {
65
69
  switch (relationshipNamespace) {
66
- case 'guild':
67
- case 'user':
68
- self.removeToRelationship(namespace, k.split('.')[1]);
69
- break;
70
70
  case 'ban':
71
71
  case 'member':
72
72
  case 'voice_state':
@@ -81,11 +81,15 @@ class LimitedMemoryAdapter {
81
81
  case 'role':
82
82
  case 'stage_instance':
83
83
  case 'sticker':
84
- case 'thread':
85
84
  case 'overwrite':
86
85
  case 'message':
87
86
  self.removeToRelationship(namespace, k.split('.')[1]);
88
87
  break;
88
+ // case 'guild':
89
+ // case 'user':
90
+ default:
91
+ self.removeToRelationship(namespace, k.split('.')[1]);
92
+ break;
89
93
  }
90
94
  }
91
95
  },
@@ -152,17 +156,12 @@ class LimitedMemoryAdapter {
152
156
  ?.delete(`${parentNamespace}.${keySplit.at(1)}.${keySplit.at(2)}`);
153
157
  }
154
158
  break;
155
- case 'user':
156
- case 'guild':
157
- this.storage.get(parentNamespace)?.delete(`${parentNamespace}.${keySplit.at(1)}`);
158
- break;
159
159
  case 'channel':
160
160
  case 'emoji':
161
161
  case 'presence':
162
162
  case 'role':
163
163
  case 'stage_instance':
164
164
  case 'sticker':
165
- case 'thread':
166
165
  case 'overwrite':
167
166
  case 'message':
168
167
  for (const keyStorage of this.storage.keys()) {
@@ -175,6 +174,11 @@ class LimitedMemoryAdapter {
175
174
  }
176
175
  }
177
176
  break;
177
+ // case 'user':
178
+ // case 'guild':
179
+ default:
180
+ this.storage.get(parentNamespace)?.delete(`${parentNamespace}.${keySplit.at(1)}`);
181
+ break;
178
182
  }
179
183
  }
180
184
  flush() {
@@ -14,7 +14,9 @@ class WorkerAdapter {
14
14
  if (worker_threads?.parentPort)
15
15
  parentPort = worker_threads.parentPort;
16
16
  }
17
- start() { }
17
+ start() {
18
+ //
19
+ }
18
20
  postMessage(body) {
19
21
  if (parentPort)
20
22
  return parentPort.postMessage(body);
@@ -1,7 +1,8 @@
1
- import { Logger, type If } from '../common';
1
+ import { type If, Logger } from '../common';
2
2
  import type { Adapter } from './adapters';
3
3
  import { Guilds } from './resources/guilds';
4
4
  import { Users } from './resources/users';
5
+ import { Bans } from './resources/bans';
5
6
  import { Channels } from './resources/channels';
6
7
  import { Emojis } from './resources/emojis';
7
8
  import { Members } from './resources/members';
@@ -9,13 +10,11 @@ import { Presences } from './resources/presence';
9
10
  import { Roles } from './resources/roles';
10
11
  import { StageInstances } from './resources/stage-instances';
11
12
  import { Stickers } from './resources/stickers';
12
- import { Threads } from './resources/threads';
13
13
  import { VoiceStates } from './resources/voice-states';
14
- import { Bans } from './resources/bans';
15
- import { GatewayIntentBits, type GatewayDispatchPayload } from '../types';
16
14
  import type { InternalOptions, UsingClient } from '../commands';
17
- import { Overwrites } from './resources/overwrites';
15
+ import { type GatewayDispatchPayload, GatewayIntentBits } from '../types';
18
16
  import { Messages } from './resources/messages';
17
+ import { Overwrites } from './resources/overwrites';
19
18
  export { BaseResource } from './resources/default/base';
20
19
  export { GuildRelatedResource } from './resources/default/guild-related';
21
20
  export { GuildBasedResource } from './resources/default/guild-based';
@@ -24,7 +23,7 @@ export type InferAsyncCache = InternalOptions extends {
24
23
  } ? P : false;
25
24
  export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
26
25
  export type GuildBased = 'members' | 'voiceStates';
27
- export type GuildRelated = 'emojis' | 'roles' | 'threads' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages' | 'bans';
26
+ export type GuildRelated = 'emojis' | 'roles' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages' | 'bans';
28
27
  export type NonGuildBased = 'users' | 'guilds';
29
28
  export type SeyfertBased = 'onPacket';
30
29
  export * from './adapters/index';
@@ -43,7 +42,6 @@ export declare class Cache {
43
42
  overwrites?: Overwrites;
44
43
  roles?: Roles;
45
44
  emojis?: Emojis;
46
- threads?: Threads;
47
45
  channels?: Channels;
48
46
  stickers?: Stickers;
49
47
  presences?: Presences;
@@ -58,7 +56,7 @@ export declare class Cache {
58
56
  get hasRolesIntent(): boolean;
59
57
  get hasChannelsIntent(): boolean;
60
58
  get hasGuildMembersIntent(): boolean;
61
- get hasEmojisAndStickersIntent(): boolean;
59
+ get hasGuildExpressionsIntent(): boolean;
62
60
  get hasVoiceStatesIntent(): boolean;
63
61
  get hasPrenseceUpdates(): boolean;
64
62
  get hasDirectMessages(): boolean;
@@ -78,16 +76,14 @@ export declare class Cache {
78
76
  members: import("..").GuildMember[];
79
77
  users: import("..").User[];
80
78
  channels: NonNullable<ReturnCache<import("..").AllChannels | undefined>>[];
81
- threads: import("..").ThreadChannel[];
82
79
  messages: import("..").Message[];
80
+ voiceStates: import("..").VoiceState[];
83
81
  presences: (Omit<import("../types").GatewayPresenceUpdate, "user"> & {
84
82
  id: string;
85
83
  user_id: string;
86
84
  } & {
87
85
  guild_id: string;
88
86
  })[];
89
- bans: import("../structures/GuildBan").GuildBan[];
90
- voiceStates: import("..").VoiceState[];
91
87
  stageInstances: (import("../types").APIStageInstance & {
92
88
  guild_id: string;
93
89
  })[];
@@ -98,6 +94,7 @@ export declare class Cache {
98
94
  allow: import("../structures/extra/Permissions").PermissionsBitField;
99
95
  guildId: string;
100
96
  }[][];
97
+ bans: import("../structures/GuildBan").GuildBan[];
101
98
  }>>;
102
99
  bulkPatch(keys: (readonly [
103
100
  NonGuildBased,