seyfert 4.4.1 → 5.0.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 (231) hide show
  1. package/README.md +7 -1
  2. package/lib/api/Routes/cdn.d.ts +2 -2
  3. package/lib/api/Routes/guilds.d.ts +2 -2
  4. package/lib/api/Routes/invites.d.ts +2 -2
  5. package/lib/api/api.d.ts +20 -8
  6. package/lib/api/api.js +198 -44
  7. package/lib/api/shared.d.ts +30 -1
  8. package/lib/api/utils/constants.d.ts +1 -1
  9. package/lib/api/utils/constants.js +1 -1
  10. package/lib/api/utils/utils.d.ts +2 -1
  11. package/lib/api/utils/utils.js +1 -1
  12. package/lib/builders/Attachment.d.ts +1 -1
  13. package/lib/builders/Attachment.js +30 -8
  14. package/lib/builders/MediaGallery.d.ts +2 -2
  15. package/lib/builders/MediaGallery.js +10 -0
  16. package/lib/builders/Modal.d.ts +18 -8
  17. package/lib/builders/Modal.js +36 -7
  18. package/lib/builders/Poll.js +18 -0
  19. package/lib/builders/RadioGroup.d.ts +4 -3
  20. package/lib/builders/RadioGroup.js +24 -3
  21. package/lib/builders/SelectMenu.d.ts +8 -6
  22. package/lib/builders/SelectMenu.js +24 -3
  23. package/lib/builders/types.d.ts +3 -2
  24. package/lib/cache/adapters/default.d.ts +1 -1
  25. package/lib/cache/adapters/default.js +23 -26
  26. package/lib/cache/adapters/limited.d.ts +1 -0
  27. package/lib/cache/adapters/limited.js +47 -33
  28. package/lib/cache/index.d.ts +19 -25
  29. package/lib/cache/index.js +58 -6
  30. package/lib/cache/resources/bans.d.ts +1 -1
  31. package/lib/cache/resources/bans.js +4 -4
  32. package/lib/cache/resources/channels.d.ts +1 -1
  33. package/lib/cache/resources/channels.js +4 -4
  34. package/lib/cache/resources/default/base.d.ts +1 -1
  35. package/lib/cache/resources/default/base.js +8 -8
  36. package/lib/cache/resources/default/guild-based.d.ts +5 -5
  37. package/lib/cache/resources/default/guild-based.js +29 -16
  38. package/lib/cache/resources/default/guild-related.d.ts +5 -5
  39. package/lib/cache/resources/default/guild-related.js +14 -14
  40. package/lib/cache/resources/emojis.d.ts +1 -1
  41. package/lib/cache/resources/emojis.js +4 -4
  42. package/lib/cache/resources/guilds.js +28 -15
  43. package/lib/cache/resources/members.d.ts +1 -1
  44. package/lib/cache/resources/members.js +6 -6
  45. package/lib/cache/resources/messages.d.ts +7 -2
  46. package/lib/cache/resources/messages.js +43 -20
  47. package/lib/cache/resources/overwrites.d.ts +1 -1
  48. package/lib/cache/resources/overwrites.js +5 -8
  49. package/lib/cache/resources/roles.d.ts +1 -1
  50. package/lib/cache/resources/roles.js +4 -4
  51. package/lib/cache/resources/stickers.d.ts +1 -1
  52. package/lib/cache/resources/stickers.js +4 -4
  53. package/lib/cache/resources/users.js +4 -4
  54. package/lib/cache/resources/voice-states.d.ts +1 -1
  55. package/lib/cache/resources/voice-states.js +4 -4
  56. package/lib/client/base.d.ts +83 -24
  57. package/lib/client/base.js +594 -39
  58. package/lib/client/client.d.ts +29 -4
  59. package/lib/client/client.js +38 -13
  60. package/lib/client/collectors.d.ts +9 -8
  61. package/lib/client/collectors.js +19 -52
  62. package/lib/client/httpclient.d.ts +3 -0
  63. package/lib/client/index.d.ts +3 -1
  64. package/lib/client/index.js +4 -0
  65. package/lib/client/intents.d.ts +3 -0
  66. package/lib/client/intents.js +9 -0
  67. package/lib/client/plugins/api.d.ts +4 -0
  68. package/lib/client/plugins/api.js +550 -0
  69. package/lib/client/plugins/errors.d.ts +25 -0
  70. package/lib/client/plugins/errors.js +79 -0
  71. package/lib/client/plugins/order.d.ts +10 -0
  72. package/lib/client/plugins/order.js +32 -0
  73. package/lib/client/plugins/registry.d.ts +273 -0
  74. package/lib/client/plugins/registry.js +868 -0
  75. package/lib/client/plugins/shared.d.ts +23 -0
  76. package/lib/client/plugins/shared.js +193 -0
  77. package/lib/client/plugins/types.d.ts +398 -0
  78. package/lib/client/plugins/types.js +8 -0
  79. package/lib/client/plugins.d.ts +78 -0
  80. package/lib/client/plugins.js +558 -0
  81. package/lib/client/transformers.d.ts +33 -33
  82. package/lib/client/workerclient.d.ts +11 -2
  83. package/lib/client/workerclient.js +33 -22
  84. package/lib/collection.d.ts +10 -8
  85. package/lib/collection.js +19 -25
  86. package/lib/commands/applications/chat.d.ts +20 -18
  87. package/lib/commands/applications/chat.js +39 -14
  88. package/lib/commands/applications/chatcontext.d.ts +23 -15
  89. package/lib/commands/applications/chatcontext.js +23 -2
  90. package/lib/commands/applications/entryPoint.d.ts +4 -3
  91. package/lib/commands/applications/entryPoint.js +1 -1
  92. package/lib/commands/applications/entrycontext.d.ts +7 -9
  93. package/lib/commands/applications/entrycontext.js +3 -1
  94. package/lib/commands/applications/menu.d.ts +4 -3
  95. package/lib/commands/applications/menucontext.d.ts +7 -9
  96. package/lib/commands/applications/menucontext.js +3 -1
  97. package/lib/commands/applications/options.d.ts +23 -23
  98. package/lib/commands/applications/shared.d.ts +39 -17
  99. package/lib/commands/decorators.d.ts +50 -38
  100. package/lib/commands/decorators.js +15 -5
  101. package/lib/commands/handle.d.ts +19 -8
  102. package/lib/commands/handle.js +224 -143
  103. package/lib/commands/handler.d.ts +21 -8
  104. package/lib/commands/handler.js +157 -69
  105. package/lib/commands/index.d.ts +1 -0
  106. package/lib/commands/optionresolver.d.ts +2 -2
  107. package/lib/common/it/colors.js +12 -2
  108. package/lib/common/it/error.d.ts +9 -0
  109. package/lib/common/it/error.js +8 -0
  110. package/lib/common/it/fake-promise.d.ts +4 -0
  111. package/lib/common/it/fake-promise.js +10 -0
  112. package/lib/common/it/formatter.d.ts +14 -11
  113. package/lib/common/it/formatter.js +4 -3
  114. package/lib/common/it/logger.d.ts +7 -1
  115. package/lib/common/it/logger.js +24 -6
  116. package/lib/common/it/utils.d.ts +6 -8
  117. package/lib/common/it/utils.js +44 -42
  118. package/lib/common/shorters/application.d.ts +3 -3
  119. package/lib/common/shorters/application.js +3 -2
  120. package/lib/common/shorters/bans.d.ts +8 -4
  121. package/lib/common/shorters/bans.js +13 -5
  122. package/lib/common/shorters/channels.d.ts +4 -4
  123. package/lib/common/shorters/channels.js +4 -4
  124. package/lib/common/shorters/emojis.js +1 -0
  125. package/lib/common/shorters/guilds.d.ts +8 -8
  126. package/lib/common/shorters/guilds.js +14 -31
  127. package/lib/common/shorters/interaction.d.ts +1 -1
  128. package/lib/common/shorters/invites.d.ts +201 -201
  129. package/lib/common/shorters/members.d.ts +7 -7
  130. package/lib/common/shorters/members.js +13 -14
  131. package/lib/common/shorters/messages.d.ts +2 -2
  132. package/lib/common/shorters/soundboard.d.ts +5 -5
  133. package/lib/common/shorters/users.d.ts +1 -1
  134. package/lib/common/shorters/webhook.d.ts +3 -2
  135. package/lib/common/shorters/webhook.js +0 -7
  136. package/lib/common/types/options.d.ts +4 -0
  137. package/lib/common/types/util.d.ts +8 -0
  138. package/lib/common/types/write.d.ts +2 -1
  139. package/lib/components/BaseSelectMenuComponent.d.ts +1 -1
  140. package/lib/components/BaseSelectMenuComponent.js +1 -1
  141. package/lib/components/ButtonComponent.d.ts +3 -3
  142. package/lib/components/ChannelSelectMenuComponent.d.ts +2 -2
  143. package/lib/components/File.d.ts +1 -1
  144. package/lib/components/MediaGallery.d.ts +1 -1
  145. package/lib/components/MentionableSelectMenuComponent.d.ts +1 -1
  146. package/lib/components/RoleSelectMenuComponent.d.ts +1 -1
  147. package/lib/components/Separator.d.ts +1 -1
  148. package/lib/components/StringSelectMenuComponent.d.ts +1 -1
  149. package/lib/components/TextInputComponent.d.ts +1 -1
  150. package/lib/components/Thumbnail.d.ts +1 -1
  151. package/lib/components/UserSelectMenuComponent.d.ts +1 -1
  152. package/lib/components/componentcommand.d.ts +8 -7
  153. package/lib/components/componentcontext.d.ts +24 -36
  154. package/lib/components/componentcontext.js +7 -17
  155. package/lib/components/handler.d.ts +17 -7
  156. package/lib/components/handler.js +108 -49
  157. package/lib/components/index.d.ts +1 -0
  158. package/lib/components/index.js +1 -0
  159. package/lib/components/interactioncontext.d.ts +45 -0
  160. package/lib/components/interactioncontext.js +93 -0
  161. package/lib/components/modalcommand.d.ts +5 -4
  162. package/lib/components/modalcontext.d.ts +39 -20
  163. package/lib/components/modalcontext.js +59 -6
  164. package/lib/events/event.d.ts +9 -3
  165. package/lib/events/handler.d.ts +51 -6
  166. package/lib/events/handler.js +165 -36
  167. package/lib/events/hooks/application_command.d.ts +1 -1
  168. package/lib/events/hooks/auto_moderation.d.ts +2 -2
  169. package/lib/events/hooks/guild.d.ts +150 -150
  170. package/lib/events/hooks/interactions.d.ts +1 -1
  171. package/lib/events/hooks/invite.d.ts +20 -20
  172. package/lib/events/hooks/message.d.ts +27 -27
  173. package/lib/events/hooks/presence.d.ts +11 -11
  174. package/lib/events/hooks/soundboard.d.ts +6 -6
  175. package/lib/events/hooks/stage.d.ts +2 -2
  176. package/lib/events/hooks/subscriptions.d.ts +3 -3
  177. package/lib/events/hooks/thread.d.ts +30 -30
  178. package/lib/events/hooks/voice.d.ts +3 -4
  179. package/lib/events/hooks/voice.js +2 -1
  180. package/lib/events/utils.d.ts +4 -0
  181. package/lib/events/utils.js +59 -0
  182. package/lib/index.d.ts +9 -4
  183. package/lib/index.js +14 -8
  184. package/lib/langs/handler.d.ts +14 -11
  185. package/lib/langs/handler.js +46 -9
  186. package/lib/langs/router.d.ts +10 -3
  187. package/lib/structures/Application.d.ts +1 -1
  188. package/lib/structures/Emoji.d.ts +3 -3
  189. package/lib/structures/Emoji.js +2 -2
  190. package/lib/structures/Guild.d.ts +154 -154
  191. package/lib/structures/GuildBan.d.ts +4 -4
  192. package/lib/structures/GuildBan.js +3 -3
  193. package/lib/structures/GuildMember.d.ts +7 -7
  194. package/lib/structures/GuildMember.js +28 -7
  195. package/lib/structures/GuildRole.d.ts +1 -1
  196. package/lib/structures/GuildRole.js +2 -2
  197. package/lib/structures/Interaction.d.ts +11 -9
  198. package/lib/structures/Interaction.js +33 -12
  199. package/lib/structures/Message.d.ts +21 -14
  200. package/lib/structures/Message.js +29 -14
  201. package/lib/structures/User.d.ts +1 -1
  202. package/lib/structures/VoiceState.d.ts +4 -0
  203. package/lib/structures/VoiceState.js +13 -1
  204. package/lib/structures/Webhook.d.ts +9 -1
  205. package/lib/structures/Webhook.js +4 -1
  206. package/lib/structures/channels.d.ts +148 -134
  207. package/lib/structures/channels.js +27 -26
  208. package/lib/structures/extra/BitField.d.ts +4 -4
  209. package/lib/structures/extra/BitField.js +20 -4
  210. package/lib/structures/extra/DiscordBase.js +1 -1
  211. package/lib/structures/extra/Permissions.d.ts +2 -4
  212. package/lib/structures/extra/Permissions.js +1 -17
  213. package/lib/types/payloads/_interactions/responses.d.ts +2 -2
  214. package/lib/types/payloads/components.d.ts +4 -4
  215. package/lib/websocket/SharedTypes.d.ts +4 -4
  216. package/lib/websocket/constants/index.d.ts +1 -1
  217. package/lib/websocket/constants/index.js +3 -2
  218. package/lib/websocket/discord/events/memberUpdate.js +2 -2
  219. package/lib/websocket/discord/heartbeater.d.ts +1 -0
  220. package/lib/websocket/discord/heartbeater.js +7 -0
  221. package/lib/websocket/discord/shard.d.ts +2 -2
  222. package/lib/websocket/discord/shard.js +16 -14
  223. package/lib/websocket/discord/sharder.d.ts +8 -7
  224. package/lib/websocket/discord/sharder.js +26 -6
  225. package/lib/websocket/discord/shared.d.ts +19 -6
  226. package/lib/websocket/discord/socket/custom.js +5 -0
  227. package/lib/websocket/discord/worker.d.ts +1 -0
  228. package/lib/websocket/discord/worker.js +2 -0
  229. package/lib/websocket/discord/workermanager.d.ts +25 -11
  230. package/lib/websocket/discord/workermanager.js +41 -10
  231. package/package.json +13 -17
@@ -3,6 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LimitedMemoryAdapter = void 0;
4
4
  const __1 = require("../..");
5
5
  const common_1 = require("../../common");
6
+ const namespaceIndexedResources = new Set([
7
+ 'channel',
8
+ 'emoji',
9
+ 'presence',
10
+ 'role',
11
+ 'stage_instance',
12
+ 'sticker',
13
+ 'overwrite',
14
+ 'message',
15
+ ]);
16
+ const scopeDerivedResources = new Set(['ban', 'member', 'voice_state']);
6
17
  class LimitedMemoryAdapter {
7
18
  isAsync = false;
8
19
  storage = new Map();
@@ -30,7 +41,7 @@ class LimitedMemoryAdapter {
30
41
  const sq = query.split('.');
31
42
  const values = [];
32
43
  for (const storageEntry of this.storage.values()) {
33
- for (const [key, entry] of storageEntry.entries()) {
44
+ for (const [key, entry] of storageEntry.rawEntries()) {
34
45
  const keySplit = key.split('.');
35
46
  if (keySplit.length === sq.length &&
36
47
  keySplit.every((segment, i) => (sq[i] === '*' ? !!segment : sq[i] === segment))) {
@@ -63,19 +74,7 @@ class LimitedMemoryAdapter {
63
74
  return scopeEnd === -1 ? key.slice(scopeStart) : key.slice(scopeStart, scopeEnd);
64
75
  }
65
76
  _supportsNamespaceIndex(resource) {
66
- switch (resource) {
67
- case 'channel':
68
- case 'emoji':
69
- case 'presence':
70
- case 'role':
71
- case 'stage_instance':
72
- case 'sticker':
73
- case 'overwrite':
74
- case 'message':
75
- return true;
76
- default:
77
- return false;
78
- }
77
+ return namespaceIndexedResources.has(resource);
79
78
  }
80
79
  _setIndexedStorage(resource, key, storageEntry) {
81
80
  if (!this._supportsNamespaceIndex(resource)) {
@@ -96,14 +95,7 @@ class LimitedMemoryAdapter {
96
95
  return this.keyToStorage.get(key);
97
96
  }
98
97
  _getDerivedNamespace(resource, scope) {
99
- switch (resource) {
100
- case 'ban':
101
- case 'member':
102
- case 'voice_state':
103
- return scope ? `${resource}.${scope}` : resource;
104
- default:
105
- return resource;
106
- }
98
+ return scope && scopeDerivedResources.has(resource) ? `${resource}.${scope}` : resource;
107
99
  }
108
100
  _isResourceNamespace(resource, namespace) {
109
101
  return namespace === resource || namespace.startsWith(`${resource}.`);
@@ -266,14 +258,18 @@ class LimitedMemoryAdapter {
266
258
  return array;
267
259
  }
268
260
  keys(to) {
261
+ const relationship = this._getRelationshipSet(to);
262
+ if (!relationship) {
263
+ return [];
264
+ }
269
265
  const result = [];
270
- for (const id of this._getRelationshipSet(to)) {
266
+ for (const id of relationship) {
271
267
  result.push(`${to}.${id}`);
272
268
  }
273
269
  return result;
274
270
  }
275
271
  count(to) {
276
- return this._getRelationshipSet(to).size;
272
+ return this._getRelationshipSet(to)?.size ?? 0;
277
273
  }
278
274
  bulkRemove(keys) {
279
275
  for (const i of keys) {
@@ -300,7 +296,7 @@ class LimitedMemoryAdapter {
300
296
  this.keyToStorage.clear();
301
297
  }
302
298
  contains(to, keys) {
303
- return this._getRelationshipSet(to).has(keys);
299
+ return this._getRelationshipSet(to)?.has(keys) ?? false;
304
300
  }
305
301
  _getRelationshipData(to) {
306
302
  const [key, subrelationKey = '*'] = to.split('.');
@@ -308,16 +304,24 @@ class LimitedMemoryAdapter {
308
304
  }
309
305
  _getRelationshipSet(to) {
310
306
  const { key, subrelationKey } = this._getRelationshipData(to);
311
- if (!this.relationships.has(key))
312
- this.relationships.set(key, new Map());
313
- const relation = this.relationships.get(key);
314
- if (!relation.has(subrelationKey)) {
315
- relation.set(subrelationKey, new Set());
307
+ return this.relationships.get(key)?.get(subrelationKey);
308
+ }
309
+ _ensureRelationshipSet(to) {
310
+ const { key, subrelationKey } = this._getRelationshipData(to);
311
+ let relation = this.relationships.get(key);
312
+ if (!relation) {
313
+ relation = new Map();
314
+ this.relationships.set(key, relation);
315
+ }
316
+ let values = relation.get(subrelationKey);
317
+ if (!values) {
318
+ values = new Set();
319
+ relation.set(subrelationKey, values);
316
320
  }
317
- return relation.get(subrelationKey);
321
+ return values;
318
322
  }
319
323
  getToRelationship(to) {
320
- return [...this._getRelationshipSet(to)];
324
+ return [...(this._getRelationshipSet(to) ?? [])];
321
325
  }
322
326
  bulkAddToRelationShip(data) {
323
327
  for (const i in data) {
@@ -325,16 +329,26 @@ class LimitedMemoryAdapter {
325
329
  }
326
330
  }
327
331
  addToRelationship(to, keys) {
328
- const data = this._getRelationshipSet(to);
332
+ const data = this._ensureRelationshipSet(to);
329
333
  for (const key of Array.isArray(keys) ? keys : [keys]) {
330
334
  data.add(key);
331
335
  }
332
336
  }
333
337
  removeToRelationship(to, keys) {
334
338
  const data = this._getRelationshipSet(to);
339
+ if (!data) {
340
+ return;
341
+ }
335
342
  for (const key of Array.isArray(keys) ? keys : [keys]) {
336
343
  data.delete(key);
337
344
  }
345
+ if (!data.size) {
346
+ const { key, subrelationKey } = this._getRelationshipData(to);
347
+ const relation = this.relationships.get(key);
348
+ relation?.delete(subrelationKey);
349
+ if (relation && !relation.size)
350
+ this.relationships.delete(key);
351
+ }
338
352
  }
339
353
  removeRelationship(to) {
340
354
  for (const i of Array.isArray(to) ? to : [to]) {
@@ -22,13 +22,24 @@ export type InferAsyncCache = InternalOptions extends {
22
22
  asyncCache: infer P;
23
23
  } ? P : false;
24
24
  export type ReturnCache<T> = If<InferAsyncCache, Promise<T>, T>;
25
- export type GuildBased = 'members' | 'voiceStates';
26
- export type GuildRelated = 'emojis' | 'roles' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages' | 'bans';
25
+ export type GuildBased = 'members' | 'voiceStates' | 'bans';
26
+ export type GuildRelated = 'emojis' | 'roles' | 'channels' | 'stickers' | 'presences' | 'stageInstances' | 'overwrites' | 'messages';
27
27
  export type NonGuildBased = 'users' | 'guilds';
28
28
  export type SeyfertBased = 'onPacket';
29
29
  type ReturnManagers = {
30
30
  [K in NonGuildBased | GuildBased | GuildRelated]: NonNullable<Awaited<ReturnType<NonNullable<Cache[K]>['get']>>>;
31
31
  };
32
+ export type BulkGetKey = readonly [
33
+ NonGuildBased | GuildRelated,
34
+ string
35
+ ] | readonly [
36
+ GuildBased,
37
+ string,
38
+ string
39
+ ];
40
+ type BulkGetResult<K extends BulkGetKey[0] = BulkGetKey[0]> = Partial<{
41
+ [P in K]: ReturnManagers[P][];
42
+ }>;
32
43
  export * from './adapters/index';
33
44
  export type CachedEvents = 'READY' | 'GUILD_CREATE' | 'GUILD_UPDATE' | 'GUILD_DELETE' | 'CHANNEL_CREATE' | 'CHANNEL_UPDATE' | 'CHANNEL_DELETE' | 'GUILD_ROLE_CREATE' | 'GUILD_ROLE_UPDATE' | 'GUILD_ROLE_DELETE' | 'GUILD_BAN_ADD' | 'GUILD_BAN_REMOVE' | 'GUILD_EMOJIS_UPDATE' | 'GUILD_STICKERS_UPDATE' | 'GUILD_MEMBER_ADD' | 'GUILD_MEMBER_UPDATE' | 'GUILD_MEMBER_REMOVE' | 'MESSAGE_CREATE' | 'PRESENCE_UPDATE' | 'THREAD_DELETE' | 'THREAD_CREATE' | 'THREAD_UPDATE' | 'USER_UPDATE' | 'VOICE_CHANNEL_STATUS_UPDATE' | 'VOICE_STATE_UPDATE' | 'STAGE_INSTANCE_CREATE' | 'STAGE_INSTANCE_UPDATE' | 'STAGE_INSTANCE_DELETE' | 'GUILD_MEMBERS_CHUNK';
34
45
  export type DisabledCache = {
@@ -51,6 +62,9 @@ export declare class Cache {
51
62
  messages?: Messages;
52
63
  bans?: Bans;
53
64
  __logger__?: Logger;
65
+ private pluginResourceNames;
66
+ private pluginResourcePacketHandlers;
67
+ private pluginResourcePacketErrorLogger?;
54
68
  constructor(intents: number, adapter: Adapter, disabledCache: DisabledCache, client: UsingClient);
55
69
  buildCache(disabledCache: DisabledCache, client: UsingClient): void;
56
70
  flush(): ReturnCache<void>;
@@ -61,31 +75,10 @@ export declare class Cache {
61
75
  get hasGuildMembersIntent(): boolean;
62
76
  get hasGuildExpressionsIntent(): boolean;
63
77
  get hasVoiceStatesIntent(): boolean;
64
- get hasPrenseceUpdates(): boolean;
78
+ get hasPresenceUpdates(): boolean;
65
79
  get hasDirectMessages(): boolean;
66
80
  get hasModerationIntent(): boolean;
67
- bulkGet(keys: (readonly [
68
- NonGuildBased | GuildRelated,
69
- string
70
- ] | readonly [
71
- GuildBased,
72
- string,
73
- string
74
- ])[]): Promise<Partial<{
75
- messages: ReturnManagers['messages'][];
76
- users: ReturnManagers['users'][];
77
- guilds: ReturnManagers['guilds'][];
78
- members: ReturnManagers['members'][];
79
- voiceStates: ReturnManagers['voiceStates'][];
80
- emojis: ReturnManagers['emojis'][];
81
- roles: ReturnManagers['roles'][];
82
- channels: ReturnManagers['channels'][];
83
- stickers: ReturnManagers['stickers'][];
84
- presences: ReturnManagers['presences'][];
85
- stageInstances: ReturnManagers['stageInstances'][];
86
- overwrites: ReturnManagers['overwrites'][];
87
- bans: ReturnManagers['bans'][];
88
- }>>;
81
+ bulkGet<const Keys extends readonly BulkGetKey[]>(keys: Keys): Promise<BulkGetResult<Keys[number][0]>>;
89
82
  bulkPatch(keys: (readonly [
90
83
  CacheFrom,
91
84
  NonGuildBased,
@@ -111,6 +104,7 @@ export declare class Cache {
111
104
  string
112
105
  ])[]): Promise<void>;
113
106
  onPacket(event: GatewayDispatchPayload): Promise<void>;
107
+ private onPacketWithPluginResources;
114
108
  protected onPacketDefault(event: GatewayDispatchPayload): Promise<void>;
115
109
  testAdapter(): Promise<void>;
116
110
  private testUsersAndMembers;
@@ -57,12 +57,23 @@ class Cache {
57
57
  messages;
58
58
  bans;
59
59
  __logger__;
60
+ pluginResourceNames = new Set();
61
+ pluginResourcePacketHandlers = [];
62
+ pluginResourcePacketErrorLogger;
60
63
  constructor(intents, adapter, disabledCache, client) {
61
64
  this.intents = intents;
62
65
  this.adapter = adapter;
63
66
  this.buildCache(disabledCache, client);
64
67
  }
65
68
  buildCache(disabledCache, client) {
69
+ for (const name of this.pluginResourceNames) {
70
+ delete this[name];
71
+ }
72
+ this.pluginResourceNames.clear();
73
+ this.pluginResourcePacketHandlers = [];
74
+ this.pluginResourcePacketErrorLogger = client.logger
75
+ ? (plugin, error) => client.logger.error(`[plugin:${plugin}] cache.resource.onPacket failed`, error)
76
+ : undefined;
66
77
  // non-guild based
67
78
  this.users = disabledCache.users ? undefined : new users_1.Users(this, client);
68
79
  this.guilds = disabledCache.guilds ? undefined : new guilds_1.Guilds(this, client);
@@ -83,7 +94,21 @@ class Cache {
83
94
  ? (() => {
84
95
  //
85
96
  })
86
- : this.onPacketDefault.bind(this);
97
+ : this.onPacketWithPluginResources.bind(this);
98
+ const pluginResources = [
99
+ ...(client.pluginRegistry
100
+ ?.cacheResources ?? []),
101
+ ].sort((left, right) => left.sequence - right.sequence);
102
+ for (const contribution of pluginResources) {
103
+ this[contribution.name] = new contribution.resource(this, client);
104
+ this.pluginResourceNames.add(contribution.name);
105
+ if (contribution.onPacket) {
106
+ this.pluginResourcePacketHandlers.push({
107
+ handler: contribution.onPacket,
108
+ plugin: contribution.record?.identity ?? contribution.name,
109
+ });
110
+ }
111
+ }
87
112
  }
88
113
  flush() {
89
114
  return this.adapter.flush();
@@ -110,7 +135,7 @@ class Cache {
110
135
  get hasVoiceStatesIntent() {
111
136
  return this.hasIntent('GuildVoiceStates');
112
137
  }
113
- get hasPrenseceUpdates() {
138
+ get hasPresenceUpdates() {
114
139
  return this.hasIntent('GuildPresences');
115
140
  }
116
141
  get hasDirectMessages() {
@@ -123,6 +148,8 @@ class Cache {
123
148
  const allData = {};
124
149
  for (const [type, id, guildId] of keys) {
125
150
  switch (type) {
151
+ case 'messages':
152
+ case 'bans':
126
153
  case 'voiceStates':
127
154
  case 'members':
128
155
  {
@@ -141,8 +168,6 @@ class Cache {
141
168
  case 'users':
142
169
  case 'guilds':
143
170
  case 'overwrites':
144
- case 'bans':
145
- case 'messages':
146
171
  {
147
172
  if (!allData[type]) {
148
173
  allData[type] = [];
@@ -181,7 +206,6 @@ class Cache {
181
206
  case 'stageInstances':
182
207
  case 'emojis':
183
208
  case 'overwrites':
184
- case 'bans':
185
209
  case 'messages':
186
210
  {
187
211
  if (!this[type]?.filter(data, id, guildId, from))
@@ -197,9 +221,18 @@ class Cache {
197
221
  if (type !== 'overwrites' && type !== 'messages') {
198
222
  data.guild_id = guildId;
199
223
  }
224
+ if (type === 'messages' && data?.author?.id && this.users?.filter(data.author, data.author.id, from)) {
225
+ const userHashId = this.users.namespace;
226
+ if (!(userHashId in relationshipsData)) {
227
+ relationshipsData[userHashId] = [];
228
+ }
229
+ relationshipsData[userHashId].push(data.author.id);
230
+ allData.push([this.users.hashId(data.author.id), data.author]);
231
+ }
200
232
  allData.push([this[type].hashId(id), this[type].parse(data, id, guildId)]);
201
233
  }
202
234
  break;
235
+ case 'bans':
203
236
  case 'voiceStates':
204
237
  case 'members':
205
238
  {
@@ -267,6 +300,14 @@ class Cache {
267
300
  if (type !== 'overwrites' && type !== 'messages') {
268
301
  data.guild_id = guildId;
269
302
  }
303
+ if (type === 'messages' && data?.author?.id && this.users?.filter(data.author, data.author.id, from)) {
304
+ const userHashId = this.users.namespace;
305
+ if (!(userHashId in relationshipsData)) {
306
+ relationshipsData[userHashId] = [];
307
+ }
308
+ relationshipsData[userHashId].push(data.author.id);
309
+ allData.push([this.users.hashId(data.author.id), data.author]);
310
+ }
270
311
  allData.push([this[type].hashId(id), this[type].parse(data, id, guildId)]);
271
312
  }
272
313
  break;
@@ -312,7 +353,18 @@ class Cache {
312
353
  await this.adapter.bulkSet(allData);
313
354
  }
314
355
  onPacket(event) {
315
- return this.onPacketDefault(event);
356
+ return this.onPacketWithPluginResources(event);
357
+ }
358
+ async onPacketWithPluginResources(event) {
359
+ await this.onPacketDefault(event);
360
+ for (const contribution of this.pluginResourcePacketHandlers) {
361
+ try {
362
+ await contribution.handler(event, this);
363
+ }
364
+ catch (error) {
365
+ this.pluginResourcePacketErrorLogger?.(contribution.plugin, error);
366
+ }
367
+ }
316
368
  }
317
369
  async onPacketDefault(event) {
318
370
  switch (event.t) {
@@ -10,6 +10,6 @@ export declare class Bans extends GuildBasedResource<any, GatewayGuildBanModifyD
10
10
  raw(id: string, guild: string): ReturnCache<Omit<GatewayGuildBanModifyDispatchData | APIBan, 'user'> | undefined>;
11
11
  bulk(ids: string[], guild: string): ReturnCache<GuildBanStructure[]>;
12
12
  bulkRaw(ids: string[], guild: string): ReturnCache<Omit<GatewayGuildBanModifyDispatchData | APIBan, 'user'>[]>;
13
- values(guild: string): ReturnCache<GuildBanStructure[]>;
13
+ values(guild: '*' | (string & {})): ReturnCache<GuildBanStructure[]>;
14
14
  valuesRaw(guild: string): ReturnCache<Omit<GatewayGuildBanModifyDispatchData | APIBan, 'user'>[]>;
15
15
  }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Bans = void 0;
4
4
  const transformers_1 = require("../../client/transformers");
5
- const common_1 = require("../../common");
5
+ const fake_promise_1 = require("../../common/it/fake-promise");
6
6
  const guild_based_1 = require("./default/guild-based");
7
7
  class Bans extends guild_based_1.GuildBasedResource {
8
8
  namespace = 'ban';
@@ -15,13 +15,13 @@ class Bans extends guild_based_1.GuildBasedResource {
15
15
  return rest;
16
16
  }
17
17
  get(id, guild) {
18
- return (0, common_1.fakePromise)(super.get(id, guild)).then(rawBan => rawBan ? transformers_1.Transformers.GuildBan(this.client, rawBan, guild) : undefined);
18
+ return (0, fake_promise_1.fakePromise)(super.get(id, guild)).then(rawBan => rawBan ? transformers_1.Transformers.GuildBan(this.client, rawBan, guild) : undefined);
19
19
  }
20
20
  raw(id, guild) {
21
21
  return super.get(id, guild);
22
22
  }
23
23
  bulk(ids, guild) {
24
- return (0, common_1.fakePromise)(super.bulk(ids, guild)).then(bans => bans
24
+ return (0, fake_promise_1.fakePromise)(super.bulk(ids, guild)).then(bans => bans
25
25
  .map(rawBan => {
26
26
  return rawBan ? transformers_1.Transformers.GuildBan(this.client, rawBan, guild) : undefined;
27
27
  })
@@ -31,7 +31,7 @@ class Bans extends guild_based_1.GuildBasedResource {
31
31
  return super.bulk(ids, guild);
32
32
  }
33
33
  values(guild) {
34
- return (0, common_1.fakePromise)(super.values(guild)).then(bans => bans
34
+ return (0, fake_promise_1.fakePromise)(super.values(guild)).then(bans => bans
35
35
  .map(rawBan => {
36
36
  return rawBan ? transformers_1.Transformers.GuildBan(this.client, rawBan, guild) : undefined;
37
37
  })
@@ -10,6 +10,6 @@ export declare class Channels extends GuildRelatedResource<any, APIChannel> {
10
10
  raw(id: string): ReturnCache<Omit<APIChannel, 'permission_overwrites'> | undefined>;
11
11
  bulk(ids: string[]): ReturnCache<ReturnType<typeof channelFrom>[]>;
12
12
  bulkRaw(ids: string[]): ReturnCache<Omit<APIChannel, 'permission_overwrites'>[]>;
13
- values(guild: string): ReturnCache<ReturnType<typeof channelFrom>[]>;
13
+ values(guild: '*' | (string & {})): ReturnCache<ReturnType<typeof channelFrom>[]>;
14
14
  valuesRaw(guild: string): ReturnCache<Omit<APIChannel, 'permission_overwrites'>[]>;
15
15
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Channels = void 0;
4
- const common_1 = require("../../common");
4
+ const fake_promise_1 = require("../../common/it/fake-promise");
5
5
  const structures_1 = require("../../structures");
6
6
  const guild_related_1 = require("./default/guild-related");
7
7
  class Channels extends guild_related_1.GuildRelatedResource {
@@ -15,19 +15,19 @@ class Channels extends guild_related_1.GuildRelatedResource {
15
15
  return rest;
16
16
  }
17
17
  get(id) {
18
- return (0, common_1.fakePromise)(super.get(id)).then(rawChannel => rawChannel ? (0, structures_1.channelFrom)(rawChannel, this.client) : undefined);
18
+ return (0, fake_promise_1.fakePromise)(super.get(id)).then(rawChannel => rawChannel ? (0, structures_1.channelFrom)(rawChannel, this.client) : undefined);
19
19
  }
20
20
  raw(id) {
21
21
  return super.get(id);
22
22
  }
23
23
  bulk(ids) {
24
- return (0, common_1.fakePromise)(super.bulk(ids)).then(channels => channels.map(rawChannel => (0, structures_1.channelFrom)(rawChannel, this.client)));
24
+ return (0, fake_promise_1.fakePromise)(super.bulk(ids)).then(channels => channels.map(rawChannel => (0, structures_1.channelFrom)(rawChannel, this.client)));
25
25
  }
26
26
  bulkRaw(ids) {
27
27
  return super.bulk(ids);
28
28
  }
29
29
  values(guild) {
30
- return (0, common_1.fakePromise)(super.values(guild)).then(channels => channels.map(rawChannel => (0, structures_1.channelFrom)(rawChannel, this.client)));
30
+ return (0, fake_promise_1.fakePromise)(super.values(guild)).then(channels => channels.map(rawChannel => (0, structures_1.channelFrom)(rawChannel, this.client)));
31
31
  }
32
32
  valuesRaw(guild) {
33
33
  return super.values(guild);
@@ -7,7 +7,7 @@ export declare class BaseResource<T = any, S = any> {
7
7
  namespace: string;
8
8
  constructor(cache: Cache, client: UsingClient);
9
9
  filter(data: any, id: string, from: CacheFrom): boolean;
10
- get adapter(): import("../../index").Adapter;
10
+ get adapter(): import("../../..").Adapter;
11
11
  removeIfNI(intent: keyof typeof GatewayIntentBits, id: string): import("../../../common").Awaitable<void>;
12
12
  setIfNI(from: CacheFrom, intent: keyof typeof GatewayIntentBits, id: string, data: S): import("../../../common").Awaitable<void>;
13
13
  get(id: string): ReturnCache<T | undefined>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseResource = void 0;
4
- const common_1 = require("../../../common");
4
+ const fake_promise_1 = require("../../../common/it/fake-promise");
5
5
  class BaseResource {
6
6
  cache;
7
7
  client;
@@ -29,23 +29,23 @@ class BaseResource {
29
29
  }
30
30
  }
31
31
  get(id) {
32
- return this.adapter.get(this.hashId(id));
32
+ return (0, fake_promise_1.fakePromise)(this.adapter.get(this.hashId(id))).then(data => data ?? undefined);
33
33
  }
34
34
  bulk(ids) {
35
- return (0, common_1.fakePromise)(this.adapter.bulkGet(ids.map(id => this.hashId(id)))).then(x => x.filter(y => y));
35
+ return (0, fake_promise_1.fakePromise)(this.adapter.bulkGet(ids.map(id => this.hashId(id)))).then(x => x.filter(y => y));
36
36
  }
37
37
  set(from, id, data) {
38
38
  if (!this.filter(data, id, from))
39
39
  return;
40
- return (0, common_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.set(this.hashId(id), data));
40
+ return (0, fake_promise_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.set(this.hashId(id), data));
41
41
  }
42
42
  patch(from, id, data) {
43
43
  if (!this.filter(data, id, from))
44
44
  return;
45
- return (0, common_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.patch(this.hashId(id), data));
45
+ return (0, fake_promise_1.fakePromise)(this.addToRelationship(id)).then(() => this.adapter.patch(this.hashId(id), data));
46
46
  }
47
47
  remove(id) {
48
- return (0, common_1.fakePromise)(this.removeToRelationship(id)).then(() => this.adapter.remove(this.hashId(id)));
48
+ return (0, fake_promise_1.fakePromise)(this.removeToRelationship(id)).then(() => this.adapter.remove(this.hashId(id)));
49
49
  }
50
50
  keys() {
51
51
  return this.adapter.keys(this.namespace);
@@ -69,8 +69,8 @@ class BaseResource {
69
69
  return this.adapter.removeToRelationship(this.namespace, id);
70
70
  }
71
71
  flush() {
72
- return (0, common_1.fakePromise)(this.adapter.keys(this.namespace)).then(keys => {
73
- return (0, common_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
72
+ return (0, fake_promise_1.fakePromise)(this.adapter.keys(this.namespace)).then(keys => {
73
+ return (0, fake_promise_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
74
74
  return this.adapter.removeRelationship(this.namespace);
75
75
  });
76
76
  });
@@ -8,7 +8,7 @@ export declare class GuildBasedResource<T = any, S = any> {
8
8
  constructor(cache: Cache, client: UsingClient);
9
9
  filter(data: any, id: string, guild_id: string, from: CacheFrom): boolean;
10
10
  parse(data: any, id: string, guild_id: string): any;
11
- get adapter(): import("../../index").Adapter;
11
+ get adapter(): import("../../..").Adapter;
12
12
  removeIfNI(intent: keyof typeof GatewayIntentBits, id: string | string[], guildId: string): import("../../../common").Awaitable<void>;
13
13
  setIfNI(from: CacheFrom, intent: keyof typeof GatewayIntentBits, id: string, guildId: string, data: S): void;
14
14
  get(id: string, guild: string): ReturnCache<(T & {
@@ -22,11 +22,11 @@ export declare class GuildBasedResource<T = any, S = any> {
22
22
  patch(from: CacheFrom, __keys: string, guild: string, data: S): ReturnCache<void>;
23
23
  patch(from: CacheFrom, __keys: [string, any][], guild: string): ReturnCache<void>;
24
24
  remove(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
25
- keys(guild: string): ReturnCache<string[]>;
26
- values(guild: string): ReturnCache<(T & {
25
+ keys(guild: '*' | (string & {})): ReturnCache<string[]>;
26
+ values(guild: '*' | (string & {})): ReturnCache<(T & {
27
27
  guild_id: string;
28
28
  })[]>;
29
- count(guild: string): ReturnCache<number>;
29
+ count(guild: '*' | (string & {})): ReturnCache<number>;
30
30
  contains(id: string, guild: string): ReturnCache<boolean>;
31
31
  getToRelationship(guild: string): import("../../../common").Awaitable<string[]>;
32
32
  addToRelationship(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
@@ -34,5 +34,5 @@ export declare class GuildBasedResource<T = any, S = any> {
34
34
  removeRelationship(id: string | string[]): import("../../../common").Awaitable<void>;
35
35
  hashId(id: string): string;
36
36
  hashGuildId(guild: string, id: string): string;
37
- flush(guild?: '*' | (string & {})): unknown[] | Promise<unknown[]>;
37
+ flush(guild: '*' | (string & {})): unknown[] | Promise<unknown[]>;
38
38
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GuildBasedResource = void 0;
4
- const common_1 = require("../../../common");
4
+ const fake_promise_1 = require("../../../common/it/fake-promise");
5
5
  class GuildBasedResource {
6
6
  cache;
7
7
  client;
@@ -38,37 +38,50 @@ class GuildBasedResource {
38
38
  return this.adapter.get(this.hashGuildId(guild, id));
39
39
  }
40
40
  bulk(ids, guild) {
41
- return (0, common_1.fakePromise)(this.adapter.bulkGet(ids.map(id => this.hashGuildId(guild, id)))).then(x => x.filter(y => y));
41
+ return (0, fake_promise_1.fakePromise)(this.adapter.bulkGet(ids.map(id => this.hashGuildId(guild, id)))).then(x => x.filter(y => y));
42
42
  }
43
43
  set(from, __keys, guild, data) {
44
44
  const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild, from));
45
45
  if (!keys.length)
46
- return (0, common_1.fakePromise)(undefined).then(() => { });
47
- return (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkSet(keys.map(([key, value]) => {
46
+ return (0, fake_promise_1.fakePromise)(undefined).then(() => { });
47
+ return (0, fake_promise_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkSet(keys.map(([key, value]) => {
48
48
  return [this.hashGuildId(guild, key), this.parse(value, key, guild)];
49
49
  })));
50
50
  }
51
51
  patch(from, __keys, guild, data) {
52
52
  const keys = (Array.isArray(__keys) ? __keys : [[__keys, data]]).filter(x => this.filter(x[1], x[0], guild, from));
53
53
  if (!keys.length)
54
- return (0, common_1.fakePromise)(undefined).then(() => { });
55
- return (0, common_1.fakePromise)(this.adapter.bulkGet(keys.map(([key]) => this.hashGuildId(guild, key)))).then(oldDatas => (0, common_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkSet(keys.map(([key, value]) => {
56
- const oldData = oldDatas.find(x => x.id === key) ?? {};
57
- return [this.hashGuildId(guild, key), this.parse({ ...oldData, ...value }, key, guild)];
58
- }))));
54
+ return (0, fake_promise_1.fakePromise)(undefined).then(() => { });
55
+ return (0, fake_promise_1.fakePromise)(this.adapter.bulkGet(keys.map(([key]) => this.hashGuildId(guild, key)))).then(oldDatas => {
56
+ const oldDataMap = new Map();
57
+ for (const item of oldDatas) {
58
+ if (item?.id)
59
+ oldDataMap.set(item.id, item);
60
+ }
61
+ return (0, fake_promise_1.fakePromise)(this.addToRelationship(keys.map(x => x[0]), guild)).then(() => this.adapter.bulkSet(keys.map(([key, value]) => {
62
+ const oldData = oldDataMap.get(key) ?? {};
63
+ return [this.hashGuildId(guild, key), this.parse({ ...oldData, ...value }, key, guild)];
64
+ })));
65
+ });
59
66
  }
60
67
  remove(id, guild) {
61
68
  const ids = Array.isArray(id) ? id : [id];
62
- return (0, common_1.fakePromise)(this.removeToRelationship(ids, guild)).then(() => this.adapter.bulkRemove(ids.map(x => this.hashGuildId(guild, x))));
69
+ return (0, fake_promise_1.fakePromise)(this.removeToRelationship(ids, guild)).then(() => this.adapter.bulkRemove(ids.map(x => this.hashGuildId(guild, x))));
63
70
  }
64
71
  keys(guild) {
65
- return this.adapter.scan(this.hashGuildId(guild, '*'), true);
72
+ if (guild === '*')
73
+ return this.adapter.scan(this.hashGuildId(guild, '*'), true);
74
+ return (0, fake_promise_1.fakePromise)(this.adapter.getToRelationship(this.hashId(guild))).then(keys => keys.map(x => this.hashGuildId(guild, x)));
66
75
  }
67
76
  values(guild) {
68
- return this.adapter.scan(this.hashGuildId(guild, '*'));
77
+ if (guild === '*')
78
+ return this.adapter.scan(this.hashGuildId(guild, '*'));
79
+ return (0, fake_promise_1.fakePromise)(this.adapter.getToRelationship(this.hashId(guild))).then(keys => this.adapter.bulkGet(keys.map(x => this.hashGuildId(guild, x))));
69
80
  }
70
81
  count(guild) {
71
- return (0, common_1.fakePromise)(this.adapter.scan(this.hashGuildId(guild, '*'), true)).then(data => data.length);
82
+ if (guild === '*')
83
+ return (0, fake_promise_1.fakePromise)(this.adapter.scan(this.hashGuildId(guild, '*'), true)).then(data => data.length);
84
+ return this.adapter.count(this.hashId(guild));
72
85
  }
73
86
  contains(id, guild) {
74
87
  return this.adapter.contains(this.hashId(guild), id);
@@ -91,9 +104,9 @@ class GuildBasedResource {
91
104
  hashGuildId(guild, id) {
92
105
  return id.startsWith(this.namespace) ? id : `${this.namespace}.${guild}.${id}`;
93
106
  }
94
- flush(guild = '*') {
95
- return (0, common_1.fakePromise)(this.keys(guild)).then(keys => {
96
- return (0, common_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
107
+ flush(guild) {
108
+ return (0, fake_promise_1.fakePromise)(this.keys(guild)).then(keys => {
109
+ return (0, fake_promise_1.fakePromise)(this.adapter.bulkRemove(keys)).then(() => {
97
110
  const maybePromises = [];
98
111
  for (const i of keys) {
99
112
  const guildId = i.split('.').at(-2);
@@ -8,7 +8,7 @@ export declare class GuildRelatedResource<T = any, S = any> {
8
8
  constructor(cache: Cache, client: UsingClient);
9
9
  filter(data: any, id: string, guild_id: string, from: CacheFrom): boolean;
10
10
  parse(data: any, id: string, guild_id: string): any;
11
- get adapter(): import("../../index").Adapter;
11
+ get adapter(): import("../../..").Adapter;
12
12
  removeIfNI(intent: keyof typeof GatewayIntentBits, id: string | string[], guildId: string): import("../../../common").Awaitable<void>;
13
13
  setIfNI(from: CacheFrom, intent: keyof typeof GatewayIntentBits, id: string, guildId: string, data: S): void;
14
14
  get(id: string): ReturnCache<(T & {
@@ -22,16 +22,16 @@ export declare class GuildRelatedResource<T = any, S = any> {
22
22
  patch(from: CacheFrom, __keys: string, guild: string, data?: any): ReturnCache<void>;
23
23
  patch(from: CacheFrom, __keys: [string, any][], guild: string): ReturnCache<void>;
24
24
  remove(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
25
- keys(guild: string): ReturnCache<string[]>;
26
- values(guild: string): ReturnCache<(T & {
25
+ keys(guild: '*' | (string & {})): ReturnCache<string[]>;
26
+ values(guild: '*' | (string & {})): ReturnCache<(T & {
27
27
  guild_id: string;
28
28
  })[]>;
29
- count(to: string): ReturnCache<number>;
29
+ count(to: '*' | (string & {})): ReturnCache<number>;
30
30
  contains(id: string, guild: string): ReturnCache<boolean>;
31
31
  getToRelationship(guild: string): import("../../../common").Awaitable<string[]>;
32
32
  addToRelationship(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
33
33
  removeToRelationship(id: string | string[], guild: string): import("../../../common").Awaitable<void>;
34
34
  removeRelationship(id: string | string[]): import("../../../common").Awaitable<void>;
35
35
  hashId(id: string): string;
36
- flush(guild: string): import("../../../common").Awaitable<void>;
36
+ flush(guild?: '*' | (string & {})): import("../../../common").Awaitable<void>;
37
37
  }