seyfert 1.0.1 → 1.1.1

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 (113) hide show
  1. package/lib/api/CDN.d.ts +1 -1
  2. package/lib/api/CDN.js +0 -2
  3. package/lib/api/Router.js +2 -2
  4. package/lib/api/Routes/applications.d.ts +29 -33
  5. package/lib/api/Routes/channels.d.ts +11 -17
  6. package/lib/api/Routes/interactions.d.ts +3 -7
  7. package/lib/api/Routes/webhooks.d.ts +4 -6
  8. package/lib/builders/Attachment.d.ts +2 -3
  9. package/lib/cache/adapters/redis.js +6 -0
  10. package/lib/cache/adapters/types.d.ts +23 -23
  11. package/lib/cache/adapters/workeradapter.d.ts +4 -4
  12. package/lib/cache/adapters/workeradapter.js +10 -5
  13. package/lib/cache/index.d.ts +4 -5
  14. package/lib/cache/index.js +4 -3
  15. package/lib/cache/resources/default/base.d.ts +11 -10
  16. package/lib/cache/resources/default/guild-based.d.ts +8 -7
  17. package/lib/cache/resources/default/guild-based.js +8 -7
  18. package/lib/cache/resources/default/guild-related.d.ts +10 -9
  19. package/lib/cache/resources/default/guild-related.js +3 -2
  20. package/lib/cache/resources/guilds.js +2 -1
  21. package/lib/cache/resources/overwrites.d.ts +1 -1
  22. package/lib/cache/resources/overwrites.js +7 -1
  23. package/lib/client/base.d.ts +33 -179
  24. package/lib/client/base.js +56 -21
  25. package/lib/client/client.d.ts +10 -3
  26. package/lib/client/client.js +23 -8
  27. package/lib/client/oninteractioncreate.js +9 -9
  28. package/lib/client/onmessagecreate.js +192 -153
  29. package/lib/client/workerclient.d.ts +9 -3
  30. package/lib/client/workerclient.js +50 -23
  31. package/lib/collection.js +2 -2
  32. package/lib/commands/applications/chat.d.ts +16 -8
  33. package/lib/commands/applications/chat.js +20 -13
  34. package/lib/commands/applications/chatcontext.d.ts +6 -4
  35. package/lib/commands/applications/chatcontext.js +6 -1
  36. package/lib/commands/applications/menu.d.ts +5 -1
  37. package/lib/commands/applications/menu.js +11 -5
  38. package/lib/commands/applications/menucontext.d.ts +5 -3
  39. package/lib/commands/applications/menucontext.js +7 -2
  40. package/lib/commands/applications/options.d.ts +1 -2
  41. package/lib/commands/applications/shared.d.ts +5 -4
  42. package/lib/commands/decorators.d.ts +18 -6
  43. package/lib/commands/decorators.js +18 -8
  44. package/lib/commands/handler.d.ts +11 -5
  45. package/lib/commands/handler.js +46 -37
  46. package/lib/commands/optionresolver.d.ts +11 -4
  47. package/lib/commands/optionresolver.js +6 -4
  48. package/lib/common/index.d.ts +7 -0
  49. package/lib/common/index.js +7 -0
  50. package/lib/common/it/utils.d.ts +1 -0
  51. package/lib/common/it/utils.js +4 -1
  52. package/lib/common/shorters/channels.d.ts +67 -129
  53. package/lib/common/shorters/channels.js +119 -135
  54. package/lib/common/shorters/emojis.d.ts +47 -0
  55. package/lib/common/shorters/emojis.js +80 -0
  56. package/lib/common/shorters/guilds.d.ts +22 -249
  57. package/lib/common/shorters/guilds.js +51 -140
  58. package/lib/common/shorters/members.d.ts +82 -108
  59. package/lib/common/shorters/members.js +151 -166
  60. package/lib/common/shorters/messages.d.ts +11 -23
  61. package/lib/common/shorters/messages.js +58 -104
  62. package/lib/common/shorters/reactions.d.ts +10 -0
  63. package/lib/common/shorters/reactions.js +45 -0
  64. package/lib/common/shorters/roles.d.ts +39 -7
  65. package/lib/common/shorters/roles.js +74 -42
  66. package/lib/common/shorters/templates.d.ts +6 -8
  67. package/lib/common/shorters/templates.js +17 -21
  68. package/lib/common/shorters/users.d.ts +4 -6
  69. package/lib/common/shorters/users.js +29 -33
  70. package/lib/common/shorters/webhook.d.ts +62 -26
  71. package/lib/common/shorters/webhook.js +113 -58
  72. package/lib/common/types/options.d.ts +2 -2
  73. package/lib/common/types/util.d.ts +3 -0
  74. package/lib/components/handler.d.ts +28 -9
  75. package/lib/components/handler.js +28 -11
  76. package/lib/events/handler.d.ts +10 -2
  77. package/lib/events/handler.js +6 -8
  78. package/lib/index.d.ts +4 -2
  79. package/lib/index.js +1 -1
  80. package/lib/langs/handler.d.ts +8 -0
  81. package/lib/langs/handler.js +8 -2
  82. package/lib/structures/AutoModerationRule.d.ts +2 -2
  83. package/lib/structures/ClientUser.d.ts +2 -2
  84. package/lib/structures/Guild.d.ts +2 -2
  85. package/lib/structures/GuildEmoji.d.ts +4 -4
  86. package/lib/structures/GuildEmoji.js +7 -7
  87. package/lib/structures/GuildMember.d.ts +7 -6
  88. package/lib/structures/GuildMember.js +5 -2
  89. package/lib/structures/GuildPreview.d.ts +2 -2
  90. package/lib/structures/GuildRole.d.ts +2 -2
  91. package/lib/structures/GuildTemplate.d.ts +2 -2
  92. package/lib/structures/Interaction.d.ts +9 -10
  93. package/lib/structures/Interaction.js +2 -2
  94. package/lib/structures/Message.d.ts +8 -7
  95. package/lib/structures/Message.js +7 -4
  96. package/lib/structures/Sticker.d.ts +2 -2
  97. package/lib/structures/User.d.ts +1 -0
  98. package/lib/structures/User.js +5 -0
  99. package/lib/structures/Webhook.d.ts +2 -2
  100. package/lib/structures/Webhook.js +3 -3
  101. package/lib/structures/channels.d.ts +21 -22
  102. package/lib/structures/channels.js +13 -25
  103. package/lib/structures/extra/Base.d.ts +1 -2
  104. package/lib/structures/extra/DiscordBase.d.ts +2 -2
  105. package/lib/websocket/constants/index.js +1 -0
  106. package/lib/websocket/discord/shard.js +4 -2
  107. package/lib/websocket/discord/sharder.d.ts +3 -0
  108. package/lib/websocket/discord/sharder.js +12 -5
  109. package/lib/websocket/discord/shared.d.ts +1 -0
  110. package/lib/websocket/discord/worker.d.ts +2 -1
  111. package/lib/websocket/discord/workermanager.d.ts +8 -3
  112. package/lib/websocket/discord/workermanager.js +78 -30
  113. package/package.json +8 -6
@@ -9,11 +9,11 @@ function getCommandFromContent(commandRaw, self) {
9
9
  const groupName = commandRaw.length === 3 ? commandRaw[1] : undefined;
10
10
  const subcommandName = groupName ? commandRaw[2] : commandRaw[1];
11
11
  const parent = self.commands.values.find(x => x.name === parentName);
12
- const fullCommandName = `${parentName}${groupName ? ` ${groupName} ${subcommandName}` : ` ${subcommandName ?? ''}`}`;
12
+ const fullCommandName = `${parentName}${groupName ? ` ${groupName} ${subcommandName}` : `${subcommandName ? ` ${subcommandName}` : ''}`}`;
13
13
  if (!(parent instanceof __1.Command))
14
14
  return { fullCommandName };
15
15
  if (groupName && !parent.groups?.[groupName])
16
- return getCommandFromContent([parentName, subcommandName], self);
16
+ return getCommandFromContent([parentName, groupName], self);
17
17
  if (subcommandName && !parent.options?.some(x => x instanceof __1.SubCommand && x.name === subcommandName))
18
18
  return getCommandFromContent([parentName], self);
19
19
  const command = groupName || subcommandName
@@ -45,12 +45,16 @@ async function onMessageCreate(self, rawMessage, shardId) {
45
45
  if (!prefix || !message.content.startsWith(prefix))
46
46
  return;
47
47
  const content = message.content.slice(prefix.length).trimStart();
48
- const { fullCommandName, command, parent } = getCommandFromContent(content.split(' ').filter(x => x), self);
48
+ const { fullCommandName, command, parent } = getCommandFromContent(content
49
+ .split(' ')
50
+ .filter(x => x)
51
+ .slice(0, 3), self);
49
52
  if (!command)
50
53
  return;
51
54
  if (!command.run)
52
55
  return self.logger.warn(`${fullCommandName} command does not have 'run' callback`);
53
- if (command.dm && !message.guildId)
56
+ if ([__1.InteractionContextTypes.BOT_DM, __1.InteractionContextTypes.PRIVATE_CHANNEL].some(i => command.contexts?.includes(i)) &&
57
+ !message.guildId)
54
58
  return;
55
59
  if (command.guild_id && !command.guild_id?.includes(message.guildId))
56
60
  return;
@@ -64,7 +68,10 @@ async function onMessageCreate(self, rawMessage, shardId) {
64
68
  const args = (self.options?.commands?.argsParser ?? defaultArgsParser)(content, command);
65
69
  const { options, errors } = await parseOptions(self, command, rawMessage, args, resolved);
66
70
  const optionsResolver = new __1.OptionResolver(self, options, parent, message.guildId, resolved);
67
- const context = new __1.CommandContext(self, message, optionsResolver, shardId);
71
+ const context = new __1.CommandContext(self, message, optionsResolver, shardId, command);
72
+ //@ts-expect-error
73
+ const extendContext = self.options?.context?.(message) ?? {};
74
+ Object.assign(context, extendContext);
68
75
  try {
69
76
  if (command.botPermissions && message.guildId) {
70
77
  const meMember = await self.cache.members?.get(self.botId, message.guildId);
@@ -128,119 +135,192 @@ async function parseOptions(self, command, message, args, resolved) {
128
135
  const options = [];
129
136
  const errors = [];
130
137
  for (const i of (command.options ?? [])) {
131
- let value;
132
- let indexAttachment = -1;
133
- switch (i.type) {
134
- case v10_1.ApplicationCommandOptionType.Attachment:
135
- if (message.attachments[++indexAttachment]) {
136
- value = message.attachments[indexAttachment].id;
137
- resolved.attachments[value] = message.attachments[indexAttachment];
138
- }
139
- break;
140
- case v10_1.ApplicationCommandOptionType.Boolean:
141
- if (args[i.name]) {
142
- value = ['yes', 'y', 'true', 'treu'].includes(args[i.name].toLowerCase());
143
- }
144
- break;
145
- case v10_1.ApplicationCommandOptionType.Channel:
146
- {
147
- const rawId = message.content.match(/(?<=<#)[0-9]{17,19}(?=>)/g)?.find(x => args[i.name]?.includes(x));
148
- if (rawId) {
149
- const channel = i.required ? await self.channels.fetch(rawId) : await self.cache.channels?.get(rawId);
150
- if (channel) {
151
- if ('channel_types' in i) {
152
- if (!i.channel_types.includes(channel.type)) {
153
- errors.push({
154
- name: i.name,
155
- error: `The entered channel type is not one of ${i
156
- .channel_types.map(t => v10_1.ChannelType[t])
157
- .join(', ')}`,
158
- });
159
- break;
138
+ try {
139
+ let value;
140
+ let indexAttachment = -1;
141
+ switch (i.type) {
142
+ case v10_1.ApplicationCommandOptionType.Attachment:
143
+ if (message.attachments[++indexAttachment]) {
144
+ value = message.attachments[indexAttachment].id;
145
+ resolved.attachments[value] = message.attachments[indexAttachment];
146
+ }
147
+ break;
148
+ case v10_1.ApplicationCommandOptionType.Boolean:
149
+ if (args[i.name]) {
150
+ value = ['yes', 'y', 'true', 'treu'].includes(args[i.name].toLowerCase());
151
+ }
152
+ break;
153
+ case v10_1.ApplicationCommandOptionType.Channel:
154
+ {
155
+ const rawId = message.content.match(/(?<=<#)[0-9]{17,19}(?=>)/g)?.find(x => args[i.name]?.includes(x)) ||
156
+ args[i.name]?.match(/[0-9]{17,19}/g)?.[0];
157
+ if (rawId) {
158
+ const channel = (await self.cache.channels?.get(rawId)) ?? (i.required ? await self.channels.fetch(rawId) : undefined);
159
+ if (channel) {
160
+ if ('channel_types' in i) {
161
+ if (!i.channel_types.includes(channel.type)) {
162
+ errors.push({
163
+ name: i.name,
164
+ error: `The entered channel type is not one of ${i
165
+ .channel_types.map(t => v10_1.ChannelType[t])
166
+ .join(', ')}`,
167
+ });
168
+ break;
169
+ }
160
170
  }
171
+ value = rawId;
172
+ resolved.channels[rawId] = channel;
161
173
  }
162
- value = rawId;
163
- //@ts-expect-error
164
- resolved.channels[rawId] = channel;
165
174
  }
166
175
  }
167
- }
168
- break;
169
- case v10_1.ApplicationCommandOptionType.Mentionable:
170
- {
171
- const matches = message.content.match(/<@[0-9]{17,19}(?=>)|<@&[0-9]{17,19}(?=>)/g) ?? [];
172
- for (const match of matches) {
173
- if (match.includes('&')) {
174
- const rawId = match.slice(3);
175
- if (rawId) {
176
- const role = i.required
177
- ? (await self.roles.list(message.guild_id)).find(x => x.id === rawId)
178
- : await self.cache.roles?.get(rawId);
179
- if (role) {
180
- value = rawId;
181
- //@ts-expect-error
182
- resolved.roles[rawId] = role;
176
+ break;
177
+ case v10_1.ApplicationCommandOptionType.Mentionable:
178
+ {
179
+ const matches = message.content.match(/<@[0-9]{17,19}(?=>)|<@&[0-9]{17,19}(?=>)/g) ?? [];
180
+ for (const match of matches) {
181
+ if (match.includes('&')) {
182
+ const rawId = match.slice(3);
183
+ if (rawId) {
184
+ const role = (await self.cache.roles?.get(rawId)) ??
185
+ (i.required ? (await self.roles.list(message.guild_id)).find(x => x.id === rawId) : undefined);
186
+ if (role) {
187
+ value = rawId;
188
+ resolved.roles[rawId] = role;
189
+ break;
190
+ }
191
+ }
192
+ }
193
+ else {
194
+ const rawId = match.slice(2);
195
+ const raw = message.mentions.find(x => rawId === x.id);
196
+ if (raw) {
197
+ const { member, ...user } = raw;
198
+ value = raw.id;
199
+ resolved.users[raw.id] = user;
200
+ if (member)
201
+ resolved.members[raw.id] = member;
183
202
  break;
184
203
  }
185
204
  }
186
205
  }
187
- else {
188
- const rawId = match.slice(2);
189
- const raw = message.mentions.find(x => rawId === x.id);
206
+ }
207
+ break;
208
+ case v10_1.ApplicationCommandOptionType.Role:
209
+ {
210
+ const rawId = message.mention_roles.find(x => args[i.name]?.includes(x)) || args[i.name]?.match(/[0-9]{17,19}/g)?.[0];
211
+ if (rawId) {
212
+ const role = (await self.cache.roles?.get(rawId)) ??
213
+ (i.required ? (await self.roles.list(message.guild_id)).find(x => x.id === rawId) : undefined);
214
+ if (role) {
215
+ value = rawId;
216
+ resolved.roles[rawId] = role;
217
+ }
218
+ }
219
+ }
220
+ break;
221
+ case v10_1.ApplicationCommandOptionType.User:
222
+ {
223
+ const rawId = message.mentions.find(x => args[i.name]?.includes(x.id))?.id || args[i.name]?.match(/[0-9]{17,19}/g)?.[0];
224
+ if (rawId) {
225
+ const raw = message.mentions.find(x => args[i.name]?.includes(x.id)) ??
226
+ (await self.cache.users?.get(rawId)) ??
227
+ (i.required ? await self.users.fetch(rawId) : undefined);
190
228
  if (raw) {
191
229
  value = raw.id;
192
- resolved.users[raw.id] = raw;
193
- break;
230
+ if (raw instanceof __1.User) {
231
+ resolved.users[raw.id] = raw;
232
+ if (message.guild_id) {
233
+ const member = message.mentions.find(x => args[i.name]?.includes(x.id))?.member ??
234
+ (await self.cache.members?.get(rawId, message.guild_id)) ??
235
+ (i.required ? await self.members.fetch(rawId, message.guild_id) : undefined);
236
+ if (member)
237
+ resolved.members[raw.id] = member;
238
+ }
239
+ }
240
+ else {
241
+ const { member, ...user } = raw;
242
+ resolved.users[user.id] = user;
243
+ if (member)
244
+ resolved.members[user.id] = member;
245
+ }
194
246
  }
195
247
  }
196
248
  }
197
- }
198
- break;
199
- case v10_1.ApplicationCommandOptionType.Role:
200
- {
201
- const rawId = message.mention_roles.find(x => args[i.name]?.includes(x));
202
- if (rawId) {
203
- const role = i.required
204
- ? (await self.roles.list(message.guild_id)).find(x => x.id === rawId) //why, discord, why
205
- : await self.cache.roles?.get(rawId);
206
- if (role) {
207
- value = rawId;
208
- //@ts-expect-error
209
- resolved.roles[rawId] = role;
249
+ break;
250
+ case v10_1.ApplicationCommandOptionType.String:
251
+ {
252
+ value = args[i.name];
253
+ const option = i;
254
+ if (value) {
255
+ if (option.min_length) {
256
+ if (value.length < option.min_length) {
257
+ value = undefined;
258
+ errors.push({
259
+ name: i.name,
260
+ error: `The entered string has less than ${option.min_length} characters. The minimum required is ${option.min_length} characters.`,
261
+ });
262
+ break;
263
+ }
264
+ }
265
+ if (option.max_length) {
266
+ if (value.length > option.max_length) {
267
+ value = undefined;
268
+ errors.push({
269
+ name: i.name,
270
+ error: `The entered string has more than ${option.max_length} characters. The maximum required is ${option.max_length} characters.`,
271
+ });
272
+ break;
273
+ }
274
+ }
275
+ if (option.choices?.length) {
276
+ if (!option.choices.some(x => x.name === value)) {
277
+ value = undefined;
278
+ errors.push({
279
+ name: i.name,
280
+ error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
281
+ .map(x => x.name)
282
+ .join(', ')}.`,
283
+ });
284
+ break;
285
+ }
286
+ value = option.choices.find(x => x.name === value).value;
287
+ }
210
288
  }
211
289
  }
212
- }
213
- break;
214
- case v10_1.ApplicationCommandOptionType.User:
215
- {
216
- const raw = message.mentions.find(x => args[i.name]?.includes(x.id));
217
- if (raw) {
218
- value = raw.id;
219
- resolved.users[raw.id] = raw;
220
- }
221
- }
222
- break;
223
- case v10_1.ApplicationCommandOptionType.String:
224
- {
225
- value = args[i.name];
226
- const option = i;
227
- if (value) {
228
- if (option.min_length) {
229
- if (value.length < option.min_length) {
290
+ break;
291
+ case v10_1.ApplicationCommandOptionType.Number:
292
+ case v10_1.ApplicationCommandOptionType.Integer:
293
+ {
294
+ value = Number(args[i.name]);
295
+ if (args[i.name] === undefined) {
296
+ value = undefined;
297
+ break;
298
+ }
299
+ if (Number.isNaN(value)) {
300
+ value = undefined;
301
+ errors.push({
302
+ name: i.name,
303
+ error: 'The entered choice is an invalid number.',
304
+ });
305
+ break;
306
+ }
307
+ const option = i;
308
+ if (option.min_value) {
309
+ if (value < option.min_value) {
230
310
  value = undefined;
231
311
  errors.push({
232
312
  name: i.name,
233
- error: `The entered string has less than ${option.min_length} characters. The minimum required is ${option.min_length} characters.`,
313
+ error: `The entered number is less than ${option.min_value}. The minimum allowed is ${option.min_value}`,
234
314
  });
235
315
  break;
236
316
  }
237
317
  }
238
- if (option.max_length) {
239
- if (value.length > option.max_length) {
318
+ if (option.max_value) {
319
+ if (value > option.max_value) {
240
320
  value = undefined;
241
321
  errors.push({
242
322
  name: i.name,
243
- error: `The entered string has more than ${option.max_length} characters. The maximum required is ${option.max_length} characters.`,
323
+ error: `The entered number is greater than ${option.max_value}. The maximum allowed is ${option.max_value}`,
244
324
  });
245
325
  break;
246
326
  }
@@ -259,68 +339,27 @@ async function parseOptions(self, command, message, args, resolved) {
259
339
  value = option.choices.find(x => x.name === value).value;
260
340
  }
261
341
  }
262
- }
263
- break;
264
- case v10_1.ApplicationCommandOptionType.Number:
265
- case v10_1.ApplicationCommandOptionType.Integer:
266
- {
267
- value = Number(args[i.name]);
268
- if (args[i.name] === undefined) {
269
- value = undefined;
270
- break;
271
- }
272
- if (Number.isNaN(value)) {
273
- value = undefined;
274
- errors.push({
275
- name: i.name,
276
- error: 'The entered choice is an invalid number.',
277
- });
278
- break;
279
- }
280
- const option = i;
281
- if (option.min_value) {
282
- if (value < option.min_value) {
283
- value = undefined;
284
- errors.push({
285
- name: i.name,
286
- error: `The entered number is less than ${option.min_value}. The minimum allowed is ${option.min_value}`,
287
- });
288
- break;
289
- }
290
- }
291
- if (option.max_value) {
292
- if (value > option.max_value) {
293
- value = undefined;
294
- errors.push({
295
- name: i.name,
296
- error: `The entered number is greater than ${option.max_value}. The maximum allowed is ${option.max_value}`,
297
- });
298
- break;
299
- }
300
- }
301
- if (option.choices?.length) {
302
- if (!option.choices.some(x => x.name === value)) {
303
- value = undefined;
304
- errors.push({
305
- name: i.name,
306
- error: `The entered choice is invalid. Please choose one of the following options: ${option.choices
307
- .map(x => x.name)
308
- .join(', ')}.`,
309
- });
310
- break;
311
- }
312
- value = option.choices.find(x => x.name === value).value;
313
- }
314
- }
315
- break;
316
- default:
317
- break;
342
+ break;
343
+ default:
344
+ break;
345
+ }
346
+ if (value !== undefined) {
347
+ options.push({
348
+ name: i.name,
349
+ type: i.type,
350
+ value,
351
+ });
352
+ }
353
+ else if (i.required)
354
+ errors.push({
355
+ error: 'Option is required but returned undefined',
356
+ name: i.name,
357
+ });
318
358
  }
319
- if (value !== undefined) {
320
- options.push({
359
+ catch (e) {
360
+ errors.push({
361
+ error: e && typeof e === 'object' && 'message' in e ? e.message : `${e}`,
321
362
  name: i.name,
322
- type: i.type,
323
- value,
324
363
  });
325
364
  }
326
365
  }
@@ -6,18 +6,18 @@
6
6
  import type { Cache } from '../cache';
7
7
  import type { GatewayDispatchPayload, When } from '../common';
8
8
  import { Logger, type DeepPartial } from '../common';
9
- import { EventHandler } from '../events';
9
+ import { type EventHandlerLike } from '../events';
10
10
  import { ClientUser } from '../structures';
11
11
  import { Shard, type ShardManagerOptions } from '../websocket';
12
12
  import type { WorkerShardInfo } from '../websocket/discord/worker';
13
13
  import type { ManagerMessages } from '../websocket/discord/workermanager';
14
- import type { BaseClientOptions, StartOptions } from './base';
14
+ import type { BaseClientOptions, ServicesOptions, StartOptions } from './base';
15
15
  import { BaseClient } from './base';
16
16
  import type { Client } from './client';
17
17
  export declare class WorkerClient<Ready extends boolean = boolean> extends BaseClient {
18
18
  private __handleGuilds?;
19
19
  logger: Logger;
20
- events: EventHandler;
20
+ events?: EventHandlerLike;
21
21
  me: When<Ready, ClientUser>;
22
22
  promises: Map<string, {
23
23
  resolve: (value: any) => void;
@@ -28,8 +28,14 @@ export declare class WorkerClient<Ready extends boolean = boolean> extends BaseC
28
28
  constructor(options?: WorkerClientOptions);
29
29
  get workerId(): number;
30
30
  get latency(): number;
31
+ setServices({ ...rest }: ServicesOptions & {
32
+ handlers?: ServicesOptions['handlers'] & {
33
+ events?: EventHandlerLike;
34
+ };
35
+ }): void;
31
36
  start(options?: Omit<DeepPartial<StartOptions>, 'httpConnection' | 'token' | 'connection'>): Promise<void>;
32
37
  loadEvents(dir?: string): Promise<void>;
38
+ postMessage(body: any): boolean | void;
33
39
  protected handleManagerMessages(data: ManagerMessages): Promise<any>;
34
40
  private generateNonce;
35
41
  private generateSendPromise;