disgroove 2.2.4-dev.e509559 → 2.2.5-dev.3beface

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 (39) hide show
  1. package/README.md +1 -0
  2. package/dist/lib/Client.d.ts +76 -9
  3. package/dist/lib/Client.js +248 -77
  4. package/dist/lib/constants.d.ts +78 -10
  5. package/dist/lib/constants.js +79 -6
  6. package/dist/lib/gateway/Shard.d.ts +3 -1
  7. package/dist/lib/gateway/Shard.js +51 -0
  8. package/dist/lib/rest/Endpoints.d.ts +9 -1
  9. package/dist/lib/rest/Endpoints.js +24 -4
  10. package/dist/lib/transformers/ApplicationCommands.js +2 -0
  11. package/dist/lib/transformers/Applications.js +2 -0
  12. package/dist/lib/transformers/Interactions.d.ts +3 -1
  13. package/dist/lib/transformers/Interactions.js +42 -0
  14. package/dist/lib/transformers/Soundboards.d.ts +5 -0
  15. package/dist/lib/transformers/Soundboards.js +31 -0
  16. package/dist/lib/transformers/Stickers.js +0 -2
  17. package/dist/lib/transformers/Subscriptions.d.ts +5 -0
  18. package/dist/lib/transformers/Subscriptions.js +32 -0
  19. package/dist/lib/transformers/index.d.ts +2 -0
  20. package/dist/lib/transformers/index.js +2 -0
  21. package/dist/lib/types/application-command.d.ts +3 -1
  22. package/dist/lib/types/application.d.ts +31 -1
  23. package/dist/lib/types/entitlements.d.ts +1 -1
  24. package/dist/lib/types/gateway-events.d.ts +43 -1
  25. package/dist/lib/types/guild.d.ts +2 -0
  26. package/dist/lib/types/interaction.d.ts +44 -0
  27. package/dist/lib/types/message.d.ts +26 -5
  28. package/dist/lib/types/sku.d.ts +1 -1
  29. package/dist/lib/types/soundboard.d.ts +23 -0
  30. package/dist/lib/types/soundboard.js +2 -0
  31. package/dist/lib/types/sticker.d.ts +0 -2
  32. package/dist/lib/types/subscription.d.ts +25 -0
  33. package/dist/lib/types/subscription.js +2 -0
  34. package/dist/lib/utils/CDN.d.ts +1 -0
  35. package/dist/lib/utils/CDN.js +3 -1
  36. package/dist/lib/utils/formatters.d.ts +2 -2
  37. package/dist/lib/utils/formatters.js +5 -2
  38. package/dist/package.json +4 -4
  39. package/package.json +35 -35
@@ -104,6 +104,30 @@ export interface RawInteractionCallbackData {
104
104
  custom_id?: string;
105
105
  title?: string;
106
106
  }
107
+ /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-response-object */
108
+ export interface RawInteractionCallbackResponse {
109
+ interaction: RawInteractionCallback;
110
+ resource?: RawInteractionResource;
111
+ }
112
+ /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-object */
113
+ export interface RawInteractionCallback {
114
+ id: snowflake;
115
+ type: InteractionType;
116
+ activity_instance_id?: string;
117
+ response_message_id?: snowflake;
118
+ response_message_loading?: boolean;
119
+ response_message_ephemeral?: boolean;
120
+ }
121
+ /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-resource-object */
122
+ export interface RawInteractionResource {
123
+ type: InteractionCallbackType;
124
+ activity_instance?: RawActivityInstanceResource;
125
+ message?: RawMessage;
126
+ }
127
+ /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-callback-interaction-callback-activity-instance-resource */
128
+ export interface RawActivityInstanceResource {
129
+ id: string;
130
+ }
107
131
  export interface Interaction {
108
132
  id: snowflake;
109
133
  applicationID: snowflake;
@@ -189,3 +213,23 @@ export interface InteractionCallbackData {
189
213
  customID?: string;
190
214
  title?: string;
191
215
  }
216
+ export interface InteractionCallbackResponse {
217
+ interaction: InteractionCallback;
218
+ resource?: InteractionResource;
219
+ }
220
+ export interface InteractionCallback {
221
+ id: snowflake;
222
+ type: InteractionType;
223
+ activityInstanceID?: string;
224
+ responseMessageID?: snowflake;
225
+ responseMessageLoading?: boolean;
226
+ responseMessageEphemeral?: boolean;
227
+ }
228
+ export interface InteractionResource {
229
+ type: InteractionCallbackType;
230
+ activityInstance?: ActivityInstanceResource;
231
+ message?: Message;
232
+ }
233
+ export interface ActivityInstanceResource {
234
+ id: string;
235
+ }
@@ -1,4 +1,4 @@
1
- import type { MessageTypes, MessageFlags, MessageActivityTypes, InteractionType, ApplicationIntegrationTypes, MessageReferenceTypes, AttachmentFlags, ChannelTypes, AllowedMentionTypes } from "../constants";
1
+ import type { MessageTypes, MessageFlags, MessageActivityTypes, InteractionType, ApplicationIntegrationTypes, MessageReferenceTypes, AttachmentFlags, ChannelTypes, AllowedMentionTypes, EmbedTypes } from "../constants";
2
2
  import type { Application, RawApplication } from "./application";
3
3
  import type { Channel, RawChannel, RawRoleSubscriptionData, RoleSubscriptionData } from "./channel";
4
4
  import type { snowflake, timestamp } from "./common";
@@ -77,7 +77,7 @@ export interface RawMessageReference {
77
77
  }
78
78
  /** https://discord.com/developers/docs/resources/message#message-snapshot-object-message-snapshot-structure */
79
79
  export interface RawMessageSnapshot {
80
- message: Pick<RawMessage, "type" | "content" | "embeds" | "attachments" | "timestamp" | "edited_timestamp" | "flags" | "mentions" | "mention_roles">;
80
+ message: Pick<RawMessage, "type" | "content" | "embeds" | "attachments" | "timestamp" | "edited_timestamp" | "flags" | "mentions" | "mention_roles" | "stickers" | "sticker_items" | "components">;
81
81
  }
82
82
  /** https://discord.com/developers/docs/resources/message#reaction-object-reaction-structure */
83
83
  export interface RawReaction {
@@ -96,7 +96,7 @@ export interface RawReactionCountDetails {
96
96
  /** https://discord.com/developers/docs/resources/message#embed-object-embed-structure */
97
97
  export interface RawEmbed {
98
98
  title?: string;
99
- type?: string;
99
+ type?: EmbedTypes;
100
100
  description?: string;
101
101
  url?: string;
102
102
  timestamp?: timestamp;
@@ -154,6 +154,17 @@ export interface RawEmbedField {
154
154
  value: string;
155
155
  inline?: boolean;
156
156
  }
157
+ /** https://discord.com/developers/docs/resources/message#embed-fields-by-embed-type-poll-result-embed-fields */
158
+ export interface RawPollResultEmbedFields {
159
+ poll_question_text: string;
160
+ victor_answer_votes: Array<number>;
161
+ total_votes: number;
162
+ victor_answer_id?: snowflake;
163
+ victor_answer_text?: string;
164
+ victor_answer_emoji_id?: snowflake;
165
+ victor_answer_emoji_name?: string;
166
+ victor_answer_emoji_animated?: boolean;
167
+ }
157
168
  /** https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure */
158
169
  export interface RawAttachment {
159
170
  id: snowflake;
@@ -248,7 +259,7 @@ export interface MessageReference {
248
259
  failIfNotExists?: boolean;
249
260
  }
250
261
  export interface MessageSnapshot {
251
- message: Pick<Message, "type" | "content" | "embeds" | "attachments" | "timestamp" | "editedTimestamp" | "flags" | "mentions" | "mentionRoles">;
262
+ message: Pick<Message, "type" | "content" | "embeds" | "attachments" | "timestamp" | "editedTimestamp" | "flags" | "mentions" | "mentionRoles" | "stickers" | "stickerItems" | "components">;
252
263
  }
253
264
  export interface Reaction {
254
265
  count: number;
@@ -264,7 +275,7 @@ export interface ReactionCountDetails {
264
275
  }
265
276
  export interface Embed {
266
277
  title?: string;
267
- type?: string;
278
+ type?: EmbedTypes;
268
279
  description?: string;
269
280
  url?: string;
270
281
  timestamp?: timestamp;
@@ -315,6 +326,16 @@ export interface EmbedField {
315
326
  value: string;
316
327
  inline?: boolean;
317
328
  }
329
+ export interface PollResultEmbedFields {
330
+ pollQuestionText: string;
331
+ victorAnswerVotes: Array<number>;
332
+ totalVotes: number;
333
+ victorAnswerID?: snowflake;
334
+ victorAnswerText?: string;
335
+ victorAnswerEmojiID?: snowflake;
336
+ victorAnswerEmojiName?: string;
337
+ victorAnswerEmojiAnimated?: boolean;
338
+ }
318
339
  export interface Attachment {
319
340
  id: snowflake;
320
341
  filename: string;
@@ -1,6 +1,6 @@
1
1
  import type { SKUFlags, SKUTypes } from "../constants";
2
2
  import type { snowflake } from "./common";
3
- /** https://discord.com/developers/docs/monetization/skus#sku-object-sku-structure */
3
+ /** https://discord.com/developers/docs/resources/sku#sku-object-sku-structure */
4
4
  export interface RawSKU {
5
5
  id: snowflake;
6
6
  type: SKUTypes;
@@ -0,0 +1,23 @@
1
+ import type { snowflake } from "./common";
2
+ import type { RawUser, User } from "./user";
3
+ /** https://discord.com/developers/docs/resources/soundboard#soundboard-sound-structure */
4
+ export interface RawSoundboardSound {
5
+ name: string;
6
+ sound_id: snowflake;
7
+ volume: number;
8
+ emoji_id: snowflake | null;
9
+ emoji_name: string | null;
10
+ guild_id?: snowflake;
11
+ available: boolean;
12
+ user?: RawUser;
13
+ }
14
+ export interface SoundboardSound {
15
+ name: string;
16
+ soundID: snowflake;
17
+ volume: number;
18
+ emojiID: snowflake | null;
19
+ emojiName: string | null;
20
+ guildID?: snowflake;
21
+ available: boolean;
22
+ user?: User;
23
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,7 +8,6 @@ export interface RawSticker {
8
8
  name: string;
9
9
  description: string | null;
10
10
  tags: string;
11
- asset?: string;
12
11
  type: StickerTypes;
13
12
  format_type: StickerFormatTypes;
14
13
  available?: boolean;
@@ -38,7 +37,6 @@ export interface Sticker {
38
37
  name: string;
39
38
  description: string | null;
40
39
  tags: string;
41
- asset?: string;
42
40
  type: StickerTypes;
43
41
  formatType: StickerFormatTypes;
44
42
  available?: boolean;
@@ -0,0 +1,25 @@
1
+ import type { SubscriptionStatuses } from "../constants";
2
+ import type { snowflake, timestamp } from "./common";
3
+ /** https://discord.com/developers/docs/resources/subscription#subscription-object */
4
+ export interface RawSubscription {
5
+ id: snowflake;
6
+ user_id: snowflake;
7
+ sku_ids: Array<snowflake>;
8
+ entitlement_ids: Array<snowflake>;
9
+ current_period_start: timestamp;
10
+ current_period_end: timestamp;
11
+ status: SubscriptionStatuses;
12
+ canceled_at: timestamp | null;
13
+ country?: string;
14
+ }
15
+ export interface Subscription {
16
+ id: snowflake;
17
+ userID: snowflake;
18
+ skuIDs: Array<snowflake>;
19
+ entitlementIDs: Array<snowflake>;
20
+ currentPeriodStart: timestamp;
21
+ currentPeriodEnd: timestamp;
22
+ status: SubscriptionStatuses;
23
+ canceledAt: timestamp | null;
24
+ country?: string;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,6 +18,7 @@ export declare const roleIcon: (roleID: snowflake, icon: string, imageFormat?: I
18
18
  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}.json`;
19
19
  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}.json`;
20
20
  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}.json`;
21
+ 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}.json`;
21
22
  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}.json`;
22
23
  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}.json`;
23
24
  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}.json`;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /* https://discord.com/developers/docs/reference#image-formatting */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.userBanner = exports.userAvatarDecoration = exports.userAvatar = exports.teamIcon = exports.storePageAsset = exports.sticker = exports.stickerPackBanner = exports.roleIcon = exports.guildSplash = exports.guildScheduledEventCover = exports.guildMemberBanner = exports.guildMemberAvatar = exports.guildIcon = exports.guildDiscoverySplash = exports.guildBanner = exports.defaultUserAvatar = exports.customEmoji = exports.applicationIcon = exports.applicationCover = exports.applicationAsset = exports.achievementIcon = exports.cdnURL = void 0;
4
+ exports.userBanner = exports.userAvatarDecoration = exports.userAvatar = exports.teamIcon = exports.soundboardSound = exports.storePageAsset = exports.sticker = exports.stickerPackBanner = exports.roleIcon = exports.guildSplash = exports.guildScheduledEventCover = exports.guildMemberBanner = exports.guildMemberAvatar = exports.guildIcon = exports.guildDiscoverySplash = exports.guildBanner = exports.defaultUserAvatar = exports.customEmoji = exports.applicationIcon = exports.applicationCover = exports.applicationAsset = exports.achievementIcon = exports.cdnURL = void 0;
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;
@@ -39,6 +39,8 @@ const sticker = (stickerID, imageFormat = constants_1.ImageFormats.PNG) => (0, e
39
39
  exports.sticker = sticker;
40
40
  const storePageAsset = (applicationID, assetID, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`app-assets/${applicationID}/store/${assetID}`, imageFormat);
41
41
  exports.storePageAsset = storePageAsset;
42
+ const soundboardSound = (soundID) => (0, exports.cdnURL)(`soundboard-sounds/${soundID}`);
43
+ exports.soundboardSound = soundboardSound;
42
44
  const teamIcon = (teamID, icon, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`team-icons/${teamID}/${icon}`, imageFormat);
43
45
  exports.teamIcon = teamIcon;
44
46
  const userAvatar = (userID, avatar, imageFormat = constants_1.ImageFormats.PNG) => (0, exports.cdnURL)(`avatars/${userID}/${avatar}`, imageFormat);
@@ -1,4 +1,4 @@
1
- import type { GuildNavigationTypes, TimestampStyles } from "../constants";
1
+ import { GuildNavigationTypes, TimestampStyles } from "../constants";
2
2
  import type { snowflake } from "../types/common";
3
3
  /** https://discord.com/developers/docs/reference#message-formatting-formats */
4
4
  export declare function userMention(userID: snowflake): string;
@@ -13,4 +13,4 @@ export declare function customEmoji(emojiName: string, emojiID: snowflake, anima
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(guildID: snowflake, type: GuildNavigationTypes): string;
16
+ export declare function guildNavigation(guildID: snowflake, type: GuildNavigationTypes, roleID?: snowflake): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.guildNavigation = exports.unixTimestamp = exports.customEmoji = exports.slashCommandMention = exports.roleMention = exports.channelMention = exports.userMention = void 0;
4
+ const constants_1 = require("../constants");
4
5
  /** https://discord.com/developers/docs/reference#message-formatting-formats */
5
6
  function userMention(userID) {
6
7
  return `<@${userID}>`;
@@ -38,7 +39,9 @@ function unixTimestamp(time, style) {
38
39
  }
39
40
  exports.unixTimestamp = unixTimestamp;
40
41
  /** https://discord.com/developers/docs/reference#message-formatting-formats */
41
- function guildNavigation(guildID, type) {
42
- return `<${guildID}:${type}>`;
42
+ function guildNavigation(guildID, type, roleID) {
43
+ return roleID && type === constants_1.GuildNavigationTypes.LinkedRoles
44
+ ? `<${guildID}:${type}:${roleID}>`
45
+ : `<${guildID}:${type}>`;
43
46
  }
44
47
  exports.guildNavigation = guildNavigation;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.4-dev.e509559",
3
+ "version": "2.2.5-dev.3beface",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "homepage": "https://github.com/XenKys/disgroove#readme",
27
27
  "devDependencies": {
28
- "@types/node": "^20.14.10",
29
- "@types/ws": "^8.5.10",
30
- "typescript": "^5.5.3"
28
+ "@types/node": "^22.5.3",
29
+ "@types/ws": "^8.5.12",
30
+ "typescript": "^5.5.4"
31
31
  },
32
32
  "dependencies": {
33
33
  "ws": "^8.18.0"
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "disgroove",
3
- "version": "2.2.4-dev.e509559",
4
- "description": "A module to interface with Discord",
5
- "main": "./dist/lib/index.js",
6
- "types": "./dist/lib/index.d.ts",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/XenKys/disgroove.git"
10
- },
11
- "keywords": [
12
- "api",
13
- "bot",
14
- "discord",
15
- "gateway",
16
- "http",
17
- "https",
18
- "rest",
19
- "wrapper"
20
- ],
21
- "author": "XenKys",
22
- "license": "MIT",
23
- "bugs": {
24
- "url": "https://github.com/XenKys/disgroove/issues"
25
- },
26
- "homepage": "https://github.com/XenKys/disgroove#readme",
27
- "devDependencies": {
28
- "@types/node": "^20.14.10",
29
- "@types/ws": "^8.5.10",
30
- "typescript": "^5.5.3"
31
- },
32
- "dependencies": {
33
- "ws": "^8.18.0"
34
- }
35
- }
1
+ {
2
+ "name": "disgroove",
3
+ "version": "2.2.5-dev.3beface",
4
+ "description": "A module to interface with Discord",
5
+ "main": "./dist/lib/index.js",
6
+ "types": "./dist/lib/index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/XenKys/disgroove.git"
10
+ },
11
+ "keywords": [
12
+ "api",
13
+ "bot",
14
+ "discord",
15
+ "gateway",
16
+ "http",
17
+ "https",
18
+ "rest",
19
+ "wrapper"
20
+ ],
21
+ "author": "XenKys",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/XenKys/disgroove/issues"
25
+ },
26
+ "homepage": "https://github.com/XenKys/disgroove#readme",
27
+ "devDependencies": {
28
+ "@types/node": "^22.5.3",
29
+ "@types/ws": "^8.5.12",
30
+ "typescript": "^5.5.4"
31
+ },
32
+ "dependencies": {
33
+ "ws": "^8.18.0"
34
+ }
35
+ }