seyfert 2.0.0 → 2.1.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 (81) hide show
  1. package/lib/api/Routes/interactions.d.ts +8 -2
  2. package/lib/api/Routes/skus.d.ts +11 -0
  3. package/lib/api/Routes/skus.js +2 -0
  4. package/lib/api/api.d.ts +1 -1
  5. package/lib/api/api.js +14 -12
  6. package/lib/api/shared.d.ts +1 -1
  7. package/lib/api/utils/constants.d.ts +1 -1
  8. package/lib/api/utils/constants.js +1 -1
  9. package/lib/builders/Attachment.d.ts +1 -1
  10. package/lib/builders/Attachment.js +12 -12
  11. package/lib/cache/index.d.ts +4 -1
  12. package/lib/cache/index.js +11 -3
  13. package/lib/client/base.d.ts +3 -3
  14. package/lib/client/base.js +8 -3
  15. package/lib/client/client.d.ts +4 -0
  16. package/lib/client/client.js +30 -14
  17. package/lib/client/httpclient.js +2 -2
  18. package/lib/client/workerclient.d.ts +3 -2
  19. package/lib/client/workerclient.js +23 -11
  20. package/lib/commands/applications/entryPoint.d.ts +46 -0
  21. package/lib/commands/applications/entryPoint.js +56 -0
  22. package/lib/commands/applications/entrycontext.d.ts +40 -0
  23. package/lib/commands/applications/entrycontext.js +85 -0
  24. package/lib/commands/applications/options.d.ts +3 -2
  25. package/lib/commands/decorators.d.ts +11 -17
  26. package/lib/commands/decorators.js +3 -0
  27. package/lib/commands/handle.d.ts +6 -5
  28. package/lib/commands/handle.js +42 -0
  29. package/lib/commands/handler.d.ts +6 -4
  30. package/lib/commands/handler.js +6 -1
  31. package/lib/commands/index.d.ts +2 -0
  32. package/lib/commands/index.js +2 -0
  33. package/lib/commands/optionresolver.js +1 -1
  34. package/lib/common/bot/watcher.d.ts +1 -1
  35. package/lib/common/it/utils.d.ts +10 -3
  36. package/lib/common/it/utils.js +10 -0
  37. package/lib/common/shorters/interaction.d.ts +1 -1
  38. package/lib/common/types/util.d.ts +1 -1
  39. package/lib/common/types/write.d.ts +2 -2
  40. package/lib/deps/mixer.js +6 -1
  41. package/lib/events/handler.js +3 -3
  42. package/lib/events/hooks/custom.d.ts +1 -0
  43. package/lib/events/hooks/custom.js +5 -1
  44. package/lib/events/hooks/subscriptions.d.ts +35 -0
  45. package/lib/events/hooks/subscriptions.js +16 -0
  46. package/lib/structures/Interaction.d.ts +24 -4
  47. package/lib/structures/Interaction.js +54 -5
  48. package/lib/structures/Message.d.ts +0 -3
  49. package/lib/structures/Message.js +0 -3
  50. package/lib/structures/channels.js +2 -2
  51. package/lib/structures/extra/BaseGuild.d.ts +11 -1
  52. package/lib/structures/extra/BaseGuild.js +27 -0
  53. package/lib/types/gateway.d.ts +19 -2
  54. package/lib/types/payloads/_interactions/_applicationCommands/chatInput.d.ts +6 -1
  55. package/lib/types/payloads/_interactions/applicationCommands.d.ts +41 -6
  56. package/lib/types/payloads/_interactions/applicationCommands.js +28 -1
  57. package/lib/types/payloads/_interactions/responses.d.ts +74 -2
  58. package/lib/types/payloads/_interactions/responses.js +4 -0
  59. package/lib/types/payloads/channel.d.ts +44 -4
  60. package/lib/types/payloads/channel.js +5 -1
  61. package/lib/types/payloads/monetization.d.ts +29 -1
  62. package/lib/types/payloads/monetization.js +10 -1
  63. package/lib/types/rest/channel.d.ts +4 -17
  64. package/lib/types/rest/interactions.d.ts +30 -8
  65. package/lib/types/rest/monetization.d.ts +22 -1
  66. package/lib/types/rest/webhook.d.ts +2 -2
  67. package/lib/types/utils/index.d.ts +16 -5
  68. package/lib/types/utils/index.js +15 -4
  69. package/lib/websocket/SharedTypes.d.ts +9 -3
  70. package/lib/websocket/constants/index.d.ts +3 -2
  71. package/lib/websocket/constants/index.js +11 -1
  72. package/lib/websocket/discord/shard.d.ts +3 -2
  73. package/lib/websocket/discord/shard.js +25 -11
  74. package/lib/websocket/discord/sharder.js +59 -1
  75. package/lib/websocket/discord/shared.d.ts +21 -1
  76. package/lib/websocket/discord/socket/custom.d.ts +1 -1
  77. package/lib/websocket/discord/socket/custom.js +51 -34
  78. package/lib/websocket/discord/worker.d.ts +2 -1
  79. package/lib/websocket/discord/workermanager.d.ts +2 -1
  80. package/lib/websocket/discord/workermanager.js +30 -13
  81. package/package.json +8 -3
@@ -0,0 +1,35 @@
1
+ import type { UsingClient } from '../../commands';
2
+ import type { APISubscription } from '../../types';
3
+ export declare const SUBSCRIPTION_CREATE: (_: UsingClient, data: APISubscription) => {
4
+ id: string;
5
+ userId: string;
6
+ skuIds: string[];
7
+ entitlementsIds: string[];
8
+ currentPeriodStart: string;
9
+ currentPeriodEnd: string;
10
+ status: import("../../types").SubscriptionStatus;
11
+ canceledAt: string | null;
12
+ country?: string | undefined;
13
+ };
14
+ export declare const SUBSCRIPTION_UPDATE: (_: UsingClient, data: APISubscription) => {
15
+ id: string;
16
+ userId: string;
17
+ skuIds: string[];
18
+ entitlementsIds: string[];
19
+ currentPeriodStart: string;
20
+ currentPeriodEnd: string;
21
+ status: import("../../types").SubscriptionStatus;
22
+ canceledAt: string | null;
23
+ country?: string | undefined;
24
+ };
25
+ export declare const SUBSCRIPTION_DELETE: (_: UsingClient, data: APISubscription) => {
26
+ id: string;
27
+ userId: string;
28
+ skuIds: string[];
29
+ entitlementsIds: string[];
30
+ currentPeriodStart: string;
31
+ currentPeriodEnd: string;
32
+ status: import("../../types").SubscriptionStatus;
33
+ canceledAt: string | null;
34
+ country?: string | undefined;
35
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUBSCRIPTION_DELETE = exports.SUBSCRIPTION_UPDATE = exports.SUBSCRIPTION_CREATE = void 0;
4
+ const common_1 = require("../../common");
5
+ const SUBSCRIPTION_CREATE = (_, data) => {
6
+ return (0, common_1.toCamelCase)(data);
7
+ };
8
+ exports.SUBSCRIPTION_CREATE = SUBSCRIPTION_CREATE;
9
+ const SUBSCRIPTION_UPDATE = (_, data) => {
10
+ return (0, common_1.toCamelCase)(data);
11
+ };
12
+ exports.SUBSCRIPTION_UPDATE = SUBSCRIPTION_UPDATE;
13
+ const SUBSCRIPTION_DELETE = (_, data) => {
14
+ return (0, common_1.toCamelCase)(data);
15
+ };
16
+ exports.SUBSCRIPTION_DELETE = SUBSCRIPTION_DELETE;
@@ -1,7 +1,7 @@
1
- import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction, type APIBaseInteraction, type APIChatInputApplicationCommandInteraction, type APIChatInputApplicationCommandInteractionData, type APICommandAutocompleteInteractionResponseCallbackData, type APIInteraction, type APIInteractionResponse, type APIInteractionResponseChannelMessageWithSource, type APIInteractionResponseDeferredChannelMessageWithSource, type APIInteractionResponseDeferredMessageUpdate, type APIInteractionResponsePong, type APIInteractionResponseUpdateMessage, type APIMessageApplicationCommandInteraction, type APIMessageApplicationCommandInteractionData, type APIMessageButtonInteractionData, type APIMessageComponentInteraction, type APIMessageComponentSelectMenuInteraction, type APIMessageStringSelectInteractionData, type APIModalSubmission, type APIModalSubmitInteraction, type APIUserApplicationCommandInteraction, type APIUserApplicationCommandInteractionData, ApplicationCommandType, ComponentType, type GatewayInteractionCreateDispatchData, InteractionResponseType, InteractionType, type MessageFlags, type RESTPostAPIInteractionCallbackJSONBody } from '../types';
1
+ import { type APIApplicationCommandAutocompleteInteraction, type APIApplicationCommandInteraction, type APIBaseInteraction, type APIChatInputApplicationCommandInteraction, type APIChatInputApplicationCommandInteractionData, type APICommandAutocompleteInteractionResponseCallbackData, type APIInteraction, type APIInteractionResponse, type APIInteractionResponseChannelMessageWithSource, type APIInteractionResponseDeferredChannelMessageWithSource, type APIInteractionResponseDeferredMessageUpdate, type APIInteractionResponsePong, type APIInteractionResponseUpdateMessage, type APIMessageApplicationCommandInteraction, type APIMessageApplicationCommandInteractionData, type APIMessageButtonInteractionData, type APIMessageComponentInteraction, type APIMessageComponentSelectMenuInteraction, type APIMessageStringSelectInteractionData, type APIModalSubmission, type APIModalSubmitInteraction, type APIUserApplicationCommandInteraction, type APIUserApplicationCommandInteractionData, ApplicationCommandType, ComponentType, type GatewayInteractionCreateDispatchData, InteractionResponseType, InteractionType, type MessageFlags, type RESTPostAPIInteractionCallbackJSONBody, type APIEntryPointCommandInteraction, type InteractionCallbackData, type InteractionCallbackResourceActivity } from '../types';
2
2
  import type { RawFile } from '../api';
3
3
  import type { UsingClient } from '../commands';
4
- import type { ObjectToLower, OmitInsert, ToClass, When, ComponentInteractionMessageUpdate, InteractionCreateBodyRequest, InteractionMessageUpdateBodyRequest, MessageCreateBodyRequest, MessageUpdateBodyRequest, MessageWebhookCreateBodyRequest, ModalCreateBodyRequest } from '../common';
4
+ import { type ObjectToLower, type OmitInsert, type ToClass, type When, type ComponentInteractionMessageUpdate, type InteractionCreateBodyRequest, type InteractionMessageUpdateBodyRequest, type MessageCreateBodyRequest, type MessageUpdateBodyRequest, type MessageWebhookCreateBodyRequest, type ModalCreateBodyRequest } from '../common';
5
5
  import { type AllChannels } from './';
6
6
  import { DiscordBase } from './extra/DiscordBase';
7
7
  import { PermissionsBitField } from './extra/Permissions';
@@ -12,6 +12,8 @@ export type ReplyInteractionBody = {
12
12
  } | {
13
13
  type: InteractionResponseType.ChannelMessageWithSource | InteractionResponseType.UpdateMessage;
14
14
  data: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest | ComponentInteractionMessageUpdate;
15
+ } | {
16
+ type: InteractionResponseType.LaunchActivity;
15
17
  } | Exclude<RESTPostAPIInteractionCallbackJSONBody, APIInteractionResponsePong>;
16
18
  export type __InternalReplyFunction = (_: {
17
19
  body: APIInteractionResponse;
@@ -30,7 +32,7 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
30
32
  appPermissions?: PermissionsBitField;
31
33
  constructor(client: UsingClient, interaction: Type, __reply?: __InternalReplyFunction | undefined);
32
34
  static transformBodyRequest(body: ReplyInteractionBody, files: RawFile[] | undefined, self: UsingClient): APIInteractionResponse;
33
- static transformBody<T>(body: InteractionMessageUpdateBodyRequest | MessageUpdateBodyRequest | MessageCreateBodyRequest | MessageWebhookCreateBodyRequest, files: RawFile[] | undefined, self: UsingClient): T;
35
+ static transformBody<T>(body: InteractionCreateBodyRequest | InteractionMessageUpdateBodyRequest | MessageUpdateBodyRequest | MessageCreateBodyRequest | MessageWebhookCreateBodyRequest, files: RawFile[] | undefined, self: UsingClient): T;
34
36
  private matchReplied;
35
37
  reply(body: ReplyInteractionBody): Promise<void>;
36
38
  deferReply(flags?: MessageFlags): Promise<void>;
@@ -45,10 +47,11 @@ export declare class BaseInteraction<FromGuild extends boolean = boolean, Type e
45
47
  isMessage(): this is MessageCommandInteraction;
46
48
  isAutocomplete(): this is AutocompleteInteraction;
47
49
  isModal(): this is ModalSubmitInteraction;
50
+ isEntryPoint(): this is EntryPointInteraction;
48
51
  static from(client: UsingClient, gateway: GatewayInteractionCreateDispatchData, __reply?: __InternalReplyFunction): RoleSelectMenuInteraction | UserSelectMenuInteraction | MentionableSelectMenuInteraction | ChannelSelectMenuInteraction | StringSelectMenuInteraction<string[]> | AutocompleteInteraction<boolean> | ChatInputCommandInteraction<boolean> | UserCommandInteraction<boolean> | MessageCommandInteraction<boolean> | ButtonInteraction | ModalSubmitInteraction<boolean> | BaseInteraction<boolean, import("../types").APIPingInteraction>;
49
52
  fetchGuild(force?: boolean): Promise<import("./Guild").Guild<"api">> | undefined;
50
53
  }
51
- export type AllInteractions = AutocompleteInteraction | ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction | SelectMenuInteraction | ModalSubmitInteraction | BaseInteraction;
54
+ export type AllInteractions = AutocompleteInteraction | ChatInputCommandInteraction | UserCommandInteraction | MessageCommandInteraction | ComponentInteraction | SelectMenuInteraction | ModalSubmitInteraction | EntryPointInteraction | BaseInteraction;
52
55
  export interface AutocompleteInteraction extends ObjectToLower<Omit<APIApplicationCommandAutocompleteInteraction, 'user' | 'member' | 'type' | 'data' | 'message' | 'channel' | 'app_permissions'>> {
53
56
  }
54
57
  export declare class AutocompleteInteraction<FromGuild extends boolean = boolean> extends BaseInteraction<FromGuild, APIApplicationCommandAutocompleteInteraction> {
@@ -79,6 +82,23 @@ export declare class ApplicationCommandInteraction<FromGuild extends boolean = b
79
82
  type: ApplicationCommandType;
80
83
  respond(data: APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate | APIInteractionResponseUpdateMessage): Promise<void>;
81
84
  }
85
+ /**
86
+ * Seyfert don't support activities, so this interaction is blank
87
+ */
88
+ export declare class EntryPointInteraction<FromGuild extends boolean = boolean> extends ApplicationCommandInteraction<FromGuild, APIEntryPointCommandInteraction> {
89
+ withReponse(data?: InteractionCreateBodyRequest): Promise<EntryPointWithResponseResult>;
90
+ isEntryPoint(): this is EntryPointInteraction;
91
+ }
92
+ export interface EntryPointWithResponseResult {
93
+ interaction: ObjectToLower<InteractionCallbackData>;
94
+ resource?: {
95
+ type: InteractionResponseType.LaunchActivity;
96
+ activityInstance: InteractionCallbackResourceActivity;
97
+ } | {
98
+ type: Exclude<InteractionResponseType, InteractionResponseType.LaunchActivity>;
99
+ message: WebhookMessageStructure;
100
+ };
101
+ }
82
102
  export interface ComponentInteraction extends ObjectToLower<Omit<APIMessageComponentInteraction, 'user' | 'member' | 'type' | 'data' | 'message' | 'channel' | 'app_permissions'>> {
83
103
  }
84
104
  export declare class ComponentInteraction<FromGuild extends boolean = boolean, Type extends APIMessageComponentInteraction = APIMessageComponentInteraction> extends Interaction<FromGuild, Type> {
@@ -6,9 +6,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.ModalSubmitInteraction = exports.MessageCommandInteraction = exports.UserCommandInteraction = exports.ChatInputCommandInteraction = exports.UserSelectMenuInteraction = exports.RoleSelectMenuInteraction = exports.MentionableSelectMenuInteraction = exports.ChannelSelectMenuInteraction = exports.StringSelectMenuInteraction = exports.SelectMenuInteraction = exports.ButtonInteraction = exports.ComponentInteraction = exports.ApplicationCommandInteraction = exports.Interaction = exports.AutocompleteInteraction = exports.BaseInteraction = void 0;
9
+ exports.ModalSubmitInteraction = exports.MessageCommandInteraction = exports.UserCommandInteraction = exports.ChatInputCommandInteraction = exports.UserSelectMenuInteraction = exports.RoleSelectMenuInteraction = exports.MentionableSelectMenuInteraction = exports.ChannelSelectMenuInteraction = exports.StringSelectMenuInteraction = exports.SelectMenuInteraction = exports.ButtonInteraction = exports.ComponentInteraction = exports.EntryPointInteraction = exports.ApplicationCommandInteraction = exports.Interaction = exports.AutocompleteInteraction = exports.BaseInteraction = void 0;
10
10
  const types_1 = require("../types");
11
11
  const builders_1 = require("../builders");
12
+ const common_1 = require("../common");
12
13
  const _1 = require("./");
13
14
  const DiscordBase_1 = require("./extra/DiscordBase");
14
15
  const Permissions_1 = require("./extra/Permissions");
@@ -71,6 +72,8 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
71
72
  : [],
72
73
  },
73
74
  };
75
+ case types_1.InteractionResponseType.LaunchActivity:
76
+ return body;
74
77
  default:
75
78
  return body;
76
79
  }
@@ -92,9 +95,9 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
92
95
  })) ?? undefined;
93
96
  }
94
97
  else if (files?.length) {
95
- payload.attachments = files?.map((x, id) => ({
98
+ payload.attachments = files?.map(({ filename }, id) => ({
96
99
  id,
97
- filename: x.name,
100
+ filename,
98
101
  }));
99
102
  }
100
103
  return payload;
@@ -164,6 +167,9 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
164
167
  isModal() {
165
168
  return false;
166
169
  }
170
+ isEntryPoint() {
171
+ return false;
172
+ }
167
173
  static from(client, gateway, __reply) {
168
174
  switch (gateway.type) {
169
175
  case types_1.InteractionType.ApplicationCommandAutocomplete:
@@ -177,6 +183,8 @@ class BaseInteraction extends DiscordBase_1.DiscordBase {
177
183
  return new UserCommandInteraction(client, gateway, __reply);
178
184
  case types_1.ApplicationCommandType.Message:
179
185
  return new MessageCommandInteraction(client, gateway, __reply);
186
+ case types_1.ApplicationCommandType.PrimaryEntryPoint:
187
+ return new EntryPointInteraction(client, gateway, __reply);
180
188
  }
181
189
  // biome-ignore lint/suspicious/noFallthroughSwitchClause: bad interaction between biome and ts-server
182
190
  case types_1.InteractionType.MessageComponent:
@@ -254,8 +262,8 @@ class Interaction extends BaseInteraction {
254
262
  }
255
263
  async editOrReply(body, fetchReply) {
256
264
  if (await this.replied) {
257
- const { content, embeds, allowed_mentions, components, files, attachments } = body;
258
- return this.editResponse({ content, embeds, allowed_mentions, components, files, attachments });
265
+ const { content, embeds, allowed_mentions, components, files, attachments, poll } = body;
266
+ return this.editResponse({ content, embeds, allowed_mentions, components, files, attachments, poll });
259
267
  }
260
268
  return this.write(body, fetchReply);
261
269
  }
@@ -283,6 +291,47 @@ class ApplicationCommandInteraction extends Interaction {
283
291
  }
284
292
  }
285
293
  exports.ApplicationCommandInteraction = ApplicationCommandInteraction;
294
+ /**
295
+ * Seyfert don't support activities, so this interaction is blank
296
+ */
297
+ class EntryPointInteraction extends ApplicationCommandInteraction {
298
+ async withReponse(data) {
299
+ let body = { type: types_1.InteractionResponseType.LaunchActivity };
300
+ if (data) {
301
+ let { files, ...rest } = data;
302
+ files = files ? await (0, builders_1.resolveFiles)(files) : undefined;
303
+ body = BaseInteraction.transformBody(rest, files, this.client);
304
+ }
305
+ const response = await this.client.proxy
306
+ .interactions(this.id)(this.token)
307
+ .callback.post({
308
+ body,
309
+ query: { with_response: true },
310
+ });
311
+ const result = {
312
+ interaction: (0, common_1.toCamelCase)(response.interaction),
313
+ };
314
+ if (response.resource) {
315
+ if (response.resource.type !== types_1.InteractionResponseType.LaunchActivity) {
316
+ result.resource = {
317
+ type: response.resource.type,
318
+ message: transformers_1.Transformers.WebhookMessage(this.client, response.resource.message, this.id, this.token),
319
+ };
320
+ }
321
+ else {
322
+ result.resource = {
323
+ type: response.resource.type,
324
+ activityInstance: response.resource.activity_instance,
325
+ };
326
+ }
327
+ }
328
+ return result;
329
+ }
330
+ isEntryPoint() {
331
+ return true;
332
+ }
333
+ }
334
+ exports.EntryPointInteraction = EntryPointInteraction;
286
335
  class ComponentInteraction extends Interaction {
287
336
  update(data) {
288
337
  return this.reply({
@@ -64,9 +64,6 @@ export declare class InMessageEmbed {
64
64
  data: APIEmbed;
65
65
  constructor(data: APIEmbed);
66
66
  get title(): string | undefined;
67
- /**
68
- * @deprecated
69
- */
70
67
  get type(): import("../types").EmbedType | undefined;
71
68
  get description(): string | undefined;
72
69
  get url(): string | undefined;
@@ -135,9 +135,6 @@ class InMessageEmbed {
135
135
  get title() {
136
136
  return this.data.title;
137
137
  }
138
- /**
139
- * @deprecated
140
- */
141
138
  get type() {
142
139
  return this.data.type;
143
140
  }
@@ -184,9 +184,9 @@ class MessagesMethods extends DiscordBase_1.DiscordBase {
184
184
  })) ?? undefined;
185
185
  }
186
186
  else if (files?.length) {
187
- payload.attachments = files?.map((x, id) => ({
187
+ payload.attachments = files?.map(({ filename }, id) => ({
188
188
  id,
189
- filename: x.name,
189
+ filename,
190
190
  }));
191
191
  }
192
192
  return payload;
@@ -1,4 +1,4 @@
1
- import type { ObjectToLower } from '../../common';
1
+ import { type ObjectToLower } from '../../common';
2
2
  import type { ImageOptions } from '../../common/types/options';
3
3
  import { type APIPartialGuild } from '../../types';
4
4
  import { DiscordBase } from './DiscordBase';
@@ -37,5 +37,15 @@ export declare class BaseGuild extends DiscordBase<APIPartialGuild> {
37
37
  * @returns Banner url or void
38
38
  */
39
39
  bannerURL(options?: ImageOptions): string | undefined;
40
+ /**
41
+ * Shard ID of the guild.
42
+ * @returns Shard ID or -1 if the client is not gateway based.
43
+ */
44
+ get shardId(): number;
45
+ /**
46
+ * Shard of the guild.
47
+ * @returns Shard or undefined, if the client is not gateway based always undefined.
48
+ */
49
+ get shard(): import("../../websocket").Shard | undefined;
40
50
  toString(): string;
41
51
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseGuild = void 0;
4
+ const common_1 = require("../../common");
4
5
  const types_1 = require("../../types");
5
6
  const DiscordBase_1 = require("./DiscordBase");
6
7
  /**
@@ -64,6 +65,32 @@ class BaseGuild extends DiscordBase_1.DiscordBase {
64
65
  }
65
66
  return this.rest.cdn.banners(this.id).get(this.banner, options);
66
67
  }
68
+ /**
69
+ * Shard ID of the guild.
70
+ * @returns Shard ID or -1 if the client is not gateway based.
71
+ */
72
+ get shardId() {
73
+ if ('gateway' in this.client) {
74
+ return this.client.gateway.calculateShardId(this.id);
75
+ }
76
+ if ('shards' in this.client) {
77
+ return (0, common_1.calculateShardId)(this.id, this.client.workerData.totalShards);
78
+ }
79
+ return -1;
80
+ }
81
+ /**
82
+ * Shard of the guild.
83
+ * @returns Shard or undefined, if the client is not gateway based always undefined.
84
+ */
85
+ get shard() {
86
+ if ('gateway' in this.client) {
87
+ return this.client.gateway.get(this.shardId);
88
+ }
89
+ if ('shards' in this.client) {
90
+ return this.client.shards.get(this.shardId);
91
+ }
92
+ return undefined;
93
+ }
67
94
  toString() {
68
95
  return this.name;
69
96
  }
@@ -1,6 +1,6 @@
1
1
  import type { Snowflake, ChannelType, GatewayDispatchEvents, GatewayOpcodes } from './index';
2
2
  import type { GatewayPresenceUpdate } from './payloads/gateway';
3
- import type { APIApplication, APIApplicationCommandPermission, APIAutoModerationRule, APIAutoModerationAction, APIChannel, APIEmoji, APIGuild, APIGuildIntegration, APIGuildMember, APIGuildScheduledEvent, APIInteraction, APIMessage, APIRole, APIStageInstance, APISticker, APIThreadChannel, APIThreadMember, APIUnavailableGuild, APIUser, GatewayActivity, GatewayPresenceUpdate as RawGatewayPresenceUpdate, GatewayThreadListSync as RawGatewayThreadListSync, GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate, APIVoiceState, InviteTargetType, PresenceUpdateStatus, AutoModerationRuleTriggerType, APIAuditLogEntry, APIEntitlement, APIPartialEmoji } from './payloads/index';
3
+ import type { APIApplication, APIApplicationCommandPermission, APIAutoModerationRule, APIAutoModerationAction, APIChannel, APIEmoji, APIGuild, APIGuildIntegration, APIGuildMember, APIGuildScheduledEvent, APIInteraction, APIMessage, APIRole, APIStageInstance, APISticker, APIThreadChannel, APIThreadMember, APIUnavailableGuild, APIUser, GatewayActivity, GatewayPresenceUpdate as RawGatewayPresenceUpdate, GatewayThreadListSync as RawGatewayThreadListSync, GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate, APIVoiceState, InviteTargetType, PresenceUpdateStatus, AutoModerationRuleTriggerType, APIAuditLogEntry, APIEntitlement, APIPartialEmoji, APISubscription } from './payloads/index';
4
4
  import type { ReactionType } from './rest/index';
5
5
  import type { AnimationTypes, Nullable } from './utils';
6
6
  /**
@@ -310,7 +310,9 @@ export type GatewayEntitlementModifyDispatch = DataPayload<GatewayDispatchEvents
310
310
  /**
311
311
  * https://discord.com/developers/docs/topics/gateway-events#entitlement-create
312
312
  */
313
- export type GatewayEntitlementCreateDispatchData = GatewayEntitlementModifyDispatchData;
313
+ export type GatewayEntitlementCreateDispatchData = Omit<GatewayEntitlementModifyDispatchData, 'ends_at'> & {
314
+ ends_at: null;
315
+ };
314
316
  /**
315
317
  * https://discord.com/developers/docs/topics/gateway-events#entitlement-create
316
318
  */
@@ -988,6 +990,21 @@ export type GatewayStageInstanceUpdateDispatch = DataPayload<GatewayDispatchEven
988
990
  * https://discord.com/developers/docs/topics/gateway-events#stage-instance-update
989
991
  */
990
992
  export type GatewayStageInstanceUpdateDispatchData = APIStageInstance;
993
+ /**
994
+ * https://canary.discord.com/developers/docs/topics/gateway-events#subscription-create
995
+ */
996
+ export type GatewaySubscriptionCreateDispatch = DataPayload<GatewayDispatchEvents.SubscriptionCreate, GatewaySubscriptionCreateDispatchData>;
997
+ export type GatewaySubscriptionCreateDispatchData = APISubscription;
998
+ /**
999
+ * https://canary.discord.com/developers/docs/topics/gateway-events#subscription-update
1000
+ */
1001
+ export type GatewaySubscriptionUpdateDispatch = DataPayload<GatewayDispatchEvents.SubscriptionUpdate, GatewaySubscriptionUpdateDispatchData>;
1002
+ export type GatewaySubscriptionUpdateDispatchData = APISubscription;
1003
+ /**
1004
+ * https://canary.discord.com/developers/docs/topics/gateway-events#subscription-delete
1005
+ */
1006
+ export type GatewaySubscriptionDeleteDispatch = DataPayload<GatewayDispatchEvents.SubscriptionDelete, GatewaySubscriptionDeleteDispatchData>;
1007
+ export type GatewaySubscriptionDeleteDispatchData = APISubscription;
991
1008
  /**
992
1009
  * https://discord.com/developers/docs/topics/gateway-events#thread-list-sync
993
1010
  */
@@ -1,5 +1,5 @@
1
1
  import type { APIInteractionDataResolved } from '../../index';
2
- import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
2
+ import type { APIApplicationCommandInteractionWrapper, APIEntryPointInteractionData, ApplicationCommandType } from '../applicationCommands';
3
3
  import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
4
4
  import type { APIApplicationCommandAttachmentOption, APIApplicationCommandInteractionDataAttachmentOption } from './_chatInput/attachment';
5
5
  import type { APIApplicationCommandBooleanOption, APIApplicationCommandInteractionDataBooleanOption } from './_chatInput/boolean';
@@ -58,3 +58,8 @@ export type APIChatInputApplicationCommandDMInteraction = APIDMInteractionWrappe
58
58
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
59
59
  */
60
60
  export type APIChatInputApplicationCommandGuildInteraction = APIGuildInteractionWrapper<APIChatInputApplicationCommandInteraction>;
61
+ /**
62
+ * Documentation goes brrrrrr
63
+ * @unstable
64
+ */
65
+ export type APIEntryPointCommandInteraction = APIApplicationCommandInteractionWrapper<APIEntryPointInteractionData>;
@@ -1,6 +1,7 @@
1
1
  import type { LocalizationMap, Permissions, Snowflake } from '../..';
2
- import type { APIApplicationCommandOption, APIChatInputApplicationCommandDMInteraction, APIChatInputApplicationCommandGuildInteraction, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteractionData } from './_applicationCommands/chatInput';
2
+ import type { APIApplicationCommandOption, APIChatInputApplicationCommandDMInteraction, APIChatInputApplicationCommandGuildInteraction, APIChatInputApplicationCommandInteraction, APIChatInputApplicationCommandInteractionData, APIEntryPointCommandInteraction } from './_applicationCommands/chatInput';
3
3
  import type { APIContextMenuDMInteraction, APIContextMenuGuildInteraction, APIContextMenuInteraction, APIContextMenuInteractionData } from './_applicationCommands/contextMenu';
4
+ import type { APIBaseApplicationCommandInteractionData } from './_applicationCommands/internals';
4
5
  import type { APIBaseInteraction } from './base';
5
6
  import type { InteractionType } from './responses';
6
7
  export * from './_applicationCommands/chatInput';
@@ -79,27 +80,55 @@ export interface APIApplicationCommand {
79
80
  /**
80
81
  * Installation context(s) where the command is available, only for globally-scoped commands. Defaults to `GUILD_INSTALL ([0])`
81
82
  *
82
- * @unstable
83
83
  */
84
84
  integration_types?: ApplicationIntegrationType[];
85
85
  /**
86
86
  * Interaction context(s) where the command can be used, only for globally-scoped commands. By default, all interaction context types included for new commands `[0,1,2]`.
87
87
  *
88
- * @unstable
89
88
  */
90
89
  contexts?: InteractionContextType[] | null;
91
90
  /**
92
91
  * Autoincrementing version identifier updated during substantial record changes
93
92
  */
94
93
  version: Snowflake;
94
+ /**
95
+ * Determines whether the interaction is handled by the app's interactions handler or by Discord
96
+ */
97
+ handler?: EntryPointCommandHandlerType;
95
98
  }
96
99
  /**
97
100
  * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-types
98
101
  */
99
102
  export declare enum ApplicationCommandType {
103
+ /**
104
+ * Slash commands; a text-based command that shows up when a user types /
105
+ */
100
106
  ChatInput = 1,
107
+ /**
108
+ * A UI-based command that shows up when you right click or tap on a user
109
+ */
101
110
  User = 2,
102
- Message = 3
111
+ /**
112
+ * A UI-based command that shows up when you right click or tap on a message
113
+ */
114
+ Message = 3,
115
+ /**
116
+ * A UI-based command that represents the primary way to invoke an app's Activity
117
+ */
118
+ PrimaryEntryPoint = 4
119
+ }
120
+ /**
121
+ * https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
122
+ */
123
+ export declare enum EntryPointCommandHandlerType {
124
+ /**
125
+ * The app handles the interaction using an interaction token
126
+ */
127
+ AppHandler = 1,
128
+ /**
129
+ * Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app
130
+ */
131
+ DiscordLaunchActivity = 2
103
132
  }
104
133
  /**
105
134
  * https://discord.com/developers/docs/resources/application#application-object-application-integration-types
@@ -131,10 +160,16 @@ export declare enum InteractionContextType {
131
160
  */
132
161
  PrivateChannel = 2
133
162
  }
163
+ /**
164
+ * Documentation goes brrrrrr
165
+ * @unstable
166
+ */
167
+ export interface APIEntryPointInteractionData extends Omit<APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>, 'guild_id'> {
168
+ }
134
169
  /**
135
170
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
136
171
  */
137
- export type APIApplicationCommandInteractionData = APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData;
172
+ export type APIApplicationCommandInteractionData = APIChatInputApplicationCommandInteractionData | APIContextMenuInteractionData | APIEntryPointInteractionData;
138
173
  /**
139
174
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
140
175
  */
@@ -142,7 +177,7 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
142
177
  /**
143
178
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
144
179
  */
145
- export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
180
+ export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction | APIEntryPointCommandInteraction;
146
181
  /**
147
182
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
148
183
  */
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.InteractionContextType = exports.ApplicationIntegrationType = exports.ApplicationCommandType = void 0;
17
+ exports.InteractionContextType = exports.ApplicationIntegrationType = exports.EntryPointCommandHandlerType = exports.ApplicationCommandType = void 0;
18
18
  __exportStar(require("./_applicationCommands/chatInput"), exports);
19
19
  __exportStar(require("./_applicationCommands/contextMenu"), exports);
20
20
  __exportStar(require("./_applicationCommands/permissions"), exports);
@@ -23,10 +23,37 @@ __exportStar(require("./_applicationCommands/permissions"), exports);
23
23
  */
24
24
  var ApplicationCommandType;
25
25
  (function (ApplicationCommandType) {
26
+ /**
27
+ * Slash commands; a text-based command that shows up when a user types /
28
+ */
26
29
  ApplicationCommandType[ApplicationCommandType["ChatInput"] = 1] = "ChatInput";
30
+ /**
31
+ * A UI-based command that shows up when you right click or tap on a user
32
+ */
27
33
  ApplicationCommandType[ApplicationCommandType["User"] = 2] = "User";
34
+ /**
35
+ * A UI-based command that shows up when you right click or tap on a message
36
+ */
28
37
  ApplicationCommandType[ApplicationCommandType["Message"] = 3] = "Message";
38
+ /**
39
+ * A UI-based command that represents the primary way to invoke an app's Activity
40
+ */
41
+ ApplicationCommandType[ApplicationCommandType["PrimaryEntryPoint"] = 4] = "PrimaryEntryPoint";
29
42
  })(ApplicationCommandType || (exports.ApplicationCommandType = ApplicationCommandType = {}));
43
+ /**
44
+ * https://discord.com/developers/docs/interactions/application-commands#application-command-object-entry-point-command-handler-types
45
+ */
46
+ var EntryPointCommandHandlerType;
47
+ (function (EntryPointCommandHandlerType) {
48
+ /**
49
+ * The app handles the interaction using an interaction token
50
+ */
51
+ EntryPointCommandHandlerType[EntryPointCommandHandlerType["AppHandler"] = 1] = "AppHandler";
52
+ /**
53
+ * Discord handles the interaction by launching an Activity and sending a follow-up message without coordinating with the app
54
+ */
55
+ EntryPointCommandHandlerType[EntryPointCommandHandlerType["DiscordLaunchActivity"] = 2] = "DiscordLaunchActivity";
56
+ })(EntryPointCommandHandlerType || (exports.EntryPointCommandHandlerType = EntryPointCommandHandlerType = {}));
30
57
  /**
31
58
  * https://discord.com/developers/docs/resources/application#application-object-application-integration-types
32
59
  */
@@ -1,3 +1,4 @@
1
+ import type { MakeRequired } from '../../../common';
1
2
  import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../index';
2
3
  import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
3
4
  import type { MessageFlags } from '../index';
@@ -15,7 +16,7 @@ export declare enum InteractionType {
15
16
  /**
16
17
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object
17
18
  */
18
- export type APIInteractionResponse = APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate | APIInteractionResponsePong | APIInteractionResponseUpdateMessage | APIModalInteractionResponse | APIPremiumRequiredInteractionResponse;
19
+ export type APIInteractionResponse = APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate | APIInteractionResponsePong | APIInteractionResponseUpdateMessage | APIModalInteractionResponse | APIInteractionResponseLaunchActivity | APIPremiumRequiredInteractionResponse;
19
20
  export interface APIInteractionResponsePong {
20
21
  type: InteractionResponseType.Pong;
21
22
  }
@@ -45,6 +46,9 @@ export interface APIInteractionResponseUpdateMessage {
45
46
  type: InteractionResponseType.UpdateMessage;
46
47
  data?: APIInteractionResponseCallbackData;
47
48
  }
49
+ export interface APIInteractionResponseLaunchActivity {
50
+ type: InteractionResponseType.LaunchActivity;
51
+ }
48
52
  /**
49
53
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
50
54
  */
@@ -82,7 +86,11 @@ export declare enum InteractionResponseType {
82
86
  *
83
87
  * @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
84
88
  */
85
- PremiumRequired = 10
89
+ PremiumRequired = 10,
90
+ /**
91
+ * Launch the Activity associated with the app. Only available for apps with Activities enabled
92
+ */
93
+ LaunchActivity = 12
86
94
  }
87
95
  /**
88
96
  * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
@@ -110,3 +118,67 @@ export interface APIModalInteractionResponseCallbackData {
110
118
  */
111
119
  components: APIActionRowComponent<APIModalActionRowComponent>[];
112
120
  }
121
+ /**
122
+ * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object
123
+ */
124
+ export interface InteractionCallbackData<T extends InteractionType = InteractionType> {
125
+ id: string;
126
+ type: T;
127
+ /**
128
+ * Instance ID of the Activity if one was launched or joined
129
+ */
130
+ activity_instance_id?: string;
131
+ /**
132
+ * ID of the message that was created by the interaction
133
+ */
134
+ response_message_id?: string;
135
+ /**
136
+ * Whether or not the message is in a loading state
137
+ */
138
+ response_message_loading?: boolean;
139
+ /**
140
+ * Whether or not the response message was ephemeral
141
+ */
142
+ response_message_ephemeral?: boolean;
143
+ }
144
+ /**
145
+ * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object
146
+ */
147
+ export interface InteractionCallbackResourceActivity {
148
+ /**
149
+ * Instance ID of the Activity if one was launched or joined.
150
+ */
151
+ id: string;
152
+ }
153
+ /**
154
+ * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource
155
+ */
156
+ export interface InteractionCallbackResource<T extends InteractionResponseType = InteractionResponseType> {
157
+ type: T;
158
+ /**
159
+ * Represents the Activity launched by this interaction.
160
+ */
161
+ activity_instance?: InteractionCallbackResourceActivity;
162
+ /**
163
+ * Message created by the interaction.
164
+ */
165
+ message?: Omit<RESTPostAPIWebhookWithTokenJSONBody, 'avatar_url' | 'username'> & {
166
+ flags?: MessageFlags;
167
+ };
168
+ }
169
+ /**
170
+ * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
171
+ */
172
+ export interface InteractionCallbackResponse {
173
+ interaction: InteractionCallbackData;
174
+ resource?: InteractionCallbackResource;
175
+ }
176
+ /**
177
+ * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object
178
+ */
179
+ export type APIInteractionCallbackLaunchActivity = InteractionCallbackResponse & {
180
+ resource?: Omit<MakeRequired<InteractionCallbackResource, 'activity_instance'>, 'message'>;
181
+ };
182
+ export type APIInteractionCallbackMessage = InteractionCallbackResponse & {
183
+ resource?: Omit<MakeRequired<InteractionCallbackResource, 'message'>, 'activity_instance'>;
184
+ };
@@ -51,4 +51,8 @@ var InteractionResponseType;
51
51
  * @deprecated See https://discord.com/developers/docs/change-log#premium-apps-new-premium-button-style-deep-linking-url-schemes
52
52
  */
53
53
  InteractionResponseType[InteractionResponseType["PremiumRequired"] = 10] = "PremiumRequired";
54
+ /**
55
+ * Launch the Activity associated with the app. Only available for apps with Activities enabled
56
+ */
57
+ InteractionResponseType[InteractionResponseType["LaunchActivity"] = 12] = "LaunchActivity";
54
58
  })(InteractionResponseType || (exports.InteractionResponseType = InteractionResponseType = {}));