disgroove 2.2.7-dev.fca4921 → 3.0.0-dev.2cf2b90
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/LICENSE +9 -9
- package/README.md +48 -48
- package/dist/lib/Client.d.ts +332 -301
- package/dist/lib/Client.js +562 -462
- package/dist/lib/constants.d.ts +35 -24
- package/dist/lib/constants.js +39 -27
- package/dist/lib/gateway/Dispatcher.d.ts +104 -0
- package/dist/lib/gateway/Dispatcher.js +471 -0
- package/dist/lib/gateway/Shard.d.ts +12 -21
- package/dist/lib/gateway/Shard.js +121 -570
- package/dist/lib/gateway/Transmitter.d.ts +22 -0
- package/dist/lib/gateway/Transmitter.js +93 -0
- package/dist/lib/gateway/WebSocketManager.d.ts +22 -0
- package/dist/lib/gateway/WebSocketManager.js +93 -0
- package/dist/lib/index.d.ts +5 -1
- package/dist/lib/index.js +5 -1
- package/dist/lib/rest/Endpoints.d.ts +95 -91
- package/dist/lib/rest/Endpoints.js +111 -102
- package/dist/lib/rest/RequestManager.d.ts +1 -3
- package/dist/lib/rest/RequestManager.js +17 -7
- package/dist/lib/rest/index.js +17 -7
- package/dist/lib/transformers/ApplicationCommands.js +4 -4
- package/dist/lib/transformers/Applications.d.ts +2 -0
- package/dist/lib/transformers/Applications.js +110 -4
- package/dist/lib/transformers/AuditLogs.js +10 -10
- package/dist/lib/transformers/AutoModeration.js +6 -6
- package/dist/lib/transformers/Channels.js +16 -16
- package/dist/lib/transformers/Components.d.ts +15 -3
- package/dist/lib/transformers/Components.js +309 -156
- package/dist/lib/transformers/Entitlements.d.ts +2 -2
- package/dist/lib/transformers/Entitlements.js +16 -16
- package/dist/lib/transformers/GuildScheduledEvents.js +8 -8
- package/dist/lib/transformers/GuildTemplates.js +4 -4
- package/dist/lib/transformers/Guilds.js +28 -28
- package/dist/lib/transformers/Interactions.js +330 -55
- package/dist/lib/transformers/Lobbies.d.ts +7 -0
- package/dist/lib/transformers/Lobbies.js +38 -0
- package/dist/lib/transformers/Messages.d.ts +4 -3
- package/dist/lib/transformers/Messages.js +38 -52
- package/dist/lib/transformers/Polls.js +2 -2
- package/dist/lib/transformers/Presences.d.ts +3 -3
- package/dist/lib/transformers/Presences.js +6 -6
- package/dist/lib/transformers/Roles.js +8 -8
- package/dist/lib/transformers/SKUs.js +2 -2
- package/dist/lib/transformers/Soundboards.js +6 -6
- package/dist/lib/transformers/StageInstances.js +6 -6
- package/dist/lib/transformers/Stickers.js +3 -3
- package/dist/lib/transformers/Subscriptions.js +8 -8
- package/dist/lib/transformers/Teams.js +4 -4
- package/dist/lib/transformers/Users.js +6 -6
- package/dist/lib/transformers/Voice.js +8 -8
- package/dist/lib/transformers/Webhooks.js +6 -6
- package/dist/lib/transformers/index.d.ts +2 -1
- package/dist/lib/transformers/index.js +2 -1
- package/dist/lib/types/application-command.d.ts +9 -4
- package/dist/lib/types/application-role-connection-metadata.d.ts +1 -0
- package/dist/lib/types/application.d.ts +12 -7
- package/dist/lib/types/audit-log.d.ts +9 -5
- package/dist/lib/types/auto-moderation.d.ts +7 -3
- package/dist/lib/types/channel.d.ts +17 -23
- package/dist/lib/types/common.d.ts +2 -0
- package/dist/lib/types/components.d.ts +510 -0
- package/dist/lib/types/emoji.d.ts +1 -0
- package/dist/lib/types/entitlements.d.ts +5 -4
- package/dist/lib/types/gateway-events.d.ts +406 -207
- package/dist/lib/types/guild-scheduled-event.d.ts +10 -5
- package/dist/lib/types/guild-template.d.ts +3 -2
- package/dist/lib/types/guild.d.ts +40 -22
- package/dist/lib/types/interaction.d.ts +35 -18
- package/dist/lib/types/invite.d.ts +5 -2
- package/dist/lib/types/lobby.d.ts +31 -0
- package/dist/lib/types/lobby.js +2 -0
- package/dist/lib/types/message.d.ts +32 -20
- package/dist/lib/types/poll.d.ts +7 -1
- package/dist/lib/types/role.d.ts +8 -5
- package/dist/lib/types/sku.d.ts +2 -1
- package/dist/lib/types/soundboard.d.ts +4 -3
- package/dist/lib/types/stage-instance.d.ts +4 -3
- package/dist/lib/types/sticker.d.ts +8 -5
- package/dist/lib/types/subscription.d.ts +6 -5
- package/dist/lib/types/team.d.ts +4 -2
- package/dist/lib/types/user.d.ts +10 -3
- package/dist/lib/types/voice.d.ts +6 -4
- package/dist/lib/types/webhook.d.ts +4 -3
- package/dist/lib/utils/CDN.d.ts +22 -22
- package/dist/lib/utils/CDN.js +22 -22
- package/dist/lib/utils/errors.d.ts +3 -1
- package/dist/lib/utils/errors.js +4 -0
- package/dist/lib/utils/formatters.d.ts +7 -7
- package/dist/lib/utils/formatters.js +28 -29
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +18 -7
- package/dist/lib/utils/permissions.d.ts +2 -0
- package/dist/lib/utils/permissions.js +7 -0
- package/dist/package.json +4 -4
- package/package.json +5 -5
- package/dist/lib/types/message-components.d.ts +0 -234
- /package/dist/lib/types/{message-components.js → components.js} +0 -0
package/dist/lib/types/poll.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export interface RawPollAnswerCount {
|
|
|
38
38
|
count: number;
|
|
39
39
|
me_voted: boolean;
|
|
40
40
|
}
|
|
41
|
+
/** https://discord.com/developers/docs/resources/poll#poll-object-poll-object-structure */
|
|
41
42
|
export interface Poll {
|
|
42
43
|
question: PollMedia;
|
|
43
44
|
answers: Array<PollAnswer>;
|
|
@@ -46,6 +47,7 @@ export interface Poll {
|
|
|
46
47
|
layoutType: LayoutType;
|
|
47
48
|
results?: PollResults;
|
|
48
49
|
}
|
|
50
|
+
/** https://discord.com/developers/docs/resources/poll#poll-create-request-object-poll-create-request-object-structure */
|
|
49
51
|
export interface PollCreateParams {
|
|
50
52
|
question: PollMedia;
|
|
51
53
|
answers: Array<PollAnswer>;
|
|
@@ -53,18 +55,22 @@ export interface PollCreateParams {
|
|
|
53
55
|
allowMultiselect?: boolean;
|
|
54
56
|
layoutType?: LayoutType;
|
|
55
57
|
}
|
|
58
|
+
/** https://discord.com/developers/docs/resources/poll#poll-media-object-poll-media-object-structure */
|
|
56
59
|
export interface PollMedia {
|
|
57
60
|
text?: string;
|
|
58
61
|
emoji?: Pick<Emoji, "id" | "name">;
|
|
59
62
|
}
|
|
63
|
+
/** https://discord.com/developers/docs/resources/poll#poll-answer-object-poll-answer-object-structure */
|
|
60
64
|
export interface PollAnswer {
|
|
61
|
-
|
|
65
|
+
answerId: number;
|
|
62
66
|
pollMedia: PollMedia;
|
|
63
67
|
}
|
|
68
|
+
/** https://discord.com/developers/docs/resources/poll#poll-results-object-poll-results-object-structure */
|
|
64
69
|
export interface PollResults {
|
|
65
70
|
isFinalized: boolean;
|
|
66
71
|
answerCounts: Array<PollAnswerCount>;
|
|
67
72
|
}
|
|
73
|
+
/** https://discord.com/developers/docs/resources/poll#poll-results-object-poll-answer-count-object-structure */
|
|
68
74
|
export interface PollAnswerCount {
|
|
69
75
|
id: number;
|
|
70
76
|
count: number;
|
package/dist/lib/types/role.d.ts
CHANGED
|
@@ -29,8 +29,9 @@ export interface RawRoleTags {
|
|
|
29
29
|
export interface RawRoleColors {
|
|
30
30
|
primary_color: number;
|
|
31
31
|
secondary_color: number | null;
|
|
32
|
-
|
|
32
|
+
tertiary_color: number | null;
|
|
33
33
|
}
|
|
34
|
+
/** https://discord.com/developers/docs/topics/permissions#role-object-role-structure */
|
|
34
35
|
export interface Role {
|
|
35
36
|
id: snowflake;
|
|
36
37
|
name: string;
|
|
@@ -46,16 +47,18 @@ export interface Role {
|
|
|
46
47
|
tags?: RoleTags;
|
|
47
48
|
flags: RoleFlags;
|
|
48
49
|
}
|
|
50
|
+
/** https://discord.com/developers/docs/topics/permissions#role-object-role-tags-structure */
|
|
49
51
|
export interface RoleTags {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
botId?: snowflake;
|
|
53
|
+
integrationId?: snowflake;
|
|
52
54
|
premiumSubscriber?: null;
|
|
53
|
-
|
|
55
|
+
subscriptionListingId?: snowflake;
|
|
54
56
|
availableForPurchase?: null;
|
|
55
57
|
guildConnections?: null;
|
|
56
58
|
}
|
|
59
|
+
/** https://discord.com/developers/docs/topics/permissions#role-object-role-colors-object */
|
|
57
60
|
export interface RoleColors {
|
|
58
61
|
primaryColor: number;
|
|
59
62
|
secondaryColor: number | null;
|
|
60
|
-
|
|
63
|
+
tertiaryColor: number | null;
|
|
61
64
|
}
|
package/dist/lib/types/sku.d.ts
CHANGED
|
@@ -9,10 +9,11 @@ export interface RawSKU {
|
|
|
9
9
|
slug: string;
|
|
10
10
|
flags: SKUFlags;
|
|
11
11
|
}
|
|
12
|
+
/** https://discord.com/developers/docs/resources/sku#sku-object-sku-structure */
|
|
12
13
|
export interface SKU {
|
|
13
14
|
id: snowflake;
|
|
14
15
|
type: SKUTypes;
|
|
15
|
-
|
|
16
|
+
applicationId: snowflake;
|
|
16
17
|
name: string;
|
|
17
18
|
slug: string;
|
|
18
19
|
flags: SKUFlags;
|
|
@@ -11,13 +11,14 @@ export interface RawSoundboardSound {
|
|
|
11
11
|
available: boolean;
|
|
12
12
|
user?: RawUser;
|
|
13
13
|
}
|
|
14
|
+
/** https://discord.com/developers/docs/resources/soundboard#soundboard-sound-structure */
|
|
14
15
|
export interface SoundboardSound {
|
|
15
16
|
name: string;
|
|
16
|
-
|
|
17
|
+
soundId: snowflake;
|
|
17
18
|
volume: number;
|
|
18
|
-
|
|
19
|
+
emojiId: snowflake | null;
|
|
19
20
|
emojiName: string | null;
|
|
20
|
-
|
|
21
|
+
guildId?: snowflake;
|
|
21
22
|
available: boolean;
|
|
22
23
|
user?: User;
|
|
23
24
|
}
|
|
@@ -10,12 +10,13 @@ export interface RawStageInstance {
|
|
|
10
10
|
discoverable_disabled: boolean;
|
|
11
11
|
guild_scheduled_event_id: snowflake | null;
|
|
12
12
|
}
|
|
13
|
+
/** https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-stage-instance-structure */
|
|
13
14
|
export interface StageInstance {
|
|
14
15
|
id: snowflake;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
guildId: snowflake;
|
|
17
|
+
channelId: snowflake;
|
|
17
18
|
topic: string;
|
|
18
19
|
privacyLevel: PrivacyLevel;
|
|
19
20
|
discoverableDisabled: boolean;
|
|
20
|
-
|
|
21
|
+
guildScheduledEventId: snowflake | null;
|
|
21
22
|
}
|
|
@@ -31,30 +31,33 @@ export interface RawStickerPack {
|
|
|
31
31
|
description: string;
|
|
32
32
|
banner_asset_id?: snowflake;
|
|
33
33
|
}
|
|
34
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure */
|
|
34
35
|
export interface Sticker {
|
|
35
36
|
id: snowflake;
|
|
36
|
-
|
|
37
|
+
packId?: snowflake;
|
|
37
38
|
name: string;
|
|
38
39
|
description: string | null;
|
|
39
40
|
tags: string;
|
|
40
41
|
type: StickerTypes;
|
|
41
42
|
formatType: StickerFormatTypes;
|
|
42
43
|
available?: boolean;
|
|
43
|
-
|
|
44
|
+
guildId?: snowflake;
|
|
44
45
|
user?: User;
|
|
45
46
|
sortValue?: number;
|
|
46
47
|
}
|
|
48
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-item-object-sticker-item-structure */
|
|
47
49
|
export interface StickerItem {
|
|
48
50
|
id: snowflake;
|
|
49
51
|
name: string;
|
|
50
52
|
formatType: StickerFormatTypes;
|
|
51
53
|
}
|
|
54
|
+
/** https://discord.com/developers/docs/resources/sticker#sticker-pack-object-sticker-pack-structure */
|
|
52
55
|
export interface StickerPack {
|
|
53
56
|
id: snowflake;
|
|
54
57
|
stickers: Array<Sticker>;
|
|
55
58
|
name: string;
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
skuId: snowflake;
|
|
60
|
+
coverStickerId?: snowflake;
|
|
58
61
|
description: string;
|
|
59
|
-
|
|
62
|
+
bannerAssetId?: snowflake;
|
|
60
63
|
}
|
|
@@ -6,19 +6,20 @@ export interface RawSubscription {
|
|
|
6
6
|
user_id: snowflake;
|
|
7
7
|
sku_ids: Array<snowflake>;
|
|
8
8
|
entitlement_ids: Array<snowflake>;
|
|
9
|
-
renewal_sku_ids: Array<snowflake
|
|
9
|
+
renewal_sku_ids: Array<snowflake> | null;
|
|
10
10
|
current_period_start: timestamp;
|
|
11
11
|
current_period_end: timestamp;
|
|
12
12
|
status: SubscriptionStatuses;
|
|
13
13
|
canceled_at: timestamp | null;
|
|
14
14
|
country?: string;
|
|
15
15
|
}
|
|
16
|
+
/** https://discord.com/developers/docs/resources/subscription#subscription-object */
|
|
16
17
|
export interface Subscription {
|
|
17
18
|
id: snowflake;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
userId: snowflake;
|
|
20
|
+
skuIds: Array<snowflake>;
|
|
21
|
+
entitlementIds: Array<snowflake>;
|
|
22
|
+
renewalSKUIds: Array<snowflake> | null;
|
|
22
23
|
currentPeriodStart: timestamp;
|
|
23
24
|
currentPeriodEnd: timestamp;
|
|
24
25
|
status: SubscriptionStatuses;
|
package/dist/lib/types/team.d.ts
CHANGED
|
@@ -16,16 +16,18 @@ export interface RawTeamMember {
|
|
|
16
16
|
user: RawUser;
|
|
17
17
|
role: TeamMemberRoleTypes;
|
|
18
18
|
}
|
|
19
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-team-object */
|
|
19
20
|
export interface Team {
|
|
20
21
|
icon: string | null;
|
|
21
22
|
id: snowflake;
|
|
22
23
|
members: Array<TeamMember>;
|
|
23
24
|
name: string;
|
|
24
|
-
|
|
25
|
+
ownerUserId: snowflake;
|
|
25
26
|
}
|
|
27
|
+
/** https://discord.com/developers/docs/topics/teams#data-models-team-member-object */
|
|
26
28
|
export interface TeamMember {
|
|
27
29
|
membershipState: number;
|
|
28
|
-
|
|
30
|
+
teamId: snowflake;
|
|
29
31
|
user: User;
|
|
30
32
|
role: TeamMemberRoleTypes;
|
|
31
33
|
}
|
package/dist/lib/types/user.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export interface RawApplicationRoleConnection {
|
|
|
66
66
|
platform_username: string | null;
|
|
67
67
|
metadata: RawApplicationRoleConnectionMetadata;
|
|
68
68
|
}
|
|
69
|
+
/** https://discord.com/developers/docs/resources/user#user-object-user-structure */
|
|
69
70
|
export interface User {
|
|
70
71
|
id: snowflake;
|
|
71
72
|
username: string;
|
|
@@ -87,25 +88,30 @@ export interface User {
|
|
|
87
88
|
collectibles?: Collectibles | null;
|
|
88
89
|
primaryGuild?: UserPrimaryGuild | null;
|
|
89
90
|
}
|
|
91
|
+
/** https://discord.com/developers/docs/resources/user#user-object-user-primary-guild */
|
|
90
92
|
export interface UserPrimaryGuild {
|
|
91
|
-
|
|
93
|
+
identityGuildId: snowflake | null;
|
|
92
94
|
identityEnabled: boolean | null;
|
|
93
95
|
tag: string | null;
|
|
94
96
|
badge: string | null;
|
|
95
97
|
}
|
|
98
|
+
/** https://discord.com/developers/docs/resources/user#avatar-decoration-data-object-avatar-decoration-data-structure */
|
|
96
99
|
export interface AvatarDecorationData {
|
|
97
100
|
asset: string;
|
|
98
|
-
|
|
101
|
+
skuId: snowflake;
|
|
99
102
|
}
|
|
103
|
+
/** https://discord.com/developers/docs/resources/user#collectibles-object-collectibles-structure */
|
|
100
104
|
export interface Collectibles {
|
|
101
105
|
nameplate?: Nameplate;
|
|
102
106
|
}
|
|
107
|
+
/** https://discord.com/developers/docs/resources/user#nameplate-object-nameplate-structure */
|
|
103
108
|
export interface Nameplate {
|
|
104
|
-
|
|
109
|
+
skuId: snowflake;
|
|
105
110
|
asset: string;
|
|
106
111
|
label: string;
|
|
107
112
|
palette: string;
|
|
108
113
|
}
|
|
114
|
+
/** https://discord.com/developers/docs/resources/user#connection-object-connection-structure */
|
|
109
115
|
export interface Connection {
|
|
110
116
|
id: snowflake;
|
|
111
117
|
name: string;
|
|
@@ -118,6 +124,7 @@ export interface Connection {
|
|
|
118
124
|
twoWayLink: boolean;
|
|
119
125
|
visibility: VisibilityTypes;
|
|
120
126
|
}
|
|
127
|
+
/** https://discord.com/developers/docs/resources/user#application-role-connection-object-application-role-connection-structure */
|
|
121
128
|
export interface ApplicationRoleConnection {
|
|
122
129
|
platformName: string | null;
|
|
123
130
|
platformUsername: string | null;
|
|
@@ -24,12 +24,13 @@ export interface RawVoiceRegion {
|
|
|
24
24
|
deprecated: boolean;
|
|
25
25
|
custom: boolean;
|
|
26
26
|
}
|
|
27
|
+
/** https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure */
|
|
27
28
|
export interface VoiceState {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
guildId?: snowflake;
|
|
30
|
+
channelId: snowflake | null;
|
|
31
|
+
userId: snowflake;
|
|
31
32
|
member?: GuildMember;
|
|
32
|
-
|
|
33
|
+
sessionId: string;
|
|
33
34
|
deaf: boolean;
|
|
34
35
|
mute: boolean;
|
|
35
36
|
selfDeaf: boolean;
|
|
@@ -39,6 +40,7 @@ export interface VoiceState {
|
|
|
39
40
|
suppress: boolean;
|
|
40
41
|
requestToSpeakTimestamp: timestamp | null;
|
|
41
42
|
}
|
|
43
|
+
/** https://discord.com/developers/docs/resources/voice#voice-region-object-voice-region-structure */
|
|
42
44
|
export interface VoiceRegion {
|
|
43
45
|
id: snowflake;
|
|
44
46
|
name: string;
|
|
@@ -18,16 +18,17 @@ export interface RawWebhook {
|
|
|
18
18
|
source_channel?: RawChannel;
|
|
19
19
|
url?: string;
|
|
20
20
|
}
|
|
21
|
+
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
|
|
21
22
|
export interface Webhook {
|
|
22
23
|
id: snowflake;
|
|
23
24
|
type: WebhookTypes;
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
guildId?: snowflake | null;
|
|
26
|
+
channelId: snowflake | null;
|
|
26
27
|
user?: User;
|
|
27
28
|
name: string | null;
|
|
28
29
|
avatar: string | null;
|
|
29
30
|
token?: string;
|
|
30
|
-
|
|
31
|
+
applicationId: snowflake | null;
|
|
31
32
|
sourceGuild?: Guild;
|
|
32
33
|
sourceChannel?: Channel;
|
|
33
34
|
url?: string;
|
package/dist/lib/utils/CDN.d.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { ImageFormats } from "../constants";
|
|
2
2
|
import type { snowflake } from "../types/common";
|
|
3
3
|
export declare const cdnURL: (cdnEndpoint: string, imageFormat?: ImageFormats) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
4
|
-
export declare const achievementIcon: (
|
|
5
|
-
export declare const applicationAsset: (
|
|
6
|
-
export declare const applicationCover: (
|
|
7
|
-
export declare const applicationIcon: (
|
|
8
|
-
export declare const customEmoji: (
|
|
4
|
+
export declare const achievementIcon: (applicationId: snowflake, achievementId: snowflake, iconHash: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
5
|
+
export declare const applicationAsset: (applicationId: snowflake, assetId: snowflake, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
6
|
+
export declare const applicationCover: (applicationId: snowflake, coverImage: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
7
|
+
export declare const applicationIcon: (applicationId: snowflake, icon: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
8
|
+
export declare const customEmoji: (emojiId: snowflake, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
9
9
|
export declare const defaultUserAvatar: (index: string) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
10
|
-
export declare const guildBanner: (
|
|
11
|
-
export declare const guildDiscoverySplash: (
|
|
12
|
-
export declare const guildIcon: (
|
|
13
|
-
export declare const guildMemberAvatar: (
|
|
14
|
-
export declare const guildMemberBanner: (
|
|
15
|
-
export declare const guildScheduledEventCover: (
|
|
16
|
-
export declare const guildSplash: (
|
|
17
|
-
export declare const guildTagBadge: (
|
|
18
|
-
export declare const roleIcon: (
|
|
19
|
-
export declare const stickerPackBanner: (
|
|
20
|
-
export declare const sticker: (
|
|
21
|
-
export declare const storePageAsset: (
|
|
22
|
-
export declare const soundboardSound: (
|
|
23
|
-
export declare const teamIcon: (
|
|
24
|
-
export declare const userAvatar: (
|
|
25
|
-
export declare const userAvatarDecoration: (
|
|
26
|
-
export declare const userBanner: (
|
|
10
|
+
export declare const guildBanner: (guildId: snowflake, banner: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
11
|
+
export declare const guildDiscoverySplash: (guildId: snowflake, splash: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
12
|
+
export declare const guildIcon: (guildId: snowflake, icon: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
13
|
+
export declare const guildMemberAvatar: (guildId: snowflake, userId: snowflake, avatar: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
14
|
+
export declare const guildMemberBanner: (guildId: snowflake, userId: snowflake, banner: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
15
|
+
export declare const guildScheduledEventCover: (scheduledEventId: snowflake, coverImage: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
16
|
+
export declare const guildSplash: (guildId: snowflake, splash: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
17
|
+
export declare const guildTagBadge: (guildId: snowflake, hash: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
18
|
+
export declare const roleIcon: (roleId: snowflake, icon: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
19
|
+
export declare const stickerPackBanner: (assetId: snowflake, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
20
|
+
export declare const sticker: (stickerId: snowflake, imageFormat?: ImageFormats.PNG | ImageFormats.Lottie | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
21
|
+
export declare const storePageAsset: (applicationId: snowflake, assetId: snowflake, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
22
|
+
export declare const soundboardSound: (soundId: snowflake) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
23
|
+
export declare const teamIcon: (teamId: snowflake, icon: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
24
|
+
export declare const userAvatar: (userId: snowflake, avatar: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
25
|
+
export declare const userAvatarDecoration: (userId: snowflake, avatarDecoration: string) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
|
26
|
+
export declare const userBanner: (userId: snowflake, banner: string, imageFormat?: ImageFormats.PNG | ImageFormats.JPEG | ImageFormats.JPG | ImageFormats.WebP | ImageFormats.GIF) => `https://cdn.discordapp.com/${string}.jpg` | `https://cdn.discordapp.com/${string}.jpeg` | `https://cdn.discordapp.com/${string}.png` | `https://cdn.discordapp.com/${string}.webp` | `https://cdn.discordapp.com/${string}.gif` | `https://cdn.discordapp.com/${string}.avif` | `https://cdn.discordapp.com/${string}.json`;
|
package/dist/lib/utils/CDN.js
CHANGED
|
@@ -5,49 +5,49 @@ exports.userBanner = exports.userAvatarDecoration = exports.userAvatar = exports
|
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const cdnURL = (cdnEndpoint, imageFormat = constants_1.ImageFormats.PNG) => `https://cdn.discordapp.com/${cdnEndpoint}.${imageFormat}`;
|
|
7
7
|
exports.cdnURL = cdnURL;
|
|
8
|
-
const achievementIcon = (
|
|
8
|
+
const achievementIcon = (applicationId, achievementId, iconHash, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-assets/${applicationId}/achievements/${achievementId}/icons/${iconHash}`, imageFormat);
|
|
9
9
|
exports.achievementIcon = achievementIcon;
|
|
10
|
-
const applicationAsset = (
|
|
10
|
+
const applicationAsset = (applicationId, assetId, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-assets/${applicationId}/${assetId}`, imageFormat);
|
|
11
11
|
exports.applicationAsset = applicationAsset;
|
|
12
|
-
const applicationCover = (
|
|
12
|
+
const applicationCover = (applicationId, coverImage, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-icons/${applicationId}/${coverImage}`, imageFormat);
|
|
13
13
|
exports.applicationCover = applicationCover;
|
|
14
|
-
const applicationIcon = (
|
|
14
|
+
const applicationIcon = (applicationId, icon, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-icons/${applicationId}/${icon}`, imageFormat);
|
|
15
15
|
exports.applicationIcon = applicationIcon;
|
|
16
|
-
const customEmoji = (
|
|
16
|
+
const customEmoji = (emojiId, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`emojis/${emojiId}`, imageFormat);
|
|
17
17
|
exports.customEmoji = customEmoji;
|
|
18
18
|
const defaultUserAvatar = (index) => (0, exports.cdnURL)(`embed/avatars/${index}`);
|
|
19
19
|
exports.defaultUserAvatar = defaultUserAvatar;
|
|
20
|
-
const guildBanner = (
|
|
20
|
+
const guildBanner = (guildId, banner, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`banners/${guildId}/${banner}`, imageFormat);
|
|
21
21
|
exports.guildBanner = guildBanner;
|
|
22
|
-
const guildDiscoverySplash = (
|
|
22
|
+
const guildDiscoverySplash = (guildId, splash, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`discovery-splashes/${guildId}/${splash}`, imageFormat);
|
|
23
23
|
exports.guildDiscoverySplash = guildDiscoverySplash;
|
|
24
|
-
const guildIcon = (
|
|
24
|
+
const guildIcon = (guildId, icon, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`icons/${guildId}/${icon}`, imageFormat);
|
|
25
25
|
exports.guildIcon = guildIcon;
|
|
26
|
-
const guildMemberAvatar = (
|
|
26
|
+
const guildMemberAvatar = (guildId, userId, avatar, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`guilds/${guildId}/users/${userId}/avatars/${avatar}`, imageFormat);
|
|
27
27
|
exports.guildMemberAvatar = guildMemberAvatar;
|
|
28
|
-
const guildMemberBanner = (
|
|
28
|
+
const guildMemberBanner = (guildId, userId, banner, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`guilds/${guildId}/users/${userId}/banners/${banner}`, imageFormat);
|
|
29
29
|
exports.guildMemberBanner = guildMemberBanner;
|
|
30
|
-
const guildScheduledEventCover = (
|
|
30
|
+
const guildScheduledEventCover = (scheduledEventId, coverImage, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`guild-events/${scheduledEventId}/${coverImage}`, imageFormat);
|
|
31
31
|
exports.guildScheduledEventCover = guildScheduledEventCover;
|
|
32
|
-
const guildSplash = (
|
|
32
|
+
const guildSplash = (guildId, splash, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`splashes/${guildId}/${splash}`, imageFormat);
|
|
33
33
|
exports.guildSplash = guildSplash;
|
|
34
|
-
const guildTagBadge = (
|
|
34
|
+
const guildTagBadge = (guildId, hash, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`guild-tag-badges/${guildId}/${hash}`, imageFormat);
|
|
35
35
|
exports.guildTagBadge = guildTagBadge;
|
|
36
|
-
const roleIcon = (
|
|
36
|
+
const roleIcon = (roleId, icon, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`role-icons/${roleId}/${icon}`, imageFormat);
|
|
37
37
|
exports.roleIcon = roleIcon;
|
|
38
|
-
const stickerPackBanner = (
|
|
38
|
+
const stickerPackBanner = (assetId, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-assets/710982414301790216/store/${assetId}`, imageFormat);
|
|
39
39
|
exports.stickerPackBanner = stickerPackBanner;
|
|
40
|
-
const sticker = (
|
|
40
|
+
const sticker = (stickerId, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`stickers/${stickerId}`, imageFormat);
|
|
41
41
|
exports.sticker = sticker;
|
|
42
|
-
const storePageAsset = (
|
|
42
|
+
const storePageAsset = (applicationId, assetId, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-assets/${applicationId}/store/${assetId}`, imageFormat);
|
|
43
43
|
exports.storePageAsset = storePageAsset;
|
|
44
|
-
const soundboardSound = (
|
|
44
|
+
const soundboardSound = (soundId) => (0, exports.cdnURL)(`soundboard-sounds/${soundId}`);
|
|
45
45
|
exports.soundboardSound = soundboardSound;
|
|
46
|
-
const teamIcon = (
|
|
46
|
+
const teamIcon = (teamId, icon, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`team-icons/${teamId}/${icon}`, imageFormat);
|
|
47
47
|
exports.teamIcon = teamIcon;
|
|
48
|
-
const userAvatar = (
|
|
48
|
+
const userAvatar = (userId, avatar, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`avatars/${userId}/${avatar}`, imageFormat);
|
|
49
49
|
exports.userAvatar = userAvatar;
|
|
50
|
-
const userAvatarDecoration = (
|
|
50
|
+
const userAvatarDecoration = (userId, avatarDecoration) => (0, exports.cdnURL)(`avatar-decorations/${userId}/${avatarDecoration}`);
|
|
51
51
|
exports.userAvatarDecoration = userAvatarDecoration;
|
|
52
|
-
const userBanner = (
|
|
52
|
+
const userBanner = (userId, banner, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`banners/${userId}/${banner}`, imageFormat);
|
|
53
53
|
exports.userBanner = userBanner;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { GatewayOPCodes, type JSONErrorCodes } from "../constants";
|
|
2
2
|
export declare class RESTError extends Error {
|
|
3
3
|
name: string;
|
|
4
4
|
method: string;
|
|
@@ -14,5 +14,7 @@ export declare class HTTPError extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
export declare class GatewayError extends Error {
|
|
16
16
|
name: string;
|
|
17
|
+
code: GatewayOPCodes | number;
|
|
18
|
+
reason: string;
|
|
17
19
|
constructor(code: number, reason: string);
|
|
18
20
|
}
|
package/dist/lib/utils/errors.js
CHANGED
|
@@ -47,8 +47,12 @@ class HTTPError extends Error {
|
|
|
47
47
|
exports.HTTPError = HTTPError;
|
|
48
48
|
class GatewayError extends Error {
|
|
49
49
|
name = "GatewayError";
|
|
50
|
+
code;
|
|
51
|
+
reason;
|
|
50
52
|
constructor(code, reason) {
|
|
51
53
|
super(`[${code}] ${reason}`);
|
|
54
|
+
this.code = code;
|
|
55
|
+
this.reason = reason;
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
exports.GatewayError = GatewayError;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { GuildNavigationTypes, TimestampStyles } from "../constants";
|
|
1
|
+
import { GuildNavigationTypes, type TimestampStyles } from "../constants";
|
|
2
2
|
import type { snowflake } from "../types/common";
|
|
3
3
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
4
|
-
export declare function userMention(
|
|
4
|
+
export declare function userMention(userId: snowflake): string;
|
|
5
5
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
6
|
-
export declare function channelMention(
|
|
6
|
+
export declare function channelMention(channelId: snowflake): string;
|
|
7
7
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
8
|
-
export declare function roleMention(
|
|
8
|
+
export declare function roleMention(roleId: snowflake): string;
|
|
9
9
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
10
|
-
export declare function slashCommandMention(commandName: string,
|
|
10
|
+
export declare function slashCommandMention(commandName: string, commandId: snowflake, subCommandName?: string, subCommandGroupName?: string): string;
|
|
11
11
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
12
|
-
export declare function customEmoji(emojiName: string,
|
|
12
|
+
export declare function customEmoji(emojiName: string, emojiId: snowflake, animated?: boolean): string;
|
|
13
13
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
14
14
|
export declare function unixTimestamp(time: number, style?: TimestampStyles): string;
|
|
15
15
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
16
|
-
export declare function guildNavigation(
|
|
16
|
+
export declare function guildNavigation(guildId: snowflake, type: GuildNavigationTypes, roleId?: snowflake): string;
|
|
17
17
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
18
18
|
export declare function email(username: string, domain: string): string;
|
|
19
19
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|