dfx 0.106.0 → 0.107.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.
package/src/types.ts CHANGED
@@ -98,25 +98,25 @@ export interface ActivityInstance {
98
98
  readonly instance_id: string
99
99
  /** Unique identifier for the launch */
100
100
  readonly launch_id: Snowflake
101
- /** The Location the instance is runnning in */
101
+ /** Location the instance is runnning in */
102
102
  readonly location: ActivityLocation
103
- /** The IDs of the Users currently connected to the instance */
103
+ /** IDs of the Users currently connected to the instance */
104
104
  readonly users: Array<Snowflake>
105
105
  }
106
106
  export interface ActivityLocation {
107
- /** The unique identifier for the location */
107
+ /** Unique identifier for the location */
108
108
  readonly id: string
109
109
  /** Enum describing kind of location */
110
110
  readonly kind: ActivityLocationKind
111
- /** The id of the Channel */
111
+ /** ID of the Channel */
112
112
  readonly channel_id: Snowflake
113
- /** The id of the Guild */
113
+ /** ID of the Guild */
114
114
  readonly guild_id?: Snowflake | null
115
115
  }
116
116
  export enum ActivityLocationKind {
117
- /** The Location is a Guild Channel */
117
+ /** Location is a Guild Channel */
118
118
  GC = "'gc'",
119
- /** The Location is a Private Channel, such as a DM or GDM */
119
+ /** Location is a Private Channel, such as a DM or GDM */
120
120
  PC = "'pc'",
121
121
  }
122
122
  export interface ActivityParty {
@@ -232,6 +232,12 @@ export interface Application {
232
232
  readonly interactions_endpoint_url?: string | null
233
233
  /** Role connection verification URL for the app */
234
234
  readonly role_connections_verification_url?: string | null
235
+ /** Event webhooks URL for the app to receive webhook events */
236
+ readonly event_webhooks_url?: string | null
237
+ /** If webhook events are enabled for the app. 1 (default) means disabled, 2 means enabled, and 3 means disabled by Discord */
238
+ readonly event_webhooks_status: ApplicationEventWebhookStatus
239
+ /** List of Webhook event types the app subscribes to */
240
+ readonly event_webhooks_types?: Array<EventType>
235
241
  /** List of tags describing the content and functionality of the app. Max of 5 tags. */
236
242
  readonly tags?: Array<string>
237
243
  /** Settings for the app's default in-app authorization link, if enabled */
@@ -241,6 +247,16 @@ export interface Application {
241
247
  /** Default custom authorization URL for the app, if enabled */
242
248
  readonly custom_install_url?: string
243
249
  }
250
+ export interface ApplicationAuthorized {
251
+ /** Installation context for the authorization. Either guild (0) if installed to a server or user (1) if installed to a user's account */
252
+ readonly integration_type?: ApplicationIntegrationType
253
+ /** User who authorized the app */
254
+ readonly user: User
255
+ /** List of scopes the user authorized */
256
+ readonly scopes: Array<OAuth2Scope>
257
+ /** Server which app was authorized for (when integration type is 0) */
258
+ readonly guild?: Guild
259
+ }
244
260
  export interface ApplicationCommand {
245
261
  /** Unique ID of command */
246
262
  readonly id: Snowflake
@@ -305,6 +321,22 @@ export interface ApplicationCommandInteractionDataOption {
305
321
  /** true if this option is the currently focused option for autocomplete */
306
322
  readonly focused?: boolean
307
323
  }
324
+ export interface ApplicationCommandInteractionMetadatum {
325
+ /** ID of the interaction */
326
+ readonly id: Snowflake
327
+ /** Type of interaction */
328
+ readonly type: InteractionType
329
+ /** User who triggered the interaction */
330
+ readonly user: User
331
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
332
+ readonly authorizing_integration_owners: ApplicationIntegrationType
333
+ /** ID of the original response message, present only on follow-up messages */
334
+ readonly original_response_message_id?: Snowflake
335
+ /** The user the command was run on, present only on user command interactions */
336
+ readonly target_user?: User
337
+ /** The ID of the message the command was run on, present only on message command interactions. The original response message will also have message_reference and referenced_message pointing to this message. */
338
+ readonly target_message_id?: Snowflake
339
+ }
308
340
  export interface ApplicationCommandOption {
309
341
  /** Type of option */
310
342
  readonly type: any
@@ -381,6 +413,14 @@ export enum ApplicationCommandType {
381
413
  /** A UI-based command that represents the primary way to invoke an app's Activity */
382
414
  PRIMARY_ENTRY_POINT = 4,
383
415
  }
416
+ export enum ApplicationEventWebhookStatus {
417
+ /** Webhook events are disabled by developer */
418
+ DISABLED = 1,
419
+ /** Webhook events are enabled by developer */
420
+ ENABLED = 2,
421
+ /** Webhook events are disabled by Discord, usually due to inactivity */
422
+ DISABLED_BY_DISCORD = 3,
423
+ }
384
424
  export const ApplicationFlag = {
385
425
  /** Indicates if an app uses the Auto Moderation API */
386
426
  APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE: 1 << 6,
@@ -1974,6 +2014,12 @@ export function createRoutes<O = any>(
1974
2014
  url: `/guilds/${guildId}/voice-states/@me`,
1975
2015
  options,
1976
2016
  }),
2017
+ getEntitlement: (applicationId, entitlementId, options) =>
2018
+ fetch({
2019
+ method: "GET",
2020
+ url: `/applications/${applicationId}/entitlements/${entitlementId}`,
2021
+ options,
2022
+ }),
1977
2023
  getFollowupMessage: (
1978
2024
  applicationId,
1979
2025
  interactionToken,
@@ -2796,6 +2842,12 @@ export interface EditCurrentApplicationParams {
2796
2842
  readonly interactions_endpoint_url: string
2797
2843
  /** List of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags. */
2798
2844
  readonly tags: Array<string>
2845
+ /** Event webhooks URL for the app to receive webhook events */
2846
+ readonly event_webhooks_url: string
2847
+ /** If webhook events are enabled for the app. 1 to disable, and 2 to enable */
2848
+ readonly event_webhooks_status: ApplicationEventWebhookStatus
2849
+ /** List of Webhook event types to subscribe to */
2850
+ readonly event_webhooks_types: Array<EventType>
2799
2851
  }
2800
2852
  export interface EditGlobalApplicationCommandParams {
2801
2853
  /** Name of command, 1-32 characters */
@@ -3550,6 +3602,12 @@ The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji
3550
3602
  guildId: string,
3551
3603
  options?: O,
3552
3604
  ) => RestResponse<VoiceState>
3605
+ /** Returns an entitlement. */
3606
+ getEntitlement: (
3607
+ applicationId: string,
3608
+ entitlementId: string,
3609
+ options?: O,
3610
+ ) => RestResponse<any>
3553
3611
  /** Returns a followup message for an Interaction. Functions the same as Get Webhook Message. */
3554
3612
  getFollowupMessage: (
3555
3613
  applicationId: string,
@@ -4159,6 +4217,7 @@ export interface Entitlement {
4159
4217
  readonly consumed?: boolean
4160
4218
  }
4161
4219
  export type EntitlementCreateEvent = Entitlement
4220
+ export type EntitlementCreateStructureEvent = Entitlement
4162
4221
  export type EntitlementDeleteEvent = Entitlement
4163
4222
  export enum EntitlementType {
4164
4223
  /** Entitlement was purchased by user */
@@ -4183,6 +4242,22 @@ export enum EntryPointCommandHandlerType {
4183
4242
  APP_HANDLER = 1,
4184
4243
  DISCORD_LAUNCH_ACTIVITY = 2,
4185
4244
  }
4245
+ export interface EventBody {
4246
+ /** Event type */
4247
+ readonly type: EventType
4248
+ /** Timestamp of when the event occurred in ISO8601 format */
4249
+ readonly timestamp: string
4250
+ /** Data for the event. The shape depends on the event type */
4251
+ readonly data?: EventType
4252
+ }
4253
+ export enum EventType {
4254
+ /** Sent when an app was authorized by a user to a server or their account */
4255
+ APPLICATION_AUTHORIZED = "APPLICATION_AUTHORIZED",
4256
+ /** Entitlement was created */
4257
+ ENTITLEMENT_CREATE = "ENTITLEMENT_CREATE",
4258
+ /** User was added to a Quest (currently unavailable) */
4259
+ QUEST_USER_ENROLLMENT = "QUEST_USER_ENROLLMENT",
4260
+ }
4186
4261
  export enum EventType {
4187
4262
  /** when a member sends or edits a message in the guild */
4188
4263
  MESSAGE_SEND = 1,
@@ -4753,7 +4828,7 @@ export interface GuildMembersChunkEvent {
4753
4828
  readonly guild_id: Snowflake
4754
4829
  /** Set of guild members */
4755
4830
  readonly members: Array<GuildMember>
4756
- /** Chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count) */
4831
+ /** Chunk index in the expected chunks for this response (0 <= chunk\_index < chunk\_count) */
4757
4832
  readonly chunk_index: number
4758
4833
  /** Total number of expected chunks for this response */
4759
4834
  readonly chunk_count: number
@@ -5032,7 +5107,7 @@ export interface GuildTemplate {
5032
5107
  readonly updated_at: string
5033
5108
  /** the ID of the guild this template is based on */
5034
5109
  readonly source_guild_id: Snowflake
5035
- /** the guild snapshot this template contains */
5110
+ /** the guild snapshot this template contains; placeholder IDs are given as integers */
5036
5111
  readonly serialized_source_guild: Guild
5037
5112
  /** whether the template has unsynced changes */
5038
5113
  readonly is_dirty?: boolean | null
@@ -5610,7 +5685,7 @@ export interface Message {
5610
5685
  readonly message_snapshots: Array<MessageSnapshot>
5611
5686
  /** the message associated with the message_reference */
5612
5687
  readonly referenced_message?: Message | null
5613
- /** In preview. Sent if the message is sent as a result of an interaction */
5688
+ /** Sent if the message is sent as a result of an interaction */
5614
5689
  readonly interaction_metadata?: MessageInteractionMetadatum
5615
5690
  /** Deprecated in favor of interaction_metadata; sent if the message is a response to an interaction */
5616
5691
  readonly interaction?: MessageInteraction
@@ -5661,6 +5736,20 @@ export interface MessageComponentDatum {
5661
5736
  /** Resolved entities from selected options */
5662
5737
  readonly resolved?: ResolvedDatum
5663
5738
  }
5739
+ export interface MessageComponentInteractionMetadatum {
5740
+ /** ID of the interaction */
5741
+ readonly id: Snowflake
5742
+ /** Type of interaction */
5743
+ readonly type: InteractionType
5744
+ /** User who triggered the interaction */
5745
+ readonly user: User
5746
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
5747
+ readonly authorizing_integration_owners: ApplicationIntegrationType
5748
+ /** ID of the original response message, present only on follow-up messages */
5749
+ readonly original_response_message_id?: Snowflake
5750
+ /** ID of the message that contained the interactive component */
5751
+ readonly interacted_message_id: Snowflake
5752
+ }
5664
5753
  export type MessageCreateEvent = Message & MessageCreateExtra
5665
5754
  export interface MessageCreateExtra {
5666
5755
  /** ID of the guild the message was sent in - unless it is an ephemeral message */
@@ -5722,22 +5811,10 @@ export interface MessageInteraction {
5722
5811
  /** Member who invoked the interaction in the guild */
5723
5812
  readonly member?: GuildMember
5724
5813
  }
5725
- export interface MessageInteractionMetadatum {
5726
- /** ID of the interaction */
5727
- readonly id: Snowflake
5728
- /** Type of interaction */
5729
- readonly type: InteractionType
5730
- /** User who triggered the interaction */
5731
- readonly user: User
5732
- /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
5733
- readonly authorizing_integration_owners: ApplicationIntegrationType
5734
- /** ID of the original response message, present only on follow-up messages */
5735
- readonly original_response_message_id?: Snowflake
5736
- /** ID of the message that contained interactive component, present only on messages created from component interactions */
5737
- readonly interacted_message_id?: Snowflake
5738
- /** Metadata for the interaction that was used to open the modal, present only on modal submit interactions */
5739
- readonly triggering_interaction_metadata?: MessageInteractionMetadatum
5740
- }
5814
+ export type MessageInteractionMetadatum =
5815
+ | ApplicationCommandInteractionMetadatum
5816
+ | MessageComponentInteractionMetadatum
5817
+ | ModalSubmitInteractionMetadatum
5741
5818
  export interface MessagePollVoteAddEvent {
5742
5819
  /** ID of the user */
5743
5820
  readonly user_id: Snowflake
@@ -5892,6 +5969,20 @@ export interface ModalSubmitDatum {
5892
5969
  /** Values submitted by the user */
5893
5970
  readonly components: Array<Component>
5894
5971
  }
5972
+ export interface ModalSubmitInteractionMetadatum {
5973
+ /** ID of the interaction */
5974
+ readonly id: Snowflake
5975
+ /** Type of interaction */
5976
+ readonly type: InteractionType
5977
+ /** User who triggered the interaction */
5978
+ readonly user: User
5979
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
5980
+ readonly authorizing_integration_owners: ApplicationIntegrationType
5981
+ /** ID of the original response message, present only on follow-up messages */
5982
+ readonly original_response_message_id?: Snowflake
5983
+ /** Metadata for the interaction that was used to open the modal */
5984
+ readonly triggering_interaction_metadata: ApplicationCommandInteractionMetadatum
5985
+ }
5895
5986
  export interface ModifyApplicationEmojiParams {
5896
5987
  /** name of the emoji */
5897
5988
  readonly name: string
@@ -7555,6 +7646,12 @@ export interface WebhooksUpdateEvent {
7555
7646
  /** ID of the channel */
7556
7647
  readonly channel_id: Snowflake
7557
7648
  }
7649
+ export enum WebhookType {
7650
+ /** PING event sent to verify your Webhook Event URL is active */
7651
+ PING = 0,
7652
+ /** Webhook event (details for event in event body object) */
7653
+ EVENT = 1,
7654
+ }
7558
7655
  export enum WebhookType {
7559
7656
  /** Incoming Webhooks can post messages to channels with a generated token */
7560
7657
  INCOMING = 1,
@@ -1,7 +1,7 @@
1
1
  import { pipe } from "effect/Function"
2
2
  import * as Deferred from "effect/Deferred"
3
3
  import * as Effect from "effect/Effect"
4
- import type * as Fiber from "effect/Fiber"
4
+ import * as Fiber from "effect/Fiber"
5
5
  import * as PubSub from "effect/PubSub"
6
6
  import * as Queue from "effect/Queue"
7
7
 
@@ -14,10 +14,10 @@ export const subscribeForEachPar = <R, E, A, X>(
14
14
  PubSub.subscribe(self),
15
15
  Effect.flatMap(queue =>
16
16
  Effect.forever(
17
- Effect.flatMap(Queue.take(queue), _ =>
17
+ Effect.flatMap(Queue.take(queue), a =>
18
18
  Effect.fork(
19
- Effect.catchAllCause(effect(_), _ =>
20
- Deferred.failCause(deferred, _),
19
+ Effect.catchAllCause(effect(a), cause =>
20
+ Deferred.failCause(deferred, cause),
21
21
  ),
22
22
  ),
23
23
  ),
@@ -27,45 +27,28 @@ export const subscribeForEachPar = <R, E, A, X>(
27
27
  Effect.interruptible,
28
28
  )
29
29
 
30
- return Effect.all([run, Deferred.await(deferred)], {
31
- concurrency: "unbounded",
32
- discard: true,
33
- }) as Effect.Effect<never, E, R>
30
+ return Effect.raceFirst(run, Deferred.await(deferred))
34
31
  })
35
32
 
36
33
  export const foreverSwitch = <R, E, A, R1, E1, X>(
37
34
  self: Effect.Effect<A, E, R>,
38
35
  f: (_: A) => Effect.Effect<X, E1, R1>,
39
36
  ): Effect.Effect<never, E | E1, R | R1> =>
40
- pipe(
41
- Effect.all([Deferred.make<never, E1>(), Effect.fiberId]),
42
- Effect.flatMap(([causeDeferred, fiberId]) => {
43
- let fiber: Fiber.RuntimeFiber<unknown, unknown> | undefined
44
-
45
- const run = pipe(
46
- self,
47
- Effect.tap(() =>
48
- fiber ? fiber.interruptAsFork(fiberId) : Effect.void,
49
- ),
50
- Effect.flatMap(_ =>
51
- pipe(
52
- f(_),
53
- Effect.tapErrorCause(_ => Deferred.failCause(causeDeferred, _)),
54
- Effect.fork,
55
- ),
56
- ),
57
- Effect.tap(fiber_ =>
58
- Effect.sync(() => {
37
+ Effect.gen(function* () {
38
+ const deferred = yield* Deferred.make<never, E1>()
39
+ let fiber: Fiber.RuntimeFiber<unknown, unknown> | undefined
40
+ return yield* self.pipe(
41
+ Effect.tap(() => (fiber ? Fiber.interruptFork(fiber) : Effect.void)),
42
+ Effect.flatMap(a =>
43
+ f(a).pipe(
44
+ Effect.catchAllCause(cause => Deferred.failCause(deferred, cause)),
45
+ Effect.fork,
46
+ Effect.tap(fiber_ => {
59
47
  fiber = fiber_
60
48
  }),
61
49
  ),
62
- Effect.forever,
63
- Effect.interruptible,
64
- )
65
-
66
- return Effect.all([run, Deferred.await(causeDeferred)], {
67
- concurrency: "unbounded",
68
- discard: true,
69
- }) as Effect.Effect<never, E | E1, R | R1>
70
- }),
71
- )
50
+ ),
51
+ Effect.forever,
52
+ Effect.raceFirst(Deferred.await(deferred)),
53
+ )
54
+ })
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.106.0";
1
+ export const LIB_VERSION = "0.107.0";
@@ -1 +1 @@
1
- {"fileNames":[],"fileInfos":[],"root":[],"options":{"allowJs":false,"checkJs":false,"composite":true,"declaration":true,"declarationMap":true,"downlevelIteration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"noEmitOnError":false,"noErrorTruncation":false,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":false,"noImplicitThis":true,"noUncheckedIndexedAccess":false,"noUnusedLocals":true,"noUnusedParameters":false,"removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"stripInternal":true,"target":99},"version":"5.6.3"}
1
+ {"fileNames":[],"fileInfos":[],"root":[],"options":{"allowJs":false,"checkJs":false,"composite":true,"declaration":true,"declarationMap":true,"downlevelIteration":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"noEmitOnError":false,"noErrorTruncation":false,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitReturns":false,"noImplicitThis":true,"noUncheckedIndexedAccess":false,"noUnusedLocals":true,"noUnusedParameters":false,"removeComments":false,"skipLibCheck":true,"sourceMap":true,"strict":true,"strictNullChecks":true,"stripInternal":true,"target":99},"version":"5.7.2"}
package/types.d.ts CHANGED
@@ -97,25 +97,25 @@ export interface ActivityInstance {
97
97
  readonly instance_id: string;
98
98
  /** Unique identifier for the launch */
99
99
  readonly launch_id: Snowflake;
100
- /** The Location the instance is runnning in */
100
+ /** Location the instance is runnning in */
101
101
  readonly location: ActivityLocation;
102
- /** The IDs of the Users currently connected to the instance */
102
+ /** IDs of the Users currently connected to the instance */
103
103
  readonly users: Array<Snowflake>;
104
104
  }
105
105
  export interface ActivityLocation {
106
- /** The unique identifier for the location */
106
+ /** Unique identifier for the location */
107
107
  readonly id: string;
108
108
  /** Enum describing kind of location */
109
109
  readonly kind: ActivityLocationKind;
110
- /** The id of the Channel */
110
+ /** ID of the Channel */
111
111
  readonly channel_id: Snowflake;
112
- /** The id of the Guild */
112
+ /** ID of the Guild */
113
113
  readonly guild_id?: Snowflake | null;
114
114
  }
115
115
  export declare enum ActivityLocationKind {
116
- /** The Location is a Guild Channel */
116
+ /** Location is a Guild Channel */
117
117
  GC = "'gc'",
118
- /** The Location is a Private Channel, such as a DM or GDM */
118
+ /** Location is a Private Channel, such as a DM or GDM */
119
119
  PC = "'pc'"
120
120
  }
121
121
  export interface ActivityParty {
@@ -231,6 +231,12 @@ export interface Application {
231
231
  readonly interactions_endpoint_url?: string | null;
232
232
  /** Role connection verification URL for the app */
233
233
  readonly role_connections_verification_url?: string | null;
234
+ /** Event webhooks URL for the app to receive webhook events */
235
+ readonly event_webhooks_url?: string | null;
236
+ /** If webhook events are enabled for the app. 1 (default) means disabled, 2 means enabled, and 3 means disabled by Discord */
237
+ readonly event_webhooks_status: ApplicationEventWebhookStatus;
238
+ /** List of Webhook event types the app subscribes to */
239
+ readonly event_webhooks_types?: Array<EventType>;
234
240
  /** List of tags describing the content and functionality of the app. Max of 5 tags. */
235
241
  readonly tags?: Array<string>;
236
242
  /** Settings for the app's default in-app authorization link, if enabled */
@@ -240,6 +246,16 @@ export interface Application {
240
246
  /** Default custom authorization URL for the app, if enabled */
241
247
  readonly custom_install_url?: string;
242
248
  }
249
+ export interface ApplicationAuthorized {
250
+ /** Installation context for the authorization. Either guild (0) if installed to a server or user (1) if installed to a user's account */
251
+ readonly integration_type?: ApplicationIntegrationType;
252
+ /** User who authorized the app */
253
+ readonly user: User;
254
+ /** List of scopes the user authorized */
255
+ readonly scopes: Array<OAuth2Scope>;
256
+ /** Server which app was authorized for (when integration type is 0) */
257
+ readonly guild?: Guild;
258
+ }
243
259
  export interface ApplicationCommand {
244
260
  /** Unique ID of command */
245
261
  readonly id: Snowflake;
@@ -304,6 +320,22 @@ export interface ApplicationCommandInteractionDataOption {
304
320
  /** true if this option is the currently focused option for autocomplete */
305
321
  readonly focused?: boolean;
306
322
  }
323
+ export interface ApplicationCommandInteractionMetadatum {
324
+ /** ID of the interaction */
325
+ readonly id: Snowflake;
326
+ /** Type of interaction */
327
+ readonly type: InteractionType;
328
+ /** User who triggered the interaction */
329
+ readonly user: User;
330
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
331
+ readonly authorizing_integration_owners: ApplicationIntegrationType;
332
+ /** ID of the original response message, present only on follow-up messages */
333
+ readonly original_response_message_id?: Snowflake;
334
+ /** The user the command was run on, present only on user command interactions */
335
+ readonly target_user?: User;
336
+ /** The ID of the message the command was run on, present only on message command interactions. The original response message will also have message_reference and referenced_message pointing to this message. */
337
+ readonly target_message_id?: Snowflake;
338
+ }
307
339
  export interface ApplicationCommandOption {
308
340
  /** Type of option */
309
341
  readonly type: any;
@@ -379,6 +411,14 @@ export declare enum ApplicationCommandType {
379
411
  /** A UI-based command that represents the primary way to invoke an app's Activity */
380
412
  PRIMARY_ENTRY_POINT = 4
381
413
  }
414
+ export declare enum ApplicationEventWebhookStatus {
415
+ /** Webhook events are disabled by developer */
416
+ DISABLED = 1,
417
+ /** Webhook events are enabled by developer */
418
+ ENABLED = 2,
419
+ /** Webhook events are disabled by Discord, usually due to inactivity */
420
+ DISABLED_BY_DISCORD = 3
421
+ }
382
422
  export declare const ApplicationFlag: {
383
423
  /** Indicates if an app uses the Auto Moderation API */
384
424
  readonly APPLICATION_AUTO_MODERATION_RULE_CREATE_BADGE: number;
@@ -1360,6 +1400,12 @@ export interface EditCurrentApplicationParams {
1360
1400
  readonly interactions_endpoint_url: string;
1361
1401
  /** List of tags describing the content and functionality of the app (max of 20 characters per tag). Max of 5 tags. */
1362
1402
  readonly tags: Array<string>;
1403
+ /** Event webhooks URL for the app to receive webhook events */
1404
+ readonly event_webhooks_url: string;
1405
+ /** If webhook events are enabled for the app. 1 to disable, and 2 to enable */
1406
+ readonly event_webhooks_status: ApplicationEventWebhookStatus;
1407
+ /** List of Webhook event types to subscribe to */
1408
+ readonly event_webhooks_types: Array<EventType>;
1363
1409
  }
1364
1410
  export interface EditGlobalApplicationCommandParams {
1365
1411
  /** Name of command, 1-32 characters */
@@ -1752,6 +1798,8 @@ export interface Endpoints<O> {
1752
1798
  getCurrentUserGuilds: (params?: Partial<GetCurrentUserGuildParams>, options?: O) => RestResponse<Array<Guild>>;
1753
1799
  /** Returns the current user's voice state in the guild. */
1754
1800
  getCurrentUserVoiceState: (guildId: string, options?: O) => RestResponse<VoiceState>;
1801
+ /** Returns an entitlement. */
1802
+ getEntitlement: (applicationId: string, entitlementId: string, options?: O) => RestResponse<any>;
1755
1803
  /** Returns a followup message for an Interaction. Functions the same as Get Webhook Message. */
1756
1804
  getFollowupMessage: (applicationId: string, interactionToken: string, messageId: string, params?: Partial<GetWebhookMessageParams>, options?: O) => RestResponse<Message>;
1757
1805
  getGateway: (options?: O) => RestResponse<any>;
@@ -1996,6 +2044,7 @@ export interface Entitlement {
1996
2044
  readonly consumed?: boolean;
1997
2045
  }
1998
2046
  export type EntitlementCreateEvent = Entitlement;
2047
+ export type EntitlementCreateStructureEvent = Entitlement;
1999
2048
  export type EntitlementDeleteEvent = Entitlement;
2000
2049
  export declare enum EntitlementType {
2001
2050
  /** Entitlement was purchased by user */
@@ -2020,6 +2069,22 @@ export declare enum EntryPointCommandHandlerType {
2020
2069
  APP_HANDLER = 1,
2021
2070
  DISCORD_LAUNCH_ACTIVITY = 2
2022
2071
  }
2072
+ export interface EventBody {
2073
+ /** Event type */
2074
+ readonly type: EventType;
2075
+ /** Timestamp of when the event occurred in ISO8601 format */
2076
+ readonly timestamp: string;
2077
+ /** Data for the event. The shape depends on the event type */
2078
+ readonly data?: EventType;
2079
+ }
2080
+ export declare enum EventType {
2081
+ /** Sent when an app was authorized by a user to a server or their account */
2082
+ APPLICATION_AUTHORIZED = "APPLICATION_AUTHORIZED",
2083
+ /** Entitlement was created */
2084
+ ENTITLEMENT_CREATE = "ENTITLEMENT_CREATE",
2085
+ /** User was added to a Quest (currently unavailable) */
2086
+ QUEST_USER_ENROLLMENT = "QUEST_USER_ENROLLMENT"
2087
+ }
2023
2088
  export declare enum EventType {
2024
2089
  /** when a member sends or edits a message in the guild */
2025
2090
  MESSAGE_SEND = 1,
@@ -2590,7 +2655,7 @@ export interface GuildMembersChunkEvent {
2590
2655
  readonly guild_id: Snowflake;
2591
2656
  /** Set of guild members */
2592
2657
  readonly members: Array<GuildMember>;
2593
- /** Chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count) */
2658
+ /** Chunk index in the expected chunks for this response (0 <= chunk\_index < chunk\_count) */
2594
2659
  readonly chunk_index: number;
2595
2660
  /** Total number of expected chunks for this response */
2596
2661
  readonly chunk_count: number;
@@ -2869,7 +2934,7 @@ export interface GuildTemplate {
2869
2934
  readonly updated_at: string;
2870
2935
  /** the ID of the guild this template is based on */
2871
2936
  readonly source_guild_id: Snowflake;
2872
- /** the guild snapshot this template contains */
2937
+ /** the guild snapshot this template contains; placeholder IDs are given as integers */
2873
2938
  readonly serialized_source_guild: Guild;
2874
2939
  /** whether the template has unsynced changes */
2875
2940
  readonly is_dirty?: boolean | null;
@@ -3439,7 +3504,7 @@ export interface Message {
3439
3504
  readonly message_snapshots: Array<MessageSnapshot>;
3440
3505
  /** the message associated with the message_reference */
3441
3506
  readonly referenced_message?: Message | null;
3442
- /** In preview. Sent if the message is sent as a result of an interaction */
3507
+ /** Sent if the message is sent as a result of an interaction */
3443
3508
  readonly interaction_metadata?: MessageInteractionMetadatum;
3444
3509
  /** Deprecated in favor of interaction_metadata; sent if the message is a response to an interaction */
3445
3510
  readonly interaction?: MessageInteraction;
@@ -3490,6 +3555,20 @@ export interface MessageComponentDatum {
3490
3555
  /** Resolved entities from selected options */
3491
3556
  readonly resolved?: ResolvedDatum;
3492
3557
  }
3558
+ export interface MessageComponentInteractionMetadatum {
3559
+ /** ID of the interaction */
3560
+ readonly id: Snowflake;
3561
+ /** Type of interaction */
3562
+ readonly type: InteractionType;
3563
+ /** User who triggered the interaction */
3564
+ readonly user: User;
3565
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
3566
+ readonly authorizing_integration_owners: ApplicationIntegrationType;
3567
+ /** ID of the original response message, present only on follow-up messages */
3568
+ readonly original_response_message_id?: Snowflake;
3569
+ /** ID of the message that contained the interactive component */
3570
+ readonly interacted_message_id: Snowflake;
3571
+ }
3493
3572
  export type MessageCreateEvent = Message & MessageCreateExtra;
3494
3573
  export interface MessageCreateExtra {
3495
3574
  /** ID of the guild the message was sent in - unless it is an ephemeral message */
@@ -3551,22 +3630,7 @@ export interface MessageInteraction {
3551
3630
  /** Member who invoked the interaction in the guild */
3552
3631
  readonly member?: GuildMember;
3553
3632
  }
3554
- export interface MessageInteractionMetadatum {
3555
- /** ID of the interaction */
3556
- readonly id: Snowflake;
3557
- /** Type of interaction */
3558
- readonly type: InteractionType;
3559
- /** User who triggered the interaction */
3560
- readonly user: User;
3561
- /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
3562
- readonly authorizing_integration_owners: ApplicationIntegrationType;
3563
- /** ID of the original response message, present only on follow-up messages */
3564
- readonly original_response_message_id?: Snowflake;
3565
- /** ID of the message that contained interactive component, present only on messages created from component interactions */
3566
- readonly interacted_message_id?: Snowflake;
3567
- /** Metadata for the interaction that was used to open the modal, present only on modal submit interactions */
3568
- readonly triggering_interaction_metadata?: MessageInteractionMetadatum;
3569
- }
3633
+ export type MessageInteractionMetadatum = ApplicationCommandInteractionMetadatum | MessageComponentInteractionMetadatum | ModalSubmitInteractionMetadatum;
3570
3634
  export interface MessagePollVoteAddEvent {
3571
3635
  /** ID of the user */
3572
3636
  readonly user_id: Snowflake;
@@ -3721,6 +3785,20 @@ export interface ModalSubmitDatum {
3721
3785
  /** Values submitted by the user */
3722
3786
  readonly components: Array<Component>;
3723
3787
  }
3788
+ export interface ModalSubmitInteractionMetadatum {
3789
+ /** ID of the interaction */
3790
+ readonly id: Snowflake;
3791
+ /** Type of interaction */
3792
+ readonly type: InteractionType;
3793
+ /** User who triggered the interaction */
3794
+ readonly user: User;
3795
+ /** IDs for installation context(s) related to an interaction. Details in Authorizing Integration Owners Object */
3796
+ readonly authorizing_integration_owners: ApplicationIntegrationType;
3797
+ /** ID of the original response message, present only on follow-up messages */
3798
+ readonly original_response_message_id?: Snowflake;
3799
+ /** Metadata for the interaction that was used to open the modal */
3800
+ readonly triggering_interaction_metadata: ApplicationCommandInteractionMetadatum;
3801
+ }
3724
3802
  export interface ModifyApplicationEmojiParams {
3725
3803
  /** name of the emoji */
3726
3804
  readonly name: string;
@@ -5296,6 +5374,12 @@ export interface WebhooksUpdateEvent {
5296
5374
  /** ID of the channel */
5297
5375
  readonly channel_id: Snowflake;
5298
5376
  }
5377
+ export declare enum WebhookType {
5378
+ /** PING event sent to verify your Webhook Event URL is active */
5379
+ PING = 0,
5380
+ /** Webhook event (details for event in event body object) */
5381
+ EVENT = 1
5382
+ }
5299
5383
  export declare enum WebhookType {
5300
5384
  /** Incoming Webhooks can post messages to channels with a generated token */
5301
5385
  INCOMING = 1,