dfx 0.99.0 → 0.100.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.
@@ -34,11 +34,11 @@ export class DiscordRESTError extends TypeIdError(
34
34
  DiscordRESTErrorTypeId,
35
35
  "DiscordRESTError",
36
36
  )<{
37
- error: HttpError.HttpClientError
37
+ cause: HttpError.HttpClientError
38
38
  body?: unknown
39
39
  }> {
40
40
  get message() {
41
- const httpMessage = this.error.message
41
+ const httpMessage = this.cause.message
42
42
  return this.body !== undefined
43
43
  ? `${httpMessage}: ${JSON.stringify(this.body)}`
44
44
  : httpMessage
@@ -158,15 +158,15 @@ const make = Effect.gen(function* () {
158
158
  }),
159
159
  ),
160
160
  ),
161
- HttpClient.catchAll(error =>
162
- error.reason === "StatusCode"
163
- ? error.response.json.pipe(
164
- Effect.mapError(_ => new DiscordRESTError({ error })),
161
+ HttpClient.catchAll(cause =>
162
+ cause.reason === "StatusCode"
163
+ ? cause.response.json.pipe(
164
+ Effect.mapError(_ => new DiscordRESTError({ cause })),
165
165
  Effect.flatMap(body =>
166
- Effect.fail(new DiscordRESTError({ error, body })),
166
+ Effect.fail(new DiscordRESTError({ cause, body })),
167
167
  ),
168
168
  )
169
- : Effect.fail(new DiscordRESTError({ error })),
169
+ : Effect.fail(new DiscordRESTError({ cause })),
170
170
  ),
171
171
  )
172
172
 
@@ -184,11 +184,11 @@ const make = Effect.gen(function* () {
184
184
  ),
185
185
  Effect.tap(response => updateBuckets(request, response)),
186
186
  Effect.catchTag("DiscordRESTError", e => {
187
- if (e.error.reason !== "StatusCode") {
187
+ if (e.cause.reason !== "StatusCode") {
188
188
  return Effect.fail(e)
189
189
  }
190
190
 
191
- const response = e.error.response
191
+ const response = e.cause.response
192
192
 
193
193
  switch (response.status) {
194
194
  case 403:
package/src/types.ts CHANGED
@@ -149,6 +149,12 @@ export enum AllowedMentionType {
149
149
  /** Controls @everyone and @here mentions */
150
150
  EVERYONE_MENTIONS = "everyone",
151
151
  }
152
+ export enum AnimationType {
153
+ /** A fun animation, sent by a Nitro subscriber */
154
+ PREMIUM = 0,
155
+ /** The standard animation */
156
+ BASIC = 1,
157
+ }
152
158
  export interface Application {
153
159
  /** ID of the app */
154
160
  readonly id: Snowflake
@@ -192,6 +198,8 @@ export interface Application {
192
198
  readonly flags?: number
193
199
  /** Approximate count of guilds the app has been added to */
194
200
  readonly approximate_guild_count?: number
201
+ /** Approximate count of users that have installed the app */
202
+ readonly approximate_user_install_count?: number
195
203
  /** Array of redirect URIs for the app */
196
204
  readonly redirect_uris?: Array<string>
197
205
  /** Interactions endpoint URL for the app */
@@ -2032,6 +2040,12 @@ export function createRoutes<O = any>(
2032
2040
  params,
2033
2041
  options,
2034
2042
  }),
2043
+ getGuildRole: (guildId, roleId, options) =>
2044
+ fetch({
2045
+ method: "GET",
2046
+ url: `/guilds/${guildId}/roles/${roleId}`,
2047
+ options,
2048
+ }),
2035
2049
  getGuildRoles: (guildId, options) =>
2036
2050
  fetch({
2037
2051
  method: "GET",
@@ -2162,6 +2176,12 @@ export function createRoutes<O = any>(
2162
2176
  url: `/stickers/${stickerId}`,
2163
2177
  options,
2164
2178
  }),
2179
+ getStickerPack: (packId, options) =>
2180
+ fetch({
2181
+ method: "GET",
2182
+ url: `/sticker-packs/${packId}`,
2183
+ options,
2184
+ }),
2165
2185
  getThreadMember: (channelId, userId, params, options) =>
2166
2186
  fetch({
2167
2187
  method: "GET",
@@ -2835,6 +2855,8 @@ export enum EmbedType {
2835
2855
  ARTICLE = "article",
2836
2856
  /** link embed */
2837
2857
  LINK = "link",
2858
+ /** poll result embed */
2859
+ POLL_RESULT = "poll_result",
2838
2860
  }
2839
2861
  export interface EmbedVideo {
2840
2862
  /** source url of video */
@@ -3499,6 +3521,12 @@ If the user is not in the guild, then the guild must be discoverable. */
3499
3521
  params?: Partial<GetGuildPruneCountParams>,
3500
3522
  options?: O,
3501
3523
  ) => RestResponse<any>
3524
+ /** Returns a role object for the specified role. */
3525
+ getGuildRole: (
3526
+ guildId: string,
3527
+ roleId: string,
3528
+ options?: O,
3529
+ ) => RestResponse<Role>
3502
3530
  /** Returns a list of role objects for the guild. */
3503
3531
  getGuildRoles: (guildId: string, options?: O) => RestResponse<Array<Role>>
3504
3532
  /** Get a guild scheduled event. Returns a guild scheduled event object on success. */
@@ -3592,6 +3620,8 @@ The emoji must be URL Encoded or the request will fail with 10014: Unknown Emoji
3592
3620
  getStageInstance: (channelId: string, options?: O) => RestResponse<any>
3593
3621
  /** Returns a sticker object for the given sticker ID. */
3594
3622
  getSticker: (stickerId: string, options?: O) => RestResponse<Sticker>
3623
+ /** Returns a sticker pack object for the given sticker pack ID. */
3624
+ getStickerPack: (packId: string, options?: O) => RestResponse<StickerPack>
3595
3625
  /** Returns a thread member object for the specified user if they are a member of the thread, returns a 404 response otherwise. */
3596
3626
  getThreadMember: (
3597
3627
  channelId: string,
@@ -4689,7 +4719,7 @@ export interface GuildScheduledEventRecurrenceRule {
4689
4719
  readonly end?: string | null
4690
4720
  /** How often the event occurs */
4691
4721
  readonly frequency: GuildScheduledEventRecurrenceRuleFrequency
4692
- /** The spacing between the events, defined by frequency. For example, frecency of WEEKLY and an interval of 2 would be "every-other week" */
4722
+ /** The spacing between the events, defined by frequency. For example, frequency of WEEKLY and an interval of 2 would be "every-other week" */
4693
4723
  readonly interval: number
4694
4724
  /** Set of specific days within a week for the event to recur on */
4695
4725
  readonly by_weekday?: Array<GuildScheduledEventRecurrenceRuleWeekday> | null
@@ -5606,6 +5636,7 @@ export enum MessageType {
5606
5636
  GUILD_INCIDENT_REPORT_RAID = 38,
5607
5637
  GUILD_INCIDENT_REPORT_FALSE_ALARM = 39,
5608
5638
  PURCHASE_NOTIFICATION = 44,
5639
+ POLL_RESULT = 46,
5609
5640
  }
5610
5641
  export type MessageUpdateEvent = MessageCreateEvent
5611
5642
  export enum MfaLevel {
@@ -5866,7 +5897,7 @@ export interface ModifyGuildScheduledEventParams {
5866
5897
  /** the cover image of the scheduled event */
5867
5898
  readonly image?: string
5868
5899
  /** the definition for how often this event should recur */
5869
- readonly recurrence_rule?: GuildScheduledEventRecurrenceRule
5900
+ readonly recurrence_rule?: GuildScheduledEventRecurrenceRule | null
5870
5901
  }
5871
5902
  export interface ModifyGuildStickerParams {
5872
5903
  /** name of the sticker (2-30 characters) */
@@ -6321,6 +6352,7 @@ export type ReceiveEvent =
6321
6352
  | StageInstanceDeleteEvent
6322
6353
  | TypingStartEvent
6323
6354
  | UserUpdateEvent
6355
+ | VoiceChannelEffectSendEvent
6324
6356
  | VoiceStateUpdateEvent
6325
6357
  | VoiceServerUpdateEvent
6326
6358
  | WebhooksUpdateEvent
@@ -6391,6 +6423,7 @@ export interface ReceiveEvents {
6391
6423
  STAGE_INSTANCE_DELETE: StageInstanceDeleteEvent
6392
6424
  TYPING_START: TypingStartEvent
6393
6425
  USER_UPDATE: UserUpdateEvent
6426
+ VOICE_CHANNEL_EFFECT_SEND: VoiceChannelEffectSendEvent
6394
6427
  VOICE_STATE_UPDATE: VoiceStateUpdateEvent
6395
6428
  VOICE_SERVER_UPDATE: VoiceServerUpdateEvent
6396
6429
  WEBHOOKS_UPDATE: WebhooksUpdateEvent
@@ -7043,6 +7076,24 @@ export enum VisibilityType {
7043
7076
  /** visible to everyone */
7044
7077
  EVERYONE = 1,
7045
7078
  }
7079
+ export interface VoiceChannelEffectSendEvent {
7080
+ /** ID of the channel the effect was sent in */
7081
+ readonly channel_id: Snowflake
7082
+ /** ID of the guild the effect was sent in */
7083
+ readonly guild_id: Snowflake
7084
+ /** ID of the user who sent the effect */
7085
+ readonly user_id: Snowflake
7086
+ /** The emoji sent, for emoji reaction and soundboard effects */
7087
+ readonly emoji?: Emoji | null
7088
+ /** The type of emoji animation, for emoji reaction and soundboard effects */
7089
+ readonly animation_type?: AnimationType | null
7090
+ /** The ID of the emoji animation, for emoji reaction and soundboard effects */
7091
+ readonly animation_id?: number
7092
+ /** The ID of the soundboard sound, for soundboard effects */
7093
+ readonly sound_id?: Snowflake
7094
+ /** The volume of the soundboard sound, from 0 to 1, for soundboard effects */
7095
+ readonly sound_volume?: number
7096
+ }
7046
7097
  export enum VoiceOpcode {
7047
7098
  /** Begin a voice websocket connection. */
7048
7099
  IDENTIFY = 0,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "0.99.0";
1
+ export const LIB_VERSION = "0.100.0";
package/types.d.ts CHANGED
@@ -148,6 +148,12 @@ export declare enum AllowedMentionType {
148
148
  /** Controls @everyone and @here mentions */
149
149
  EVERYONE_MENTIONS = "everyone"
150
150
  }
151
+ export declare enum AnimationType {
152
+ /** A fun animation, sent by a Nitro subscriber */
153
+ PREMIUM = 0,
154
+ /** The standard animation */
155
+ BASIC = 1
156
+ }
151
157
  export interface Application {
152
158
  /** ID of the app */
153
159
  readonly id: Snowflake;
@@ -191,6 +197,8 @@ export interface Application {
191
197
  readonly flags?: number;
192
198
  /** Approximate count of guilds the app has been added to */
193
199
  readonly approximate_guild_count?: number;
200
+ /** Approximate count of users that have installed the app */
201
+ readonly approximate_user_install_count?: number;
194
202
  /** Array of redirect URIs for the app */
195
203
  readonly redirect_uris?: Array<string>;
196
204
  /** Interactions endpoint URL for the app */
@@ -1473,7 +1481,9 @@ export declare enum EmbedType {
1473
1481
  /** article embed */
1474
1482
  ARTICLE = "article",
1475
1483
  /** link embed */
1476
- LINK = "link"
1484
+ LINK = "link",
1485
+ /** poll result embed */
1486
+ POLL_RESULT = "poll_result"
1477
1487
  }
1478
1488
  export interface EmbedVideo {
1479
1489
  /** source url of video */
@@ -1723,6 +1733,8 @@ export interface Endpoints<O> {
1723
1733
  getGuildPreview: (guildId: string, options?: O) => RestResponse<GuildPreview>;
1724
1734
  /** Returns an object with one pruned key indicating the number of members that would be removed in a prune operation. Requires the MANAGE_GUILD and KICK_MEMBERS permissions. */
1725
1735
  getGuildPruneCount: (guildId: string, params?: Partial<GetGuildPruneCountParams>, options?: O) => RestResponse<any>;
1736
+ /** Returns a role object for the specified role. */
1737
+ getGuildRole: (guildId: string, roleId: string, options?: O) => RestResponse<Role>;
1726
1738
  /** Returns a list of role objects for the guild. */
1727
1739
  getGuildRoles: (guildId: string, options?: O) => RestResponse<Array<Role>>;
1728
1740
  /** Get a guild scheduled event. Returns a guild scheduled event object on success. */
@@ -1762,6 +1774,8 @@ export interface Endpoints<O> {
1762
1774
  getStageInstance: (channelId: string, options?: O) => RestResponse<any>;
1763
1775
  /** Returns a sticker object for the given sticker ID. */
1764
1776
  getSticker: (stickerId: string, options?: O) => RestResponse<Sticker>;
1777
+ /** Returns a sticker pack object for the given sticker pack ID. */
1778
+ getStickerPack: (packId: string, options?: O) => RestResponse<StickerPack>;
1765
1779
  /** Returns a thread member object for the specified user if they are a member of the thread, returns a 404 response otherwise. */
1766
1780
  getThreadMember: (channelId: string, userId: string, params?: Partial<GetThreadMemberParams>, options?: O) => RestResponse<ThreadMember>;
1767
1781
  /** Returns a user object for a given user ID. */
@@ -2639,7 +2653,7 @@ export interface GuildScheduledEventRecurrenceRule {
2639
2653
  readonly end?: string | null;
2640
2654
  /** How often the event occurs */
2641
2655
  readonly frequency: GuildScheduledEventRecurrenceRuleFrequency;
2642
- /** The spacing between the events, defined by frequency. For example, frecency of WEEKLY and an interval of 2 would be "every-other week" */
2656
+ /** The spacing between the events, defined by frequency. For example, frequency of WEEKLY and an interval of 2 would be "every-other week" */
2643
2657
  readonly interval: number;
2644
2658
  /** Set of specific days within a week for the event to recur on */
2645
2659
  readonly by_weekday?: Array<GuildScheduledEventRecurrenceRuleWeekday> | null;
@@ -3547,7 +3561,8 @@ export declare enum MessageType {
3547
3561
  GUILD_INCIDENT_ALERT_MODE_DISABLED = 37,
3548
3562
  GUILD_INCIDENT_REPORT_RAID = 38,
3549
3563
  GUILD_INCIDENT_REPORT_FALSE_ALARM = 39,
3550
- PURCHASE_NOTIFICATION = 44
3564
+ PURCHASE_NOTIFICATION = 44,
3565
+ POLL_RESULT = 46
3551
3566
  }
3552
3567
  export type MessageUpdateEvent = MessageCreateEvent;
3553
3568
  export declare enum MfaLevel {
@@ -3805,7 +3820,7 @@ export interface ModifyGuildScheduledEventParams {
3805
3820
  /** the cover image of the scheduled event */
3806
3821
  readonly image?: string;
3807
3822
  /** the definition for how often this event should recur */
3808
- readonly recurrence_rule?: GuildScheduledEventRecurrenceRule;
3823
+ readonly recurrence_rule?: GuildScheduledEventRecurrenceRule | null;
3809
3824
  }
3810
3825
  export interface ModifyGuildStickerParams {
3811
3826
  /** name of the sticker (2-30 characters) */
@@ -4195,7 +4210,7 @@ export interface ReadyEvent {
4195
4210
  /** Contains id and flags */
4196
4211
  readonly application: Application;
4197
4212
  }
4198
- export type ReceiveEvent = HelloEvent | ReadyEvent | ResumedEvent | ReconnectEvent | InvalidSessionEvent | ApplicationCommandPermissionsUpdateEvent | AutoModerationRuleCreateEvent | AutoModerationRuleUpdateEvent | AutoModerationRuleDeleteEvent | AutoModerationActionExecutionEvent | ChannelCreateEvent | ChannelUpdateEvent | ChannelDeleteEvent | ChannelPinsUpdateEvent | ThreadCreateEvent | ThreadUpdateEvent | ThreadDeleteEvent | ThreadListSyncEvent | ThreadMemberUpdateEvent | ThreadMembersUpdateEvent | EntitlementCreateEvent | EntitlementUpdateEvent | EntitlementDeleteEvent | GuildCreateEvent | GuildUpdateEvent | GuildDeleteEvent | GuildAuditLogEntryCreateEvent | GuildBanAddEvent | GuildBanRemoveEvent | GuildEmojisUpdateEvent | GuildStickersUpdateEvent | GuildIntegrationsUpdateEvent | GuildMemberAddEvent | GuildMemberRemoveEvent | GuildMemberUpdateEvent | GuildMembersChunkEvent | GuildRoleCreateEvent | GuildRoleUpdateEvent | GuildRoleDeleteEvent | GuildScheduledEventCreateEvent | GuildScheduledEventUpdateEvent | GuildScheduledEventDeleteEvent | GuildScheduledEventUserAddEvent | GuildScheduledEventUserRemoveEvent | IntegrationCreateEvent | IntegrationUpdateEvent | IntegrationDeleteEvent | InteractionCreateEvent | InviteCreateEvent | InviteDeleteEvent | MessageCreateEvent | MessageUpdateEvent | MessageDeleteEvent | MessageDeleteBulkEvent | MessageReactionAddEvent | MessageReactionRemoveEvent | MessageReactionRemoveAllEvent | MessageReactionRemoveEmojiEvent | PresenceUpdateEvent | StageInstanceCreateEvent | StageInstanceUpdateEvent | StageInstanceDeleteEvent | TypingStartEvent | UserUpdateEvent | VoiceStateUpdateEvent | VoiceServerUpdateEvent | WebhooksUpdateEvent | MessagePollVoteAddEvent | MessagePollVoteRemoveEvent;
4213
+ export type ReceiveEvent = HelloEvent | ReadyEvent | ResumedEvent | ReconnectEvent | InvalidSessionEvent | ApplicationCommandPermissionsUpdateEvent | AutoModerationRuleCreateEvent | AutoModerationRuleUpdateEvent | AutoModerationRuleDeleteEvent | AutoModerationActionExecutionEvent | ChannelCreateEvent | ChannelUpdateEvent | ChannelDeleteEvent | ChannelPinsUpdateEvent | ThreadCreateEvent | ThreadUpdateEvent | ThreadDeleteEvent | ThreadListSyncEvent | ThreadMemberUpdateEvent | ThreadMembersUpdateEvent | EntitlementCreateEvent | EntitlementUpdateEvent | EntitlementDeleteEvent | GuildCreateEvent | GuildUpdateEvent | GuildDeleteEvent | GuildAuditLogEntryCreateEvent | GuildBanAddEvent | GuildBanRemoveEvent | GuildEmojisUpdateEvent | GuildStickersUpdateEvent | GuildIntegrationsUpdateEvent | GuildMemberAddEvent | GuildMemberRemoveEvent | GuildMemberUpdateEvent | GuildMembersChunkEvent | GuildRoleCreateEvent | GuildRoleUpdateEvent | GuildRoleDeleteEvent | GuildScheduledEventCreateEvent | GuildScheduledEventUpdateEvent | GuildScheduledEventDeleteEvent | GuildScheduledEventUserAddEvent | GuildScheduledEventUserRemoveEvent | IntegrationCreateEvent | IntegrationUpdateEvent | IntegrationDeleteEvent | InteractionCreateEvent | InviteCreateEvent | InviteDeleteEvent | MessageCreateEvent | MessageUpdateEvent | MessageDeleteEvent | MessageDeleteBulkEvent | MessageReactionAddEvent | MessageReactionRemoveEvent | MessageReactionRemoveAllEvent | MessageReactionRemoveEmojiEvent | PresenceUpdateEvent | StageInstanceCreateEvent | StageInstanceUpdateEvent | StageInstanceDeleteEvent | TypingStartEvent | UserUpdateEvent | VoiceChannelEffectSendEvent | VoiceStateUpdateEvent | VoiceServerUpdateEvent | WebhooksUpdateEvent | MessagePollVoteAddEvent | MessagePollVoteRemoveEvent;
4199
4214
  export interface ReceiveEvents {
4200
4215
  HELLO: HelloEvent;
4201
4216
  READY: ReadyEvent;
@@ -4261,6 +4276,7 @@ export interface ReceiveEvents {
4261
4276
  STAGE_INSTANCE_DELETE: StageInstanceDeleteEvent;
4262
4277
  TYPING_START: TypingStartEvent;
4263
4278
  USER_UPDATE: UserUpdateEvent;
4279
+ VOICE_CHANNEL_EFFECT_SEND: VoiceChannelEffectSendEvent;
4264
4280
  VOICE_STATE_UPDATE: VoiceStateUpdateEvent;
4265
4281
  VOICE_SERVER_UPDATE: VoiceServerUpdateEvent;
4266
4282
  WEBHOOKS_UPDATE: WebhooksUpdateEvent;
@@ -4907,6 +4923,24 @@ export declare enum VisibilityType {
4907
4923
  /** visible to everyone */
4908
4924
  EVERYONE = 1
4909
4925
  }
4926
+ export interface VoiceChannelEffectSendEvent {
4927
+ /** ID of the channel the effect was sent in */
4928
+ readonly channel_id: Snowflake;
4929
+ /** ID of the guild the effect was sent in */
4930
+ readonly guild_id: Snowflake;
4931
+ /** ID of the user who sent the effect */
4932
+ readonly user_id: Snowflake;
4933
+ /** The emoji sent, for emoji reaction and soundboard effects */
4934
+ readonly emoji?: Emoji | null;
4935
+ /** The type of emoji animation, for emoji reaction and soundboard effects */
4936
+ readonly animation_type?: AnimationType | null;
4937
+ /** The ID of the emoji animation, for emoji reaction and soundboard effects */
4938
+ readonly animation_id?: number;
4939
+ /** The ID of the soundboard sound, for soundboard effects */
4940
+ readonly sound_id?: Snowflake;
4941
+ /** The volume of the soundboard sound, from 0 to 1, for soundboard effects */
4942
+ readonly sound_volume?: number;
4943
+ }
4910
4944
  export declare enum VoiceOpcode {
4911
4945
  /** Begin a voice websocket connection. */
4912
4946
  IDENTIFY = 0,