seyfert 1.1.1 → 1.2.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 (156) hide show
  1. package/lib/api/Routes/applications.d.ts +2 -2
  2. package/lib/api/Routes/channels.d.ts +2 -2
  3. package/lib/api/Routes/gateway.d.ts +2 -2
  4. package/lib/api/Routes/guilds.d.ts +2 -1
  5. package/lib/api/Routes/interactions.d.ts +2 -2
  6. package/lib/api/Routes/invites.d.ts +2 -2
  7. package/lib/api/Routes/stage-instances.d.ts +2 -2
  8. package/lib/api/Routes/stickers.d.ts +2 -2
  9. package/lib/api/Routes/users.d.ts +2 -2
  10. package/lib/api/Routes/voice.d.ts +2 -2
  11. package/lib/api/Routes/webhooks.d.ts +2 -2
  12. package/lib/builders/ActionRow.d.ts +2 -1
  13. package/lib/builders/ActionRow.js +3 -3
  14. package/lib/builders/Base.d.ts +1 -1
  15. package/lib/builders/Button.d.ts +2 -1
  16. package/lib/builders/Button.js +2 -2
  17. package/lib/builders/Embed.d.ts +2 -1
  18. package/lib/builders/Modal.d.ts +9 -2
  19. package/lib/builders/Modal.js +12 -3
  20. package/lib/builders/SelectMenu.d.ts +18 -1
  21. package/lib/builders/SelectMenu.js +36 -12
  22. package/lib/builders/index.d.ts +1 -1
  23. package/lib/builders/index.js +9 -9
  24. package/lib/builders/types.d.ts +1 -1
  25. package/lib/cache/index.d.ts +5 -5
  26. package/lib/cache/index.js +3 -3
  27. package/lib/cache/resources/default/base.d.ts +1 -1
  28. package/lib/cache/resources/default/guild-based.d.ts +1 -1
  29. package/lib/cache/resources/default/guild-related.d.ts +1 -1
  30. package/lib/cache/resources/presence.d.ts +1 -1
  31. package/lib/cache/resources/stage-instances.d.ts +1 -1
  32. package/lib/cache/resources/voice-states.d.ts +1 -1
  33. package/lib/client/base.d.ts +4 -3
  34. package/lib/client/client.d.ts +2 -1
  35. package/lib/client/client.js +2 -2
  36. package/lib/client/httpclient.d.ts +2 -1
  37. package/lib/client/httpclient.js +34 -32
  38. package/lib/client/oninteractioncreate.js +11 -12
  39. package/lib/client/onmessagecreate.js +2 -3
  40. package/lib/client/workerclient.d.ts +3 -2
  41. package/lib/client/workerclient.js +4 -3
  42. package/lib/commands/applications/chat.d.ts +3 -3
  43. package/lib/commands/applications/chat.js +4 -3
  44. package/lib/commands/applications/chatcontext.d.ts +6 -9
  45. package/lib/commands/applications/chatcontext.js +6 -17
  46. package/lib/commands/applications/menu.d.ts +2 -1
  47. package/lib/commands/applications/menucontext.d.ts +6 -10
  48. package/lib/commands/applications/menucontext.js +9 -22
  49. package/lib/commands/basecontex.d.ts +15 -0
  50. package/lib/commands/basecontex.js +34 -0
  51. package/lib/commands/decorators.d.ts +2 -1
  52. package/lib/commands/decorators.js +4 -4
  53. package/lib/commands/handler.js +4 -3
  54. package/lib/commands/optionresolver.d.ts +3 -3
  55. package/lib/commands/optionresolver.js +14 -14
  56. package/lib/common/index.d.ts +0 -1
  57. package/lib/common/index.js +0 -1
  58. package/lib/common/it/constants.d.ts +3 -1
  59. package/lib/common/it/constants.js +2 -0
  60. package/lib/common/shorters/channels.d.ts +1 -1
  61. package/lib/common/shorters/channels.js +4 -4
  62. package/lib/common/shorters/guilds.d.ts +1 -1
  63. package/lib/common/shorters/guilds.js +6 -1
  64. package/lib/common/shorters/members.d.ts +6 -1
  65. package/lib/common/shorters/members.js +25 -2
  66. package/lib/common/shorters/webhook.d.ts +2 -2
  67. package/lib/common/types/resolvables.d.ts +2 -1
  68. package/lib/common/types/util.d.ts +1 -1
  69. package/lib/common/types/write.d.ts +1 -1
  70. package/lib/components/ActionRow.d.ts +4 -3
  71. package/lib/components/ActionRow.js +6 -3
  72. package/lib/components/BaseComponent.d.ts +18 -0
  73. package/lib/components/BaseComponent.js +21 -0
  74. package/lib/components/BaseSelectMenuComponent.d.ts +10 -0
  75. package/lib/components/BaseSelectMenuComponent.js +22 -0
  76. package/lib/components/ButtonComponent.d.ts +14 -14
  77. package/lib/components/ButtonComponent.js +36 -25
  78. package/lib/components/ChannelSelectMenuComponent.d.ts +4 -4
  79. package/lib/components/ChannelSelectMenuComponent.js +6 -5
  80. package/lib/components/MentionableSelectMenuComponent.d.ts +3 -2
  81. package/lib/components/MentionableSelectMenuComponent.js +4 -1
  82. package/lib/components/RoleSelectMenuComponent.d.ts +3 -2
  83. package/lib/components/RoleSelectMenuComponent.js +4 -1
  84. package/lib/components/StringSelectMenuComponent.d.ts +3 -4
  85. package/lib/components/StringSelectMenuComponent.js +3 -5
  86. package/lib/components/TextInputComponent.d.ts +10 -5
  87. package/lib/components/TextInputComponent.js +24 -7
  88. package/lib/components/UserSelectMenuComponent.d.ts +3 -2
  89. package/lib/components/UserSelectMenuComponent.js +4 -1
  90. package/lib/components/command.d.ts +6 -5
  91. package/lib/components/command.js +4 -0
  92. package/lib/components/componentcontext.d.ts +113 -0
  93. package/lib/components/componentcontext.js +135 -0
  94. package/lib/components/handler.d.ts +3 -3
  95. package/lib/components/handler.js +9 -4
  96. package/lib/components/index.d.ts +3 -2
  97. package/lib/components/index.js +10 -9
  98. package/lib/events/handler.d.ts +2 -1
  99. package/lib/events/hooks/application_command.d.ts +2 -2
  100. package/lib/events/hooks/auto_moderation.d.ts +4 -4
  101. package/lib/events/hooks/channel.d.ts +1 -1
  102. package/lib/events/hooks/dispatch.d.ts +1 -1
  103. package/lib/events/hooks/entitlement.d.ts +4 -4
  104. package/lib/events/hooks/guild.d.ts +42 -42
  105. package/lib/events/hooks/integration.d.ts +19 -19
  106. package/lib/events/hooks/interactions.d.ts +2 -2
  107. package/lib/events/hooks/invite.d.ts +5 -5
  108. package/lib/events/hooks/message.d.ts +6 -5
  109. package/lib/events/hooks/presence.d.ts +7 -7
  110. package/lib/events/hooks/stage.d.ts +4 -4
  111. package/lib/events/hooks/thread.d.ts +49 -49
  112. package/lib/events/hooks/typing.d.ts +2 -2
  113. package/lib/events/hooks/user.d.ts +1 -1
  114. package/lib/events/hooks/voice.d.ts +2 -2
  115. package/lib/events/hooks/webhook.d.ts +1 -1
  116. package/lib/index.d.ts +3 -6
  117. package/lib/index.js +6 -7
  118. package/lib/langs/handler.d.ts +2 -1
  119. package/lib/structures/AutoModerationRule.d.ts +3 -2
  120. package/lib/structures/ClientUser.d.ts +1 -1
  121. package/lib/structures/Guild.d.ts +27 -27
  122. package/lib/structures/GuildEmoji.d.ts +2 -1
  123. package/lib/structures/GuildMember.d.ts +15 -6
  124. package/lib/structures/GuildMember.js +32 -6
  125. package/lib/structures/GuildPreview.d.ts +1 -1
  126. package/lib/structures/GuildRole.d.ts +2 -1
  127. package/lib/structures/GuildTemplate.d.ts +3 -2
  128. package/lib/structures/Interaction.d.ts +3 -3
  129. package/lib/structures/Interaction.js +33 -33
  130. package/lib/structures/Message.d.ts +5 -4
  131. package/lib/structures/Sticker.d.ts +2 -1
  132. package/lib/structures/User.d.ts +6 -3
  133. package/lib/structures/User.js +2 -1
  134. package/lib/structures/Webhook.d.ts +63 -4
  135. package/lib/structures/Webhook.js +53 -0
  136. package/lib/structures/channels.d.ts +2 -2
  137. package/lib/structures/extra/BaseGuild.d.ts +2 -1
  138. package/lib/structures/extra/BaseGuild.js +3 -3
  139. package/lib/structures/extra/BitField.d.ts +2 -2
  140. package/lib/structures/extra/BitField.js +2 -2
  141. package/lib/structures/extra/Permissions.d.ts +1 -1
  142. package/lib/structures/extra/functions.d.ts +2 -1
  143. package/lib/structures/extra/functions.js +2 -1
  144. package/lib/types/index.d.ts +1 -0
  145. package/lib/types/index.js +17 -0
  146. package/lib/websocket/SharedTypes.d.ts +2 -1
  147. package/lib/websocket/SharedTypes.js +1 -0
  148. package/lib/websocket/discord/shard.d.ts +2 -1
  149. package/lib/websocket/discord/shard.js +30 -41
  150. package/lib/websocket/discord/sharder.d.ts +3 -2
  151. package/lib/websocket/discord/sharder.js +7 -6
  152. package/lib/websocket/discord/shared.d.ts +2 -1
  153. package/lib/websocket/discord/worker.d.ts +1 -1
  154. package/lib/websocket/discord/workermanager.d.ts +3 -2
  155. package/lib/websocket/discord/workermanager.js +1 -1
  156. package/package.json +2 -2
@@ -4,12 +4,13 @@ import { Cache } from '../cache';
4
4
  import type { Command, ContextMenuCommand, RegisteredMiddlewares } from '../commands';
5
5
  import type { InferWithPrefix, MiddlewareContext } from '../commands/applications/shared';
6
6
  import { type CommandHandlerLike } from '../commands/handler';
7
- import { ChannelShorter, EmojiShorter, GuildShorter, Logger, MemberShorter, MessageShorter, ReactionShorter, RoleShorter, TemplateShorter, UsersShorter, WebhookShorter, type LocaleString, type MakeRequired } from '../common';
7
+ import { ChannelShorter, EmojiShorter, GuildShorter, Logger, MemberShorter, MessageShorter, ReactionShorter, RoleShorter, TemplateShorter, UsersShorter, WebhookShorter, type MakeRequired } from '../common';
8
+ import type { LocaleString } from 'discord-api-types/rest/v10';
8
9
  import type { DeepPartial, IntentStrings, OmitInsert, When } from '../common/types/util';
9
10
  import type { ComponentCommand, ModalCommand } from '../components';
10
11
  import { type ComponentHandlerLike } from '../components/handler';
11
12
  import { type LangsHandlerLike } from '../langs/handler';
12
- import type { ChatInputCommandInteraction, Message, MessageCommandInteraction, UserCommandInteraction } from '../structures';
13
+ import type { ChatInputCommandInteraction, ComponentInteraction, Message, MessageCommandInteraction, UserCommandInteraction } from '../structures';
13
14
  export declare class BaseClient {
14
15
  rest: ApiHandler;
15
16
  cache: Cache;
@@ -64,7 +65,7 @@ export declare class BaseClient {
64
65
  }>;
65
66
  }
66
67
  export interface BaseClientOptions {
67
- context?: (interaction: ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | When<InferWithPrefix, Message, never>) => {};
68
+ context?: (interaction: ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ComponentInteraction | When<InferWithPrefix, Message, never>) => {};
68
69
  globalMiddlewares?: readonly (keyof RegisteredMiddlewares)[];
69
70
  }
70
71
  export interface StartOptions {
@@ -1,5 +1,6 @@
1
+ import { type GatewayDispatchPayload, type GatewayPresenceUpdateData } from 'discord-api-types/v10';
1
2
  import type { ClientEvent, Command, CommandContext, EventHandlerLike, Message, SubCommand } from '..';
2
- import { type DeepPartial, type GatewayDispatchPayload, type GatewayPresenceUpdateData, type If } from '../common';
3
+ import type { DeepPartial, If } from '../common';
3
4
  import { ClientUser } from '../structures';
4
5
  import { ShardManager, type ShardManagerOptions } from '../websocket';
5
6
  import { MemberUpdateHandler } from '../websocket/discord/events/memberUpdate';
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Client = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
4
5
  const node_worker_threads_1 = require("node:worker_threads");
5
- const common_1 = require("../common");
6
6
  const events_1 = require("../events");
7
7
  const structures_1 = require("../structures");
8
8
  const websocket_1 = require("../websocket");
@@ -139,7 +139,7 @@ class Client extends base_1.BaseClient {
139
139
  this.applicationId = packet.d.application.id;
140
140
  this.me = new structures_1.ClientUser(this, packet.d.user, packet.d.application);
141
141
  if (!this.__handleGuilds?.size ||
142
- !((this.gateway.options.intents & common_1.GatewayIntentBits.Guilds) === common_1.GatewayIntentBits.Guilds)) {
142
+ !((this.gateway.options.intents & v10_1.GatewayIntentBits.Guilds) === v10_1.GatewayIntentBits.Guilds)) {
143
143
  if ([...this.gateway.values()].every(shard => shard.data.session_id)) {
144
144
  await this.events?.runEvent('BOT_READY', this, this.me, -1);
145
145
  }
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
+ import { type APIInteraction } from 'discord-api-types/v10';
2
3
  import type { HttpRequest, HttpResponse } from 'uWebSockets.js';
3
- import type { APIInteraction, DeepPartial } from '../common';
4
+ import type { DeepPartial } from '../common';
4
5
  import type { BaseClientOptions, StartOptions } from './base';
5
6
  import { BaseClient } from './base';
6
7
  export declare class HttpClient extends BaseClient {
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HttpClient = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
4
5
  const magic_bytes_js_1 = require("magic-bytes.js");
5
6
  const api_1 = require("../api");
6
7
  const utils_1 = require("../api/utils/utils");
7
- const common_1 = require("../common");
8
8
  const base_1 = require("./base");
9
9
  const oninteractioncreate_1 = require("./oninteractioncreate");
10
10
  let UWS;
@@ -104,49 +104,51 @@ class HttpClient extends base_1.BaseClient {
104
104
  }
105
105
  else {
106
106
  switch (rawBody.type) {
107
- case common_1.InteractionType.Ping:
107
+ case v10_1.InteractionType.Ping:
108
108
  this.debugger?.debug('Ping interaction received, responding.');
109
109
  res
110
110
  .writeHeader('Content-Type', 'application/json')
111
- .end(JSON.stringify({ type: common_1.InteractionResponseType.Pong }));
111
+ .end(JSON.stringify({ type: v10_1.InteractionResponseType.Pong }));
112
112
  break;
113
113
  default:
114
114
  await (0, oninteractioncreate_1.onInteractionCreate)(this, rawBody, -1, async ({ body, files }) => {
115
- let response;
116
- const headers = {};
117
- if (files) {
118
- response = new FormData();
119
- for (const [index, file] of files.entries()) {
120
- const fileKey = file.key ?? `files[${index}]`;
121
- if ((0, utils_1.isBufferLike)(file.data)) {
122
- let contentType = file.contentType;
123
- if (!contentType) {
124
- const [parsedType] = (0, magic_bytes_js_1.filetypeinfo)(file.data);
125
- if (parsedType) {
126
- contentType =
127
- api_1.OverwrittenMimeTypes[parsedType.mime] ??
128
- parsedType.mime ??
129
- 'application/octet-stream';
115
+ res.cork(() => {
116
+ let response;
117
+ const headers = {};
118
+ if (files) {
119
+ response = new FormData();
120
+ for (const [index, file] of files.entries()) {
121
+ const fileKey = file.key ?? `files[${index}]`;
122
+ if ((0, utils_1.isBufferLike)(file.data)) {
123
+ let contentType = file.contentType;
124
+ if (!contentType) {
125
+ const [parsedType] = (0, magic_bytes_js_1.filetypeinfo)(file.data);
126
+ if (parsedType) {
127
+ contentType =
128
+ api_1.OverwrittenMimeTypes[parsedType.mime] ??
129
+ parsedType.mime ??
130
+ 'application/octet-stream';
131
+ }
130
132
  }
133
+ response.append(fileKey, new Blob([file.data], { type: contentType }), file.name);
134
+ }
135
+ else {
136
+ response.append(fileKey, new Blob([`${file.data}`], { type: file.contentType }), file.name);
131
137
  }
132
- response.append(fileKey, new Blob([file.data], { type: contentType }), file.name);
133
138
  }
134
- else {
135
- response.append(fileKey, new Blob([`${file.data}`], { type: file.contentType }), file.name);
139
+ if (body) {
140
+ response.append('payload_json', JSON.stringify(body));
136
141
  }
137
142
  }
138
- if (body) {
139
- response.append('payload_json', JSON.stringify(body));
143
+ else {
144
+ response = body ?? {};
145
+ headers['Content-Type'] = 'application/json';
146
+ }
147
+ for (const i in headers) {
148
+ res.writeHeader(i, headers[i]);
140
149
  }
141
- }
142
- else {
143
- response = body ?? {};
144
- headers['Content-Type'] = 'application/json';
145
- }
146
- for (const i in headers) {
147
- res.writeHeader(i, headers[i]);
148
- }
149
- return res.end(JSON.stringify(response));
150
+ return res.end(JSON.stringify(response));
151
+ });
150
152
  });
151
153
  break;
152
154
  }
@@ -10,12 +10,12 @@ async function onInteractionCreate(self, body, shardId, __reply) {
10
10
  case v10_1.InteractionType.ApplicationCommandAutocomplete:
11
11
  {
12
12
  const parentCommand = self.commands?.values.find(x => {
13
- if (x.guild_id && !x.guild_id.includes(body.data.guild_id ?? '')) {
14
- return false;
13
+ if (body.data.guild_id) {
14
+ return x.guild_id?.includes(body.data.guild_id) && x.name === body.data.name;
15
15
  }
16
16
  return x.name === body.data.name;
17
17
  });
18
- const optionsResolver = new commands_1.OptionResolver(self, body.data.options ?? [], parentCommand, body.data.guild_id, body.data.resolved);
18
+ const optionsResolver = new commands_1.OptionResolver(self, body.data.options ?? [], parentCommand, body.guild_id, body.data.resolved);
19
19
  const interaction = new structures_1.AutocompleteInteraction(self, body, __reply);
20
20
  const command = optionsResolver.getAutocomplete();
21
21
  // idc, is a YOU problem
@@ -48,8 +48,8 @@ async function onInteractionCreate(self, body, shardId, __reply) {
48
48
  case v10_1.ApplicationCommandType.User:
49
49
  {
50
50
  const command = self.commands?.values.find(x => {
51
- if (x.guild_id && !x.guild_id.includes(body.data.guild_id ?? '')) {
52
- return false;
51
+ if (body.data.guild_id) {
52
+ return x.guild_id?.includes(body.data.guild_id) && x.name === body.data.name;
53
53
  }
54
54
  return x.name === body.data.name;
55
55
  });
@@ -62,7 +62,7 @@ async function onInteractionCreate(self, body, shardId, __reply) {
62
62
  Object.assign(context, extendContext);
63
63
  try {
64
64
  if (command.botPermissions && interaction.appPermissions) {
65
- const permissions = interaction.appPermissions.missings(...interaction.appPermissions.values(command.botPermissions));
65
+ const permissions = interaction.appPermissions.missings(...interaction.appPermissions.values([command.botPermissions]));
66
66
  if (permissions.length) {
67
67
  return command.onPermissionsFail?.(context, interaction.appPermissions.keys(permissions));
68
68
  }
@@ -102,14 +102,13 @@ async function onInteractionCreate(self, body, shardId, __reply) {
102
102
  break;
103
103
  case v10_1.ApplicationCommandType.ChatInput:
104
104
  {
105
- const packetData = body.data;
106
105
  const parentCommand = self.commands?.values.find(x => {
107
- if (x.guild_id && !x.guild_id.includes(packetData.guild_id ?? '')) {
108
- return false;
106
+ if (body.data.guild_id) {
107
+ return x.guild_id?.includes(body.data.guild_id) && x.name === body.data.name;
109
108
  }
110
- return x.name === packetData.name;
109
+ return x.name === body.data.name;
111
110
  });
112
- const optionsResolver = new commands_1.OptionResolver(self, packetData.options ?? [], parentCommand, packetData.guild_id, packetData.resolved);
111
+ const optionsResolver = new commands_1.OptionResolver(self, body.data.options ?? [], parentCommand, body.guild_id, body.data.resolved);
113
112
  const interaction = structures_1.BaseInteraction.from(self, body, __reply);
114
113
  const command = optionsResolver.getCommand();
115
114
  if (!command?.run)
@@ -119,7 +118,7 @@ async function onInteractionCreate(self, body, shardId, __reply) {
119
118
  Object.assign(context, extendContext);
120
119
  try {
121
120
  if (command.botPermissions && interaction.appPermissions) {
122
- const permissions = interaction.appPermissions.missings(...interaction.appPermissions.values(command.botPermissions));
121
+ const permissions = interaction.appPermissions.missings(...interaction.appPermissions.values([command.botPermissions]));
123
122
  if (permissions.length) {
124
123
  return command.onPermissionsFail?.(context, interaction.appPermissions.keys(permissions));
125
124
  }
@@ -53,8 +53,7 @@ async function onMessageCreate(self, rawMessage, shardId) {
53
53
  return;
54
54
  if (!command.run)
55
55
  return self.logger.warn(`${fullCommandName} command does not have 'run' callback`);
56
- if ([__1.InteractionContextTypes.BOT_DM, __1.InteractionContextTypes.PRIVATE_CHANNEL].some(i => command.contexts?.includes(i)) &&
57
- !message.guildId)
56
+ if (!command.contexts?.includes(__1.InteractionContextTypes.BOT_DM) && !message.guildId)
58
57
  return;
59
58
  if (command.guild_id && !command.guild_id?.includes(message.guildId))
60
59
  return;
@@ -78,7 +77,7 @@ async function onMessageCreate(self, rawMessage, shardId) {
78
77
  if (!meMember)
79
78
  return; //enable member cache and "Guilds" intent, lol
80
79
  const appPermissions = await meMember.fetchPermissions();
81
- const permissions = appPermissions.missings(...appPermissions.values(command.botPermissions));
80
+ const permissions = appPermissions.missings(...appPermissions.values([command.botPermissions]));
82
81
  if (permissions.length) {
83
82
  return command.onPermissionsFail?.(context, appPermissions.keys(permissions));
84
83
  }
@@ -3,9 +3,10 @@
3
3
  /// <reference types="node" />
4
4
  /// <reference types="node" />
5
5
  /// <reference types="node" />
6
+ import { type GatewayDispatchPayload } from 'discord-api-types/v10';
7
+ import { Logger } from '..';
6
8
  import type { Cache } from '../cache';
7
- import type { GatewayDispatchPayload, When } from '../common';
8
- import { Logger, type DeepPartial } from '../common';
9
+ import { type DeepPartial, type When } from '../common';
9
10
  import { type EventHandlerLike } from '../events';
10
11
  import { ClientUser } from '../structures';
11
12
  import { Shard, type ShardManagerOptions } from '../websocket';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateShardInfo = exports.WorkerClient = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
4
5
  const node_crypto_1 = require("node:crypto");
5
6
  const node_worker_threads_1 = require("node:worker_threads");
6
7
  const __1 = require("..");
@@ -27,7 +28,7 @@ try {
27
28
  catch { }
28
29
  class WorkerClient extends base_1.BaseClient {
29
30
  __handleGuilds = new Set();
30
- logger = new common_1.Logger({
31
+ logger = new __1.Logger({
31
32
  name: `[Worker #${workerData.workerId}]`,
32
33
  });
33
34
  events = new events_1.EventHandler(this.logger);
@@ -51,7 +52,7 @@ class WorkerClient extends base_1.BaseClient {
51
52
  },
52
53
  });
53
54
  if (workerData.debug) {
54
- this.debugger = new common_1.Logger({
55
+ this.debugger = new __1.Logger({
55
56
  name: `[Worker #${workerData.workerId}]`,
56
57
  logLevel: common_1.LogLevels.Debug,
57
58
  });
@@ -298,7 +299,7 @@ class WorkerClient extends base_1.BaseClient {
298
299
  this.applicationId = packet.d.application.id;
299
300
  this.me = new structures_1.ClientUser(this, packet.d.user, packet.d.application);
300
301
  if (!this.__handleGuilds?.size ||
301
- !((workerData.intents & common_1.GatewayIntentBits.Guilds) === common_1.GatewayIntentBits.Guilds)) {
302
+ !((workerData.intents & v10_1.GatewayIntentBits.Guilds) === v10_1.GatewayIntentBits.Guilds)) {
302
303
  if ([...this.shards.values()].every(shard => shard.data.session_id)) {
303
304
  this.postMessage({
304
305
  type: 'WORKER_READY',
@@ -1,7 +1,7 @@
1
- import type { SeyfertNumberOption, SeyfertStringOption } from '../..';
1
+ import { type APIApplicationCommandBasicOption, type APIApplicationCommandOption, ApplicationCommandOptionType, ApplicationCommandType, type LocaleString } from 'discord-api-types/v10';
2
+ import type { PermissionStrings, SeyfertNumberOption, SeyfertStringOption } from '../..';
2
3
  import type { Attachment } from '../../builders';
3
- import type { APIApplicationCommandBasicOption, APIApplicationCommandOption, FlatObjectKeys, LocaleString, PermissionStrings } from '../../common';
4
- import { ApplicationCommandOptionType, ApplicationCommandType } from '../../common';
4
+ import { type FlatObjectKeys } from '../../common';
5
5
  import type { AllChannels, AutocompleteInteraction, GuildRole, InteractionGuildMember, User } from '../../structures';
6
6
  import type { Groups, IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
7
7
  import type { CommandContext } from './chatcontext';
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SubCommand = exports.Command = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
4
5
  const common_1 = require("../../common");
5
6
  class BaseCommand {
6
7
  middlewares = [];
@@ -136,7 +137,7 @@ class BaseCommand {
136
137
  }
137
138
  }
138
139
  class Command extends BaseCommand {
139
- type = common_1.ApplicationCommandType.ChatInput;
140
+ type = v10_1.ApplicationCommandType.ChatInput;
140
141
  groups;
141
142
  toJSON() {
142
143
  const options = [];
@@ -148,7 +149,7 @@ class Command extends BaseCommand {
148
149
  if (i.group) {
149
150
  if (!options.find(x => x.name === i.group)) {
150
151
  options.push({
151
- type: common_1.ApplicationCommandOptionType.SubcommandGroup,
152
+ type: v10_1.ApplicationCommandOptionType.SubcommandGroup,
152
153
  name: i.group,
153
154
  description: this.groups[i.group].defaultDescription,
154
155
  description_localizations: Object.fromEntries(this.groups?.[i.group].description ?? []),
@@ -185,7 +186,7 @@ class Command extends BaseCommand {
185
186
  }
186
187
  exports.Command = Command;
187
188
  class SubCommand extends BaseCommand {
188
- type = common_1.ApplicationCommandOptionType.Subcommand;
189
+ type = v10_1.ApplicationCommandOptionType.Subcommand;
189
190
  group;
190
191
  toJSON() {
191
192
  return {
@@ -1,14 +1,15 @@
1
- import { MenuCommandContext, User, type AllChannels, type Guild, type InferWithPrefix, type MessageCommandInteraction, type ReturnCache, type UserCommandInteraction, type WebhookMessage } from '../..';
2
- import { type If, type UnionToTuple, type When } from '../../common';
1
+ import type { AllChannels, Guild, InferWithPrefix, ReturnCache, WebhookMessage } from '../..';
2
+ import type { If, UnionToTuple, When } from '../../common';
3
3
  import type { InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest } from '../../common/types/write';
4
4
  import { Message, type ChatInputCommandInteraction, type GuildMember, type InteractionGuildMember } from '../../structures';
5
+ import { BaseContext } from '../basecontex';
5
6
  import type { RegisteredMiddlewares } from '../decorators';
6
7
  import type { OptionResolver } from '../optionresolver';
7
8
  import type { Command, ContextOptions, OptionsRecord, SubCommand } from './chat';
8
9
  import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
9
- export interface CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> extends ExtendContext {
10
+ export interface CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext {
10
11
  }
11
- export declare class CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> {
12
+ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyof RegisteredMiddlewares = never> extends BaseContext {
12
13
  readonly client: UsingClient;
13
14
  readonly resolver: OptionResolver;
14
15
  readonly shardId: number;
@@ -39,10 +40,6 @@ export declare class CommandContext<T extends OptionsRecord = {}, M extends keyo
39
40
  guild(mode?: 'cache'): ReturnCache<Guild<'cached'> | undefined>;
40
41
  get guildId(): string | undefined;
41
42
  get channelId(): string;
42
- get author(): User;
43
+ get author(): import("../..").User;
43
44
  get member(): If<InferWithPrefix, GuildMember | InteractionGuildMember | undefined, InteractionGuildMember | undefined>;
44
- isChat(): this is CommandContext;
45
- isMenu(): this is MenuCommandContext<any>;
46
- isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
47
- isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
48
45
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommandContext = void 0;
4
- const __1 = require("../..");
5
- const common_1 = require("../../common");
4
+ const v10_1 = require("discord-api-types/v10");
6
5
  const structures_1 = require("../../structures");
7
- class CommandContext {
6
+ const basecontex_1 = require("../basecontex");
7
+ class CommandContext extends basecontex_1.BaseContext {
8
8
  client;
9
9
  resolver;
10
10
  shardId;
@@ -13,6 +13,7 @@ class CommandContext {
13
13
  interaction;
14
14
  messageResponse;
15
15
  constructor(client, data, resolver, shardId, command) {
16
+ super(client);
16
17
  this.client = client;
17
18
  this.resolver = resolver;
18
19
  this.shardId = shardId;
@@ -31,7 +32,7 @@ class CommandContext {
31
32
  return this.client.proxy;
32
33
  }
33
34
  get t() {
34
- return this.client.langs.get(this.interaction?.locale ?? this.client.langs.defaultLang ?? 'en-US');
35
+ return this.client.t(this.interaction?.locale ?? this.client.langs?.defaultLang ?? 'en-US');
35
36
  }
36
37
  get fullCommandName() {
37
38
  return this.resolver.fullCommandName;
@@ -44,7 +45,7 @@ class CommandContext {
44
45
  }
45
46
  async deferReply(ephemeral = false) {
46
47
  if (this.interaction)
47
- return this.interaction.deferReply(ephemeral ? common_1.MessageFlags.Ephemeral : undefined);
48
+ return this.interaction.deferReply(ephemeral ? v10_1.MessageFlags.Ephemeral : undefined);
48
49
  const options = this.client.options?.commands;
49
50
  return (this.messageResponse = await this.message[options?.reply?.(this) ? 'reply' : 'write'](options?.deferReplyResponse?.(this) ?? { content: 'Thinking...' }));
50
51
  }
@@ -121,17 +122,5 @@ class CommandContext {
121
122
  get member() {
122
123
  return this.interaction?.member || this.message?.member;
123
124
  }
124
- isChat() {
125
- return this instanceof CommandContext;
126
- }
127
- isMenu() {
128
- return this instanceof __1.MenuCommandContext;
129
- }
130
- isMenuUser() {
131
- return this instanceof __1.MenuCommandContext && this.target instanceof __1.User;
132
- }
133
- isMenuMessage() {
134
- return this instanceof __1.MenuCommandContext && this.target instanceof structures_1.Message;
135
- }
136
125
  }
137
126
  exports.CommandContext = CommandContext;
@@ -1,4 +1,5 @@
1
- import { type ApplicationCommandType, type LocaleString, type PermissionStrings } from '../../common';
1
+ import type { ApplicationCommandType, LocaleString } from 'discord-api-types/v10';
2
+ import { type PermissionStrings } from '../../common';
2
3
  import type { IntegrationTypes, InteractionContextTypes, RegisteredMiddlewares } from '../decorators';
3
4
  import type { MenuCommandContext } from './menucontext';
4
5
  import type { UsingClient } from './shared';
@@ -1,12 +1,13 @@
1
- import { CommandContext, type ContextMenuCommand, type ReturnCache, type WebhookMessage } from '../..';
2
- import { type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type UnionToTuple, type When } from '../../common';
1
+ import type { ContextMenuCommand, ReturnCache, WebhookMessage } from '../..';
2
+ import { type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type UnionToTuple, type When, type ModalCreateBodyRequest } from '../../common';
3
3
  import { Message, User, type AllChannels, type Guild, type GuildMember, type MessageCommandInteraction, type UserCommandInteraction } from '../../structures';
4
+ import { BaseContext } from '../basecontex';
4
5
  import type { RegisteredMiddlewares } from '../decorators';
5
6
  import type { CommandMetadata, ExtendContext, GlobalMetadata, UsingClient } from './shared';
6
7
  export type InteractionTarget<T> = T extends MessageCommandInteraction ? Message : User;
7
- export interface MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends ExtendContext {
8
+ export interface MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext, ExtendContext {
8
9
  }
9
- export declare class MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> {
10
+ export declare class MenuCommandContext<T extends MessageCommandInteraction | UserCommandInteraction, M extends keyof RegisteredMiddlewares = never> extends BaseContext {
10
11
  readonly client: UsingClient;
11
12
  readonly interaction: T;
12
13
  readonly shardId: number;
@@ -14,14 +15,13 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
14
15
  constructor(client: UsingClient, interaction: T, shardId: number, command: ContextMenuCommand);
15
16
  metadata: CommandMetadata<UnionToTuple<M>>;
16
17
  globalMetadata: GlobalMetadata;
17
- get proxy(): import("../..").APIRoutes;
18
18
  get target(): InteractionTarget<T>;
19
19
  get t(): import("../..").__InternalParseLocale<import("./shared").DefaultLocale> & {
20
20
  get(locale?: string | undefined): import("./shared").DefaultLocale;
21
21
  };
22
22
  get fullCommandName(): string;
23
23
  write<FR extends boolean = false>(body: InteractionCreateBodyRequest, fetchReply?: FR): Promise<When<FR, WebhookMessage, void | WebhookMessage>>;
24
- get modal(): ((body: import("../../common").ModalCreateBodyRequest) => Promise<void>) | ((body: import("../../common").ModalCreateBodyRequest) => Promise<void>);
24
+ modal(body: ModalCreateBodyRequest): Promise<void>;
25
25
  deferReply(ephemeral?: boolean): Promise<void>;
26
26
  editResponse(body: InteractionMessageUpdateBodyRequest): Promise<Message>;
27
27
  deleteResponse(): Promise<void | undefined>;
@@ -37,8 +37,4 @@ export declare class MenuCommandContext<T extends MessageCommandInteraction | Us
37
37
  get channelId(): string;
38
38
  get author(): User;
39
39
  get member(): import("../..").InteractionGuildMember | undefined;
40
- isChat(): this is CommandContext;
41
- isMenu(): this is MenuCommandContext<any>;
42
- isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
43
- isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
44
40
  }
@@ -1,15 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MenuCommandContext = void 0;
4
- const __1 = require("../..");
4
+ const v10_1 = require("discord-api-types/v10");
5
5
  const common_1 = require("../../common");
6
6
  const structures_1 = require("../../structures");
7
- class MenuCommandContext {
7
+ const basecontex_1 = require("../basecontex");
8
+ class MenuCommandContext extends basecontex_1.BaseContext {
8
9
  client;
9
10
  interaction;
10
11
  shardId;
11
12
  command;
12
13
  constructor(client, interaction, shardId, command) {
14
+ super(client);
13
15
  this.client = client;
14
16
  this.interaction = interaction;
15
17
  this.shardId = shardId;
@@ -17,17 +19,14 @@ class MenuCommandContext {
17
19
  }
18
20
  metadata = {};
19
21
  globalMetadata = {};
20
- get proxy() {
21
- return this.client.proxy;
22
- }
23
22
  // biome-ignore lint/suspicious/useGetterReturn: default don't exist.
24
23
  get target() {
25
24
  switch (this.interaction.data.type) {
26
- case common_1.ApplicationCommandType.Message: {
25
+ case v10_1.ApplicationCommandType.Message: {
27
26
  const data = this.interaction.data.resolved.messages[this.interaction.data.targetId];
28
27
  return new structures_1.Message(this.client, (0, common_1.toSnakeCase)(data));
29
28
  }
30
- case common_1.ApplicationCommandType.User: {
29
+ case v10_1.ApplicationCommandType.User: {
31
30
  const data = this.interaction.data.resolved.users[this.interaction.data.targetId];
32
31
  return new structures_1.User(this.client, (0, common_1.toSnakeCase)(data));
33
32
  }
@@ -42,11 +41,11 @@ class MenuCommandContext {
42
41
  write(body, fetchReply) {
43
42
  return this.interaction.write(body, fetchReply);
44
43
  }
45
- get modal() {
46
- return this.interaction.modal;
44
+ modal(body) {
45
+ return this.interaction.modal(body);
47
46
  }
48
47
  deferReply(ephemeral = false) {
49
- return this.interaction.deferReply(ephemeral ? common_1.MessageFlags.Ephemeral : undefined);
48
+ return this.interaction.deferReply(ephemeral ? v10_1.MessageFlags.Ephemeral : undefined);
50
49
  }
51
50
  editResponse(body) {
52
51
  return this.interaction.editResponse(body);
@@ -97,17 +96,5 @@ class MenuCommandContext {
97
96
  get member() {
98
97
  return this.interaction.member;
99
98
  }
100
- isChat() {
101
- return this instanceof __1.CommandContext;
102
- }
103
- isMenu() {
104
- return this instanceof MenuCommandContext;
105
- }
106
- isMenuUser() {
107
- return this instanceof MenuCommandContext && this.target instanceof structures_1.User;
108
- }
109
- isMenuMessage() {
110
- return this instanceof MenuCommandContext && this.target instanceof structures_1.Message;
111
- }
112
99
  }
113
100
  exports.MenuCommandContext = MenuCommandContext;
@@ -0,0 +1,15 @@
1
+ import type { ComponentCommandInteractionMap, ComponentContext } from '../components/componentcontext';
2
+ import { type MessageCommandInteraction, type UserCommandInteraction } from '../structures';
3
+ import type { CommandContext } from './applications/chatcontext';
4
+ import type { MenuCommandContext } from './applications/menucontext';
5
+ import type { UsingClient } from './applications/shared';
6
+ export declare class BaseContext {
7
+ readonly client: UsingClient;
8
+ constructor(client: UsingClient);
9
+ get proxy(): import("..").APIRoutes;
10
+ isChat(): this is CommandContext;
11
+ isMenu(): this is MenuCommandContext<UserCommandInteraction | MessageCommandInteraction>;
12
+ isMenuUser(): this is MenuCommandContext<UserCommandInteraction>;
13
+ isMenuMessage(): this is MenuCommandContext<MessageCommandInteraction>;
14
+ isComponent(): this is ComponentContext<keyof ComponentCommandInteractionMap>;
15
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseContext = void 0;
4
+ const v10_1 = require("discord-api-types/v10");
5
+ const structures_1 = require("../structures");
6
+ class BaseContext {
7
+ client;
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ get proxy() {
12
+ return this.client.proxy;
13
+ }
14
+ isChat() {
15
+ //@ts-expect-error
16
+ return this.message || this.interaction.type === v10_1.ApplicationCommandType.ChatInput;
17
+ }
18
+ isMenu() {
19
+ return this.isMenuUser() || this.isMenuMessage();
20
+ }
21
+ isMenuUser() {
22
+ //@ts-expect-error
23
+ return this.target instanceof structures_1.User;
24
+ }
25
+ isMenuMessage() {
26
+ //@ts-expect-error
27
+ return this.target instanceof structures_1.Message;
28
+ }
29
+ isComponent() {
30
+ //@ts-expect-error
31
+ return this.interaction.type === v10_1.InteractionType.MessageComponent;
32
+ }
33
+ }
34
+ exports.BaseContext = BaseContext;
@@ -1,4 +1,5 @@
1
- import { ApplicationCommandType, type FlatObjectKeys, type LocaleString, type PermissionStrings } from '../common';
1
+ import { ApplicationCommandType, type LocaleString } from 'discord-api-types/v10';
2
+ import type { FlatObjectKeys, PermissionStrings } from '../common';
2
3
  import type { CommandOption, OptionsRecord, SubCommand } from './applications/chat';
3
4
  import type { DefaultLocale, MiddlewareContext } from './applications/shared';
4
5
  export interface RegisteredMiddlewares {