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
@@ -0,0 +1,23 @@
1
+ import type { Awaitable } from '../../common/types/util';
2
+ import type { BaseClient } from '../base';
3
+ import { type PluginEventContributionScope, type PluginRuntimeRecord, type PluginRuntimeRegistry } from './registry';
4
+ import type { PluginSharedRegistry, RegisteredPluginShared, SharedKey } from './types';
5
+ type SharedFactory = (client: BaseClient) => unknown;
6
+ type SharedDispose = (value: unknown) => Awaitable<void>;
7
+ export declare function createSharedKey<const Name extends keyof RegisteredPluginShared & string>(name: Name): SharedKey<RegisteredPluginShared[Name], Name>;
8
+ export declare function createSharedKey<T>(): <const Name extends string>(name: Name) => SharedKey<T, Name>;
9
+ export declare function createSharedKey<const Name extends string>(name: Name): SharedKey<unknown, Name>;
10
+ export declare function sharedName(name: string | SharedKey<unknown, string>): string;
11
+ export declare function addPluginShared(registry: PluginRuntimeRegistry, record: PluginRuntimeRecord, name: string, factory: SharedFactory, scope: PluginEventContributionScope, opts?: {
12
+ dispose?: SharedDispose;
13
+ override?: boolean;
14
+ }): void;
15
+ export declare function removePluginShared(registry: PluginRuntimeRegistry, record: PluginRuntimeRecord, names: readonly string[], scope: PluginEventContributionScope): void;
16
+ export declare function createSharedRegistry(client: BaseClient, registry: PluginRuntimeRegistry): PluginSharedRegistry;
17
+ export declare function disposePluginSharedValues(shared: PluginSharedRegistry, registry: PluginRuntimeRegistry, record: PluginRuntimeRecord): Promise<unknown[]>;
18
+ export declare function cleanupPluginSharedContributions(registry: PluginRuntimeRegistry, record: PluginRuntimeRecord, shouldRemove: (contribution: {
19
+ scope: PluginEventContributionScope;
20
+ }) => boolean): void;
21
+ export declare function cleanupPluginDynamicSharedContributions(registry: PluginRuntimeRegistry, record: PluginRuntimeRecord): Promise<unknown[]>;
22
+ export declare function clearSharedRegistryInstances(shared: PluginSharedRegistry): void;
23
+ export {};
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createSharedKey = createSharedKey;
4
+ exports.sharedName = sharedName;
5
+ exports.addPluginShared = addPluginShared;
6
+ exports.removePluginShared = removePluginShared;
7
+ exports.createSharedRegistry = createSharedRegistry;
8
+ exports.disposePluginSharedValues = disposePluginSharedValues;
9
+ exports.cleanupPluginSharedContributions = cleanupPluginSharedContributions;
10
+ exports.cleanupPluginDynamicSharedContributions = cleanupPluginDynamicSharedContributions;
11
+ exports.clearSharedRegistryInstances = clearSharedRegistryInstances;
12
+ const errors_1 = require("./errors");
13
+ const order_1 = require("./order");
14
+ const registry_1 = require("./registry");
15
+ const sharedStates = new WeakMap();
16
+ function createSharedKey(name) {
17
+ if (name === undefined)
18
+ return keyName => Object.freeze({ name: keyName });
19
+ return Object.freeze({ name });
20
+ }
21
+ function sharedName(name) {
22
+ return typeof name === 'string' ? name : name.name;
23
+ }
24
+ function addPluginShared(registry, record, name, factory, scope, opts) {
25
+ const owner = registry.sharedOwners.get(name);
26
+ trackDynamicSharedMutation(registry, record, name, scope);
27
+ if (owner) {
28
+ if (!opts?.override) {
29
+ throw (0, errors_1.createPluginConflictError)(record.plugin.name, `shared.${name}`, record.index, `Shared value "${name}" is already claimed by plugin "${owner.plugin.name}".`, record.plugin.instanceId);
30
+ }
31
+ (0, registry_1.assertCanMutatePluginContribution)(registry, record, 'override', 'shared', name, owner, `shared.${name}`);
32
+ queueSharedDisposal(registry, name);
33
+ recordSharedMutationDiagnostic(registry, record, 'override', name, owner);
34
+ }
35
+ registry.sharedOwners.set(name, record);
36
+ registry.shared.set(name, { record, factory, dispose: opts?.dispose, scope });
37
+ }
38
+ function removePluginShared(registry, record, names, scope) {
39
+ for (const name of names) {
40
+ const owner = registry.sharedOwners.get(name);
41
+ if (!owner)
42
+ continue;
43
+ trackDynamicSharedMutation(registry, record, name, scope);
44
+ (0, registry_1.assertCanMutatePluginContribution)(registry, record, 'remove', 'shared', name, owner, `shared.${name}`);
45
+ queueSharedDisposal(registry, name);
46
+ registry.shared.delete(name);
47
+ if (registry.sharedOwners.get(name) === owner)
48
+ registry.sharedOwners.delete(name);
49
+ recordSharedMutationDiagnostic(registry, record, 'remove', name, owner);
50
+ }
51
+ }
52
+ function createSharedRegistry(client, registry) {
53
+ const instances = new Map();
54
+ const resolve = (name) => {
55
+ if (instances.has(name))
56
+ return instances.get(name);
57
+ const shared = registry.shared.get(name);
58
+ if (!shared)
59
+ return undefined;
60
+ let value;
61
+ try {
62
+ value = shared.factory(client);
63
+ }
64
+ catch (error) {
65
+ throw (0, errors_1.wrapPluginError)(shared.record.plugin.name, `shared.${name}`, shared.record.index, error, undefined, shared.record.plugin.instanceId);
66
+ }
67
+ instances.set(name, value);
68
+ return value;
69
+ };
70
+ const shared = Object.freeze({
71
+ get(name) {
72
+ return resolve(sharedName(name));
73
+ },
74
+ unwrap(name) {
75
+ const key = sharedName(name);
76
+ if (!registry.shared.has(key)) {
77
+ throw (0, errors_1.createPluginConflictError)('<shared>', `shared.${key}`, -1, `Shared value "${key}" is not registered.`);
78
+ }
79
+ return resolve(key);
80
+ },
81
+ has(name) {
82
+ return registry.shared.has(sharedName(name));
83
+ },
84
+ });
85
+ sharedStates.set(shared, { instances });
86
+ return shared;
87
+ }
88
+ async function disposePluginSharedValues(shared, registry, record) {
89
+ const state = sharedStates.get(shared);
90
+ if (!state)
91
+ return [];
92
+ const errors = [];
93
+ for (const [name, contribution] of [...registry.shared.entries()].reverse()) {
94
+ if (contribution.record !== record || !state.instances.has(name))
95
+ continue;
96
+ const value = state.instances.get(name);
97
+ try {
98
+ await contribution.dispose?.(value);
99
+ }
100
+ catch (error) {
101
+ errors.push((0, errors_1.wrapPluginError)(contribution.record.plugin.name, `shared.${name}`, contribution.record.index, error, 'PLUGIN_TEARDOWN_FAILED', contribution.record.plugin.instanceId));
102
+ }
103
+ finally {
104
+ state.instances.delete(name);
105
+ }
106
+ }
107
+ errors.push(...(await drainQueuedSharedDisposals(registry)));
108
+ return errors;
109
+ }
110
+ function cleanupPluginSharedContributions(registry, record, shouldRemove) {
111
+ for (const [name, contribution] of registry.shared) {
112
+ if (contribution.record !== record || !shouldRemove(contribution))
113
+ continue;
114
+ registry.shared.delete(name);
115
+ if (registry.sharedOwners.get(name) === record)
116
+ registry.sharedOwners.delete(name);
117
+ }
118
+ }
119
+ async function cleanupPluginDynamicSharedContributions(registry, record) {
120
+ const errors = [];
121
+ for (let index = registry.sharedMutations.length - 1; index >= 0; index--) {
122
+ const mutation = registry.sharedMutations[index];
123
+ if (mutation.record !== record || mutation.scope === 'register')
124
+ continue;
125
+ const error = await disposeSharedInstance(registry, mutation.name);
126
+ if (error)
127
+ errors.push(error);
128
+ if (mutation.previous) {
129
+ registry.shared.set(mutation.name, mutation.previous);
130
+ if (mutation.previousOwner)
131
+ registry.sharedOwners.set(mutation.name, mutation.previousOwner);
132
+ else
133
+ registry.sharedOwners.delete(mutation.name);
134
+ }
135
+ else {
136
+ registry.shared.delete(mutation.name);
137
+ registry.sharedOwners.delete(mutation.name);
138
+ }
139
+ registry.sharedMutations.splice(index, 1);
140
+ }
141
+ cleanupPluginSharedContributions(registry, record, contribution => contribution.scope !== 'register');
142
+ errors.push(...(await drainQueuedSharedDisposals(registry)));
143
+ return errors;
144
+ }
145
+ function clearSharedRegistryInstances(shared) {
146
+ sharedStates.get(shared)?.instances.clear();
147
+ }
148
+ function queueSharedDisposal(registry, name) {
149
+ registry.sharedDisposals.push(disposeSharedInstance(registry, name));
150
+ }
151
+ async function drainQueuedSharedDisposals(registry) {
152
+ const pending = registry.sharedDisposals.splice(0);
153
+ const errors = [];
154
+ for (const error of await Promise.all(pending)) {
155
+ if (error !== undefined)
156
+ errors.push(error);
157
+ }
158
+ return errors;
159
+ }
160
+ async function disposeSharedInstance(registry, name) {
161
+ const shared = registry.client?.shared;
162
+ if (!shared)
163
+ return;
164
+ const state = sharedStates.get(shared);
165
+ if (!state?.instances.has(name))
166
+ return;
167
+ const value = state.instances.get(name);
168
+ const contribution = registry.shared.get(name);
169
+ try {
170
+ await contribution?.dispose?.(value);
171
+ }
172
+ catch (error) {
173
+ return (0, errors_1.wrapPluginError)(contribution?.record.plugin.name ?? '<unknown>', `shared.${name}`, contribution?.record.index ?? -1, error, 'PLUGIN_TEARDOWN_FAILED', contribution?.record.plugin.instanceId);
174
+ }
175
+ finally {
176
+ state.instances.delete(name);
177
+ }
178
+ return undefined;
179
+ }
180
+ function recordSharedMutationDiagnostic(registry, record, action, name, owner) {
181
+ (0, registry_1.recordContributionMutationDiagnostic)(registry, { record, sequence: (0, order_1.nextPluginContributionSequence)(registry) }, action, 'shared', name, owner, `shared.${name}`);
182
+ }
183
+ function trackDynamicSharedMutation(registry, record, name, scope) {
184
+ if (scope === 'register')
185
+ return;
186
+ registry.sharedMutations.push({
187
+ record,
188
+ name,
189
+ scope,
190
+ previous: registry.shared.get(name),
191
+ previousOwner: registry.sharedOwners.get(name),
192
+ });
193
+ }
@@ -0,0 +1,398 @@
1
+ import type { RestObserver, RestObserverFailPayload, RestObserverRatelimitPayload, RestObserverRequestPayload, RestObserverSuccessPayload } from '../../api/shared';
2
+ import type { BaseResource, Cache } from '../../cache';
3
+ import type { AnyMiddlewareContext, Command, CommandContext, ContextMenuCommand, EntryPointCommand, EntryPointContext, MenuCommandContext, MiddlewareContext, SubCommand, UsingClient } from '../../commands';
4
+ import type { CommandAutocompleteOption } from '../../commands/applications/chat';
5
+ import type { HandleableCommand, HandleableCommandInstance } from '../../commands/handler';
6
+ import type { Awaitable } from '../../common/types/util';
7
+ import type { ComponentCommand, ModalCommand } from '../../components';
8
+ import type { ClientEvent, ClientNameEvents, CustomEventsKeys } from '../../events';
9
+ import type { GatewayEvents, ResolveEventParams } from '../../events/handler';
10
+ import type { AutocompleteInteraction } from '../../structures';
11
+ import type { GatewayDispatchPayload, GatewayIntentBits, GatewaySendPayload, LocaleString } from '../../types';
12
+ import type { BaseClient, BaseClientOptions } from '../base';
13
+ import type { MessageStructure, OptionResolverStructure } from '../transformers';
14
+ export interface SeyfertRegistry {
15
+ }
16
+ export interface RegisteredPluginShared {
17
+ }
18
+ export interface SharedKey<T, Name extends string = string> {
19
+ readonly name: Name;
20
+ readonly __shared?: T;
21
+ }
22
+ export type SharedValue<T> = T extends SharedKey<infer Value, string> ? Value : never;
23
+ export interface PluginSharedRegistry {
24
+ get<const Name extends keyof RegisteredPluginShared & string>(name: Name): RegisteredPluginShared[Name] | undefined;
25
+ get<T, const Name extends string>(key: SharedKey<T, Name>): T | undefined;
26
+ unwrap<const Name extends keyof RegisteredPluginShared & string>(name: Name): RegisteredPluginShared[Name];
27
+ unwrap<T, const Name extends string>(key: SharedKey<T, Name>): T;
28
+ has<const Name extends string>(name: Name | SharedKey<unknown, Name>): boolean;
29
+ }
30
+ export interface PluginSharedOptions<T> {
31
+ dispose?: (value: T) => Awaitable<void>;
32
+ override?: boolean;
33
+ }
34
+ export interface PluginLangOptions {
35
+ readonly prefix: string;
36
+ }
37
+ export interface PluginCommandContributionOptions extends PluginContributionOptions {
38
+ guilds?: readonly string[];
39
+ }
40
+ export interface PluginMiddlewareDenialMetadata {
41
+ middleware: string;
42
+ scope: 'global' | 'command';
43
+ }
44
+ export declare enum PluginOrder {
45
+ Before = "before",
46
+ After = "after"
47
+ }
48
+ export type PluginOrderOpt = PluginOrder.Before | PluginOrder.After | number;
49
+ export type PluginDiagnosticSeverity = 'info' | 'warn' | 'error';
50
+ export type PluginDiagnosticCode = 'missing-optional-requirement' | 'unknown-intent-bits' | 'gateway-send-payload-veto' | 'gateway-dispatch-veto' | 'contribution-override' | 'contribution-removed' | 'command-guild-scope' | 'static-keys-multi-instance' | (string & {});
51
+ export type PluginLifecycleStatus = 'registered' | 'setting-up' | 'ready' | 'closing' | 'closed' | 'failed';
52
+ export type PluginRequirement = `plugin:${string}`;
53
+ type SemverVersion = `${number}.${number}.${number}${string}`;
54
+ export type SemverRange = SemverVersion | `>=${SemverVersion}` | `^${SemverVersion}` | `~${SemverVersion}`;
55
+ export type PluginRequirementInput = PluginRequirement | {
56
+ req: PluginRequirement;
57
+ range?: SemverRange;
58
+ optional?: boolean;
59
+ capability?: never;
60
+ } | {
61
+ capability: SharedKey<unknown, string>;
62
+ optional?: boolean;
63
+ req?: never;
64
+ range?: never;
65
+ };
66
+ export type PluginIntentResolvable = keyof typeof GatewayIntentBits | GatewayIntentBits | number;
67
+ export type PluginLifecyclePhase = 'resolve' | 'requires' | 'options' | 'register' | 'client' | 'ctx' | 'shared' | 'commands.add' | 'components.add' | 'setup' | 'teardown' | `event:${string}`;
68
+ export interface PluginDiagnosticMessage {
69
+ plugin: string;
70
+ instanceId?: string;
71
+ index: number;
72
+ phase: PluginLifecyclePhase | string;
73
+ severity: PluginDiagnosticSeverity;
74
+ code?: PluginDiagnosticCode;
75
+ message: string;
76
+ data?: Record<string, unknown>;
77
+ }
78
+ export interface PluginRequirementDiagnostic {
79
+ kind: 'plugin' | 'capability';
80
+ req: PluginRequirement | string;
81
+ range?: SemverRange;
82
+ resolvedVersion?: string;
83
+ optional: boolean;
84
+ satisfied: boolean;
85
+ }
86
+ export interface PluginLoadedMetadata<TKind extends 'commands' | 'components', TItem = unknown> {
87
+ kind: TKind;
88
+ total: number;
89
+ items: readonly TItem[];
90
+ plugin: {
91
+ total: number;
92
+ sources: Readonly<Record<string, number>>;
93
+ };
94
+ }
95
+ export interface PluginUploadCommandsMetadata {
96
+ applicationId: string;
97
+ cachePath?: string;
98
+ commands: number;
99
+ guildId?: string;
100
+ reason: 'cache-hit' | 'cache-miss' | 'forced';
101
+ scope: 'global' | 'guild';
102
+ status: 'skipped' | 'uploaded';
103
+ }
104
+ export interface PluginAutocompletePayload {
105
+ client: BaseClient;
106
+ command?: CommandAutocompleteOption;
107
+ interaction: AutocompleteInteraction;
108
+ optionsResolver: OptionResolverStructure;
109
+ }
110
+ export type PluginAutocompleteNext = () => Awaitable<void>;
111
+ export type PluginAutocompleteWrapper = (payload: PluginAutocompletePayload, next: PluginAutocompleteNext) => Awaitable<void>;
112
+ export interface PluginGatewaySendPayload {
113
+ client: BaseClient;
114
+ payload: GatewaySendPayload;
115
+ shardId: number;
116
+ }
117
+ export type PluginGatewaySendPayloadWrapper = (payload: PluginGatewaySendPayload) => Awaitable<GatewaySendPayload | null | undefined | void>;
118
+ export interface PluginGatewayDispatchMeta {
119
+ readonly client: BaseClient;
120
+ readonly shardId: number;
121
+ }
122
+ export type PluginGatewayDispatchNext = (packet?: GatewayDispatchPayload) => Awaitable<GatewayDispatchPayload | null>;
123
+ export type PluginGatewayDispatchInterceptor = (packet: GatewayDispatchPayload, next: PluginGatewayDispatchNext, meta: PluginGatewayDispatchMeta) => Awaitable<GatewayDispatchPayload | null | undefined | void>;
124
+ export type PluginRestRequestPayload = RestObserverRequestPayload<BaseClient>;
125
+ export type PluginRestSuccessPayload = RestObserverSuccessPayload<BaseClient>;
126
+ export type PluginRestFailPayload = RestObserverFailPayload<BaseClient>;
127
+ export type PluginRestRatelimitPayload = RestObserverRatelimitPayload<BaseClient>;
128
+ export type PluginRestObserver = RestObserver<BaseClient>;
129
+ export type PluginCacheResourceConstructor<T extends BaseResource = BaseResource> = new (cache: Cache, client: UsingClient) => T;
130
+ export interface PluginCacheResourceOptions {
131
+ onPacket?(event: GatewayDispatchPayload, cache: Cache): Awaitable<void>;
132
+ intents?: readonly PluginIntentResolvable[];
133
+ }
134
+ export interface SeyfertPluginHooks {
135
+ 'plugins:ready': [client: BaseClient];
136
+ 'plugins:setupComplete': [client: BaseClient];
137
+ 'commands:beforeLoad': [client: BaseClient, dir: string | undefined];
138
+ 'commands:afterLoad': [metadata: PluginLoadedMetadata<'commands'>];
139
+ 'components:beforeLoad': [client: BaseClient, dir: string | undefined];
140
+ 'components:afterLoad': [metadata: PluginLoadedMetadata<'components'>];
141
+ 'events:beforeLoad': [client: BaseClient, dir: string | undefined];
142
+ 'events:afterLoad': [client: BaseClient, dir: string | undefined];
143
+ 'client:close': [client: BaseClient];
144
+ }
145
+ export type PluginHookName = keyof SeyfertPluginHooks & string;
146
+ export type PluginHookPayload<K extends PluginHookName> = SeyfertPluginHooks[K] extends readonly unknown[] ? SeyfertPluginHooks[K] : never;
147
+ type PluginHookPayloadClientView<T, E extends object> = T extends BaseClient ? T & E : T;
148
+ type PluginHookPayloadTupleView<T extends readonly unknown[], E extends object> = T extends readonly [
149
+ infer Head,
150
+ ...infer Tail
151
+ ] ? [PluginHookPayloadClientView<Head, E>, ...PluginHookPayloadTupleView<Tail, E>] : [];
152
+ export type PluginHookPayloadFor<K extends PluginHookName, E extends object = {}> = PluginHookPayloadTupleView<PluginHookPayload<K>, E>;
153
+ export type PluginHookHandler<K extends PluginHookName = PluginHookName, E extends object = {}> = (...args: PluginHookPayloadFor<K, E>) => Awaitable<unknown>;
154
+ export type SeyfertPluginOptions<TOptions extends BaseClientOptions = BaseClientOptions> = Partial<Omit<TOptions, 'plugins'>>;
155
+ export type SeyfertCommandDefaults<TOptions extends BaseClientOptions = BaseClientOptions> = NonNullable<NonNullable<TOptions['commands']>['defaults']>;
156
+ export type SeyfertComponentDefaults<TOptions extends BaseClientOptions = BaseClientOptions> = NonNullable<NonNullable<TOptions['components']>['defaults']>;
157
+ export type SeyfertModalDefaults<TOptions extends BaseClientOptions = BaseClientOptions> = NonNullable<NonNullable<TOptions['modals']>['defaults']>;
158
+ export type PluginClientMap<T extends object, I extends readonly AnySeyfertPlugin[] = readonly []> = {
159
+ readonly [K in keyof T]: (client: BaseClient & ExtendOf<I>) => T[K];
160
+ };
161
+ export type PluginContextInteraction = Parameters<NonNullable<BaseClientOptions['context']>>[0] | MessageStructure;
162
+ export type PluginContextMap<T extends object, I extends readonly AnySeyfertPlugin[] = readonly [], E extends object = {}> = {
163
+ readonly [K in keyof T]: (interaction: PluginContextInteraction, client: BaseClient & ExtendOf<I> & E) => T[K];
164
+ };
165
+ export type PluginMiddlewareMap = Record<string, AnyMiddlewareContext>;
166
+ export type AnySeyfertPlugin = SeyfertPlugin<any, any, readonly AnySeyfertPlugin[], any>;
167
+ export type PluginExtensionOf<T> = T extends SeyfertPlugin<infer E, any, any, any> ? E : {};
168
+ export type PluginContextOf<T> = T extends SeyfertPlugin<any, infer C, any, any> ? C : {};
169
+ export type PluginMiddlewaresOf<T> = T extends SeyfertPlugin<any, any, any, infer M> ? (IsOpenPluginMiddlewareMap<M> extends true ? {} : M) : {};
170
+ type PluginImportsOf<T> = T extends SeyfertPlugin<any, any, infer I, any> ? I[number] : never;
171
+ type PluginClosureDepth = [never, 0, 1, 2, 3, 4, 5];
172
+ type PluginClosureOf<T, Depth extends number = 5> = [Depth] extends [0] ? T : T | PluginClosureOf<PluginImportsOf<T>, PluginClosureDepth[Depth]>;
173
+ type PluginTupleClosure<TPlugins extends readonly AnySeyfertPlugin[]> = PluginClosureOf<TPlugins[number]>;
174
+ export type ExtendOf<TPlugins extends readonly AnySeyfertPlugin[]> = UnionToIntersection<PluginExtensionOf<PluginTupleClosure<TPlugins>>>;
175
+ export type ContextOf<TPlugins extends readonly AnySeyfertPlugin[]> = UnionToIntersection<PluginContextOf<PluginTupleClosure<TPlugins>>>;
176
+ export type MiddlewaresOf<TPlugins extends readonly AnySeyfertPlugin[]> = UnionToIntersection<PluginMiddlewaresOf<PluginTupleClosure<TPlugins>>>;
177
+ export type RegisteredPlugins = SeyfertRegistry extends {
178
+ plugins: infer T extends readonly AnySeyfertPlugin[];
179
+ } ? T : readonly [];
180
+ export type RegisteredPluginExtension = Materialize<ExtendOf<RegisteredPlugins>>;
181
+ export type RegisteredPluginContext = Materialize<ContextOf<RegisteredPlugins>>;
182
+ export type RegisteredPluginMiddlewares = Materialize<MiddlewaresOf<RegisteredPlugins>>;
183
+ export type PluginUsingClient<TPlugins extends readonly AnySeyfertPlugin[] = RegisteredPlugins> = BaseClient & Materialize<ExtendOf<TPlugins>>;
184
+ export type PluginContextMapOf<TPlugins extends readonly AnySeyfertPlugin[] = RegisteredPlugins> = Materialize<ContextOf<TPlugins>>;
185
+ export type PluginMiddlewaresMapOf<TPlugins extends readonly AnySeyfertPlugin[] = RegisteredPlugins> = Materialize<MiddlewaresOf<TPlugins>>;
186
+ type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer R) => void ? R : never;
187
+ type IsAny<T> = 0 extends 1 & T ? true : false;
188
+ type IsOpenPluginMiddlewareMap<T> = IsAny<T> extends true ? true : string extends keyof T ? true : false;
189
+ type Materialize<T> = {
190
+ [K in keyof T]: T[K];
191
+ };
192
+ export type HandleableComponent = new () => ComponentCommand;
193
+ export type HandleableModal = new () => ModalCommand;
194
+ export type PluginCommandInstance = HandleableCommandInstance;
195
+ export type PluginComponentInstance = ComponentCommand;
196
+ export type PluginModalInstance = ModalCommand;
197
+ export type PluginCommandLoadable = HandleableCommand | PluginCommandInstance;
198
+ export type PluginComponentLoadable = HandleableComponent | PluginComponentInstance;
199
+ export type PluginModalLoadable = HandleableModal | PluginModalInstance;
200
+ export type PluginHandlerKind = 'command' | 'component' | 'modal' | 'event';
201
+ export type PluginHandlerConstructor = HandleableCommand | HandleableComponent | HandleableModal;
202
+ export type PluginHandlerInstance = PluginCommandInstance | PluginComponentInstance | PluginModalInstance;
203
+ /** Raw event module export: a `createEvent` object, or a class to be normalized into one (e.g. DI containers). */
204
+ export type PluginEventLoadable = ClientEvent | object;
205
+ export interface PluginHandlerValueByKind {
206
+ command: PluginCommandInstance;
207
+ component: PluginComponentInstance;
208
+ modal: PluginModalInstance;
209
+ event: PluginEventLoadable;
210
+ }
211
+ export interface PluginHandlerMetadata<K extends PluginHandlerKind = PluginHandlerKind> {
212
+ kind: K;
213
+ }
214
+ export type PluginHandlerCreator = <T extends PluginHandlerConstructor>(constructor: T, next: () => InstanceType<T>, metadata: PluginHandlerMetadata) => InstanceType<T>;
215
+ export type PluginHandlerTransformer = <K extends PluginHandlerKind = PluginHandlerKind>(instance: PluginHandlerValueByKind[K], metadata: PluginHandlerMetadata<K>) => PluginHandlerValueByKind[K] | void;
216
+ export interface PluginHandlerOptions {
217
+ kinds?: readonly PluginHandlerKind[];
218
+ order?: PluginOrderOpt;
219
+ }
220
+ export type PluginDisposer = () => void;
221
+ export type PluginEventErrorHandler = (error: unknown, name: string) => unknown;
222
+ export interface PluginContributionOptions {
223
+ override?: boolean;
224
+ }
225
+ export interface PluginMiddlewareOptions extends PluginContributionOptions {
226
+ global?: boolean;
227
+ order?: PluginOrderOpt;
228
+ }
229
+ export type PluginCommandObserverContext = CommandContext | MenuCommandContext<any, never> | EntryPointContext;
230
+ export type PluginCommandObserverCommand = Command | SubCommand | ContextMenuCommand | EntryPointCommand;
231
+ export interface PluginCommandObserver {
232
+ onBeforeOptions?(context: CommandContext): Awaitable<unknown>;
233
+ onBeforeMiddlewares?(context: PluginCommandObserverContext): Awaitable<unknown>;
234
+ onMiddlewaresError?(context: PluginCommandObserverContext, error: string, metadata: PluginMiddlewareDenialMetadata): Awaitable<unknown>;
235
+ onRunError?(context: PluginCommandObserverContext, error: unknown): Awaitable<unknown>;
236
+ onAfterRun?(context: PluginCommandObserverContext, error: unknown | undefined): Awaitable<unknown>;
237
+ onInternalError?(client: UsingClient, command: PluginCommandObserverCommand, error?: unknown): Awaitable<unknown>;
238
+ }
239
+ export interface SeyfertPluginApi<M extends PluginMiddlewareMap = PluginMiddlewareMap, E extends object = {}> {
240
+ has(req: PluginRequirement): boolean;
241
+ events: {
242
+ on<E extends ClientNameEvents | CustomEventsKeys | GatewayEvents>(name: E, handler: (...args: ResolveEventParams<E>) => unknown, opts?: {
243
+ once?: boolean;
244
+ order?: PluginOrderOpt;
245
+ }): PluginDisposer;
246
+ once<E extends ClientNameEvents | CustomEventsKeys | GatewayEvents>(name: E, handler: (...args: ResolveEventParams<E>) => unknown): PluginDisposer;
247
+ onAny(handler: (name: string, ...args: unknown[]) => unknown, opts?: {
248
+ order?: PluginOrderOpt;
249
+ }): PluginDisposer;
250
+ onError(handler: PluginEventErrorHandler, opts?: {
251
+ order?: PluginOrderOpt;
252
+ }): PluginDisposer;
253
+ };
254
+ commands: {
255
+ add(...commands: PluginCommandLoadable[]): void;
256
+ add(...args: [...commands: PluginCommandLoadable[], opts: PluginCommandContributionOptions]): void;
257
+ remove(...names: string[]): void;
258
+ observe(observer: PluginCommandObserver, opts?: {
259
+ order?: PluginOrderOpt;
260
+ }): PluginDisposer;
261
+ defaults(hooks: Partial<SeyfertCommandDefaults>, opts?: {
262
+ suppressDefault?: boolean | readonly (keyof SeyfertCommandDefaults)[];
263
+ order?: PluginOrderOpt;
264
+ }): void;
265
+ };
266
+ rest: {
267
+ observe(observer: PluginRestObserver, opts?: {
268
+ order?: PluginOrderOpt;
269
+ }): PluginDisposer;
270
+ };
271
+ hooks: {
272
+ on<K extends PluginHookName>(name: K, handler: PluginHookHandler<K, E>, opts?: {
273
+ order?: PluginOrderOpt;
274
+ }): PluginDisposer;
275
+ };
276
+ handlers: {
277
+ construct(creator: PluginHandlerCreator, opts?: PluginHandlerOptions): void;
278
+ transform(transformer: PluginHandlerTransformer, opts?: PluginHandlerOptions): void;
279
+ };
280
+ components: {
281
+ add(...components: PluginComponentLoadable[]): void;
282
+ add(...args: [...components: PluginComponentLoadable[], opts: PluginContributionOptions]): void;
283
+ remove(...customIds: string[]): void;
284
+ defaults(hooks: Partial<SeyfertComponentDefaults>, opts?: {
285
+ suppressDefault?: boolean | readonly (keyof SeyfertComponentDefaults)[];
286
+ order?: PluginOrderOpt;
287
+ }): void;
288
+ };
289
+ modals: {
290
+ add(...modals: PluginModalLoadable[]): void;
291
+ add(...args: [...modals: PluginModalLoadable[], opts: PluginContributionOptions]): void;
292
+ remove(...customIds: string[]): void;
293
+ defaults(hooks: Partial<SeyfertModalDefaults>, opts?: {
294
+ suppressDefault?: boolean | readonly (keyof SeyfertModalDefaults)[];
295
+ order?: PluginOrderOpt;
296
+ }): void;
297
+ };
298
+ middlewares: {
299
+ add<const Name extends keyof M & string>(name: Name, middleware: M[Name], opts?: PluginMiddlewareOptions): void;
300
+ add<const Name extends string>(name: Name extends keyof M & string ? never : Name, middleware: MiddlewareContext, opts?: PluginMiddlewareOptions): void;
301
+ remove(...names: string[]): void;
302
+ };
303
+ autocomplete: {
304
+ wrap(wrapper: PluginAutocompleteWrapper, opts?: {
305
+ order?: PluginOrderOpt;
306
+ }): void;
307
+ };
308
+ gateway: {
309
+ addIntents(...intents: PluginIntentResolvable[]): void;
310
+ wrapSendPayload(wrapper: PluginGatewaySendPayloadWrapper, opts?: {
311
+ order?: PluginOrderOpt;
312
+ }): void;
313
+ onDispatch(interceptor: PluginGatewayDispatchInterceptor, opts?: {
314
+ order?: PluginOrderOpt;
315
+ }): PluginDisposer;
316
+ };
317
+ cache: {
318
+ resource(name: string, resource: PluginCacheResourceConstructor, opts?: PluginCacheResourceOptions): void;
319
+ };
320
+ shared: {
321
+ set<T, const Name extends string>(key: SharedKey<T, Name>, factory: (client: BaseClient & E) => T, opts?: PluginSharedOptions<T>): void;
322
+ set<const Name extends keyof RegisteredPluginShared & string>(name: Name, factory: (client: BaseClient & E) => RegisteredPluginShared[Name], opts?: PluginSharedOptions<RegisteredPluginShared[Name]>): void;
323
+ remove(...names: (string | SharedKey<unknown, string>)[]): void;
324
+ has<const Name extends string>(name: Name | SharedKey<unknown, Name>): boolean;
325
+ };
326
+ langs: {
327
+ contribute(locale: LocaleString | string, values: Record<string, unknown>, opts: PluginLangOptions): void;
328
+ };
329
+ reload(): Promise<void>;
330
+ diagnostics: {
331
+ warn(message: string, options?: {
332
+ code?: PluginDiagnosticCode;
333
+ phase?: PluginLifecyclePhase | string;
334
+ data?: Record<string, unknown>;
335
+ }): void;
336
+ };
337
+ options: {
338
+ set(fragment: SeyfertPluginOptions): void;
339
+ };
340
+ }
341
+ export type SeyfertPluginTeardownApi = Pick<SeyfertPluginApi, 'has' | 'diagnostics'> & {
342
+ shared: Pick<SeyfertPluginApi['shared'], 'has'>;
343
+ };
344
+ export type ResolvedPluginList = readonly AnySeyfertPlugin[] & {
345
+ readonly resolved: readonly AnySeyfertPlugin[];
346
+ readonly diagnostics: readonly PluginDiagnostics[];
347
+ };
348
+ export type SeyfertPluginClient = BaseClient & {
349
+ plugins: ResolvedPluginList;
350
+ };
351
+ export interface SeyfertPlugin<E extends object = {}, C extends object = {}, I extends readonly AnySeyfertPlugin[] = readonly [], M extends PluginMiddlewareMap = {}> {
352
+ name: string;
353
+ instanceId?: string;
354
+ version?: string;
355
+ imports?: I;
356
+ requires?: readonly PluginRequirementInput[];
357
+ meta?: unknown;
358
+ client?: PluginClientMap<E, I>;
359
+ ctx?: PluginContextMap<C, I, E>;
360
+ middlewares?: M;
361
+ globalMiddlewares?: readonly (keyof M & string)[];
362
+ options?(current: Readonly<BaseClientOptions>): SeyfertPluginOptions;
363
+ register?(api: SeyfertPluginApi<M, ExtendOf<I> & E>): void;
364
+ setup?(client: SeyfertPluginClient & ExtendOf<I> & E, api?: SeyfertPluginApi<M, ExtendOf<I> & E>): Awaitable<void>;
365
+ teardown?(client: SeyfertPluginClient & ExtendOf<I> & E, api?: SeyfertPluginTeardownApi): Awaitable<void>;
366
+ }
367
+ export interface PluginDiagnostics {
368
+ name: string;
369
+ instanceId?: string;
370
+ index: number;
371
+ status: PluginLifecycleStatus;
372
+ imports: readonly string[];
373
+ clientKeys: readonly string[];
374
+ ctxKeys: readonly string[];
375
+ commands: number;
376
+ components: number;
377
+ modals: number;
378
+ events: readonly string[];
379
+ anyEvents: number;
380
+ eventErrors: number;
381
+ middlewares: readonly string[];
382
+ requirements: readonly PluginRequirementDiagnostic[];
383
+ shared: readonly string[];
384
+ cacheResources: readonly string[];
385
+ langs: readonly string[];
386
+ hooks: readonly string[];
387
+ restObservers: number;
388
+ commandObservers: number;
389
+ autocompleteWrappers: number;
390
+ gatewayIntents: number;
391
+ gatewaySendPayloadWrappers: number;
392
+ gatewayDispatchInterceptors: number;
393
+ handlerCreators: number;
394
+ handlerTransformers: number;
395
+ messages: readonly PluginDiagnosticMessage[];
396
+ truncated?: Readonly<Record<string, number>>;
397
+ }
398
+ export {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginOrder = void 0;
4
+ var PluginOrder;
5
+ (function (PluginOrder) {
6
+ PluginOrder["Before"] = "before";
7
+ PluginOrder["After"] = "after";
8
+ })(PluginOrder || (exports.PluginOrder = PluginOrder = {}));