disgroove 2.2.0-dev.301452e → 2.2.0-dev.a9ab94a

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/README.md CHANGED
@@ -2,69 +2,55 @@
2
2
 
3
3
  A module to interface with Discord
4
4
 
5
- ## Features
6
-
7
- - No cache: For large bots the cache might be a RAM memory management issue, this module doesn't include it
8
- - Very fast: The module contains all methods in the Client class, so sending API requests will not have to go through a third party, and this allows the module to be faster
9
- - Documentation-based: The module is based entirely on the [Official Discord API Documentation](https://discord.com/developers/docs/intro), so it does not add custom methods or properties, to avoid future problems
5
+ - Fast
6
+ - 100% coverage of the [Official Discord API Documentation](https://discord.com/developers/docs/intro)
10
7
 
11
8
  ## Installation
12
9
 
13
- [**Node.js**](https://nodejs.org) v18 or higher required
10
+ [**Node.js v18**](https://nodejs.org) or newer required
14
11
 
15
12
  ```
16
13
  npm install disgroove
17
14
  ```
18
15
 
19
- ## Example
20
-
21
- To see more examples see the [examples](https://github.com/XenKys/disgroove/tree/main/examples) folder on GitHub repository
16
+ #### Example
22
17
 
23
18
  ```js
24
19
  const {
25
20
  Client,
26
21
  GatewayIntents,
27
- ActivityType,
28
22
  InteractionType,
29
23
  InteractionCallbackType,
30
24
  MessageFlags,
31
25
  } = require("disgroove");
32
- const client = new Client("token", {
26
+ const client = new Client("B0t.T0k3N", {
33
27
  intents: GatewayIntents.All,
34
28
  });
35
29
 
36
- client.on("ready", async () => {
37
- console.log(`${client.user.username} is now online!`); // Prints "Username is now online!" when the bot connects to the gateway
30
+ client.once("ready", () => {
31
+ console.log(`${client.user.username} is now online!`);
38
32
 
39
33
  client.createGlobalApplicationCommand(client.application.id, {
40
34
  name: "ping",
41
35
  description: "Responds with Pong! 🏓",
42
- }); // Creates a global application command named "ping"
43
-
44
- client.setPresence({
45
- activity: {
46
- name: "/ping",
47
- type: ActivityType.Watching,
48
- },
49
- }); // Updates the bot presence to "Watching /ping"
36
+ });
50
37
  });
51
38
 
52
39
  client.on("interactionCreate", async (interaction) => {
53
- if (interaction.type !== InteractionType.ApplicationCommand) return; // Checks if the interaction is an application command
40
+ if (interaction.type !== InteractionType.ApplicationCommand) return;
54
41
 
55
42
  if (interaction.data.name === "ping") {
56
- // Checks if the application command name is equals to "ping"
57
43
  client.createInteractionResponse(interaction.id, interaction.token, {
58
44
  type: InteractionCallbackType.ChannelMessageWithSource,
59
45
  data: {
60
46
  content: "Pong! 🏓",
61
47
  flags: MessageFlags.Ephemeral,
62
48
  },
63
- }); // Responds with an ephemeral message "Pong! 🏓"
49
+ });
64
50
  }
65
51
  });
66
52
 
67
- client.connect(); // Connects the bot to the gateway
53
+ client.connect();
68
54
  ```
69
55
 
70
- Enjoy the package? Give it a ⭐ on [GitHub repository](https://github.com/XenKys/disgroove)
56
+ More examples on the [GitHub repository](https://github.com/XenKys/disgroove/tree/main/examples)
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { GatewayIntents, type OAuth2Scopes, type StatusTypes, type ActionTypes, type ImageWidgetStyleOptions, InteractionCallbackType, type MFALevel, type ReactionTypes, ApplicationCommandTypes, EventTypes, TriggerTypes, ChannelTypes, VideoQualityModes, SortOrderTypes, ForumLayoutTypes, InviteTargetTypes, VerificationLevel, DefaultMessageNotificationLevel, ExplicitContentFilterLevel, SystemChannelFlags, ApplicationFlags, ApplicationIntegrationTypes, ChannelFlags, GuildFeatures, GuildScheduledEventEntityTypes, GuildScheduledEventPrivacyLevel, GuildScheduledEventStatus, MessageFlags, OnboardingMode, PrivacyLevel, GuildMemberFlags } from "./constants";
2
+ import { GatewayIntents, type OAuth2Scopes, type StatusTypes, type ActionTypes, type ImageWidgetStyleOptions, InteractionCallbackType, type MFALevel, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags } from "./constants";
3
3
  import { Util } from "./utils";
4
- import { RequestManager, File } from "./rest";
4
+ import { RequestManager, type File } from "./rest";
5
5
  import EventEmitter from "node:events";
6
6
  import { ShardManager } from "./gateway";
7
7
  import type { Application, ApplicationIntegrationTypeConfiguration, InstallParams } from "./types/application";
@@ -22,7 +22,7 @@ import type { Invite } from "./types/invite";
22
22
  import type { ActionRow } from "./types/message-components";
23
23
  import type { PollCreateParams } from "./types/poll";
24
24
  import type { Role } from "./types/role";
25
- import type { Sku } from "./types/sku";
25
+ import type { SKU } from "./types/sku";
26
26
  import type { StageInstance } from "./types/stage-instance";
27
27
  import type { Sticker, StickerPack } from "./types/sticker";
28
28
  import type { User, ApplicationRoleConnection, Connection } from "./types/user";
@@ -481,15 +481,15 @@ export declare class Client extends EventEmitter {
481
481
  }): void;
482
482
  /** https://discord.com/developers/docs/resources/application#edit-current-application */
483
483
  editCurrentApplication(options: {
484
- customInstallUrl?: string;
484
+ customInstallURL?: string;
485
485
  description?: string;
486
- roleConnectionsVerificationUrl?: string;
486
+ roleConnectionsVerificationURL?: string;
487
487
  installParams?: InstallParams;
488
488
  integrationTypesConfig?: Record<ApplicationIntegrationTypes, ApplicationIntegrationTypeConfiguration>;
489
489
  flags?: ApplicationFlags;
490
490
  icon?: string;
491
491
  coverImage?: string;
492
- interactionsEndpointUrl?: string;
492
+ interactionsEndpointURL?: string;
493
493
  tags?: Array<string>;
494
494
  }): Promise<Application>;
495
495
  /** https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command */
@@ -686,7 +686,7 @@ export declare class Client extends EventEmitter {
686
686
  executeWebhook(webhookId: snowflake, webhookToken: string, options: {
687
687
  content?: string | null;
688
688
  username?: string;
689
- avatarUrl?: string;
689
+ avatarURL?: string;
690
690
  tts?: boolean;
691
691
  embeds?: Array<Embed> | null;
692
692
  allowedMentions?: AllowedMentions | null;
@@ -862,7 +862,7 @@ export declare class Client extends EventEmitter {
862
862
  /** https://discord.com/developers/docs/resources/guild-template#get-guild-templates */
863
863
  getGuildTemplates(guildId: snowflake): Promise<Array<GuildTemplate>>;
864
864
  /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
865
- getGuildVanityUrl(guildId: snowflake): Promise<{
865
+ getGuildVanityURL(guildId: snowflake): Promise<{
866
866
  code: string;
867
867
  uses: number;
868
868
  }>;
@@ -935,7 +935,7 @@ export declare class Client extends EventEmitter {
935
935
  users: Array<User>;
936
936
  }>;
937
937
  /** https://discord.com/developers/docs/monetization/skus#list-skus */
938
- getSkus(applicationId: snowflake): Promise<Array<Sku>>;
938
+ getSKUs(applicationId: snowflake): Promise<Array<SKU>>;
939
939
  /** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
940
940
  getStageInstance(channelId: snowflake): Promise<StageInstance>;
941
941
  /** https://discord.com/developers/docs/resources/sticker#list-sticker-packs */
@@ -393,6 +393,18 @@ class Client extends node_events_1.default {
393
393
  attachments: options.attachments?.map((attachment) => this.util.attachmentToRaw(attachment)),
394
394
  flags: options.flags,
395
395
  thread_name: options.threadName,
396
+ poll: options.poll !== undefined
397
+ ? {
398
+ question: options.poll.question,
399
+ answers: options.poll.answers.map((answer) => ({
400
+ answer_id: answer.answerId,
401
+ poll_media: answer.pollMedia,
402
+ })),
403
+ duration: options.poll.duration,
404
+ allow_multiselect: options.poll.allowMultiselect,
405
+ layout_type: options.poll.layoutType,
406
+ }
407
+ : undefined,
396
408
  },
397
409
  files: options.files,
398
410
  });
@@ -784,28 +796,10 @@ class Client extends node_events_1.default {
784
796
  async editApplicationCommandPermissions(applicationId, guildId, commandId, options) {
785
797
  const response = await this.rest.request(rest_1.RESTMethods.Put, rest_1.Endpoints.applicationCommandPermissions(applicationId, guildId, commandId), {
786
798
  json: {
787
- permissions: options.permissions.map((permission) => ({
788
- id: permission.id,
789
- application_id: permission.applicationId,
790
- guild_id: permission.guildId,
791
- permissions: permission.permissions.map((perm) => ({
792
- id: perm.id,
793
- type: perm.type,
794
- permission: perm.permission,
795
- })),
796
- })),
799
+ permissions: options.permissions.map((permission) => this.util.guildApplicationCommandPermissionsToRaw(permission)),
797
800
  },
798
801
  });
799
- return {
800
- id: response.id,
801
- applicationId: response.application_id,
802
- guildId: response.guild_id,
803
- permissions: response.permissions.map((permission) => ({
804
- id: permission.id,
805
- type: permission.type,
806
- permission: permission.permission,
807
- })),
808
- };
802
+ return this.util.guildApplicationCommandPermissionsFromRaw(response);
809
803
  }
810
804
  /** https://discord.com/developers/docs/resources/channel#modify-channel */
811
805
  async editChannel(channelId, options, reason) {
@@ -892,14 +886,14 @@ class Client extends node_events_1.default {
892
886
  async editCurrentApplication(options) {
893
887
  const response = await this.rest.request(rest_1.RESTMethods.Patch, rest_1.Endpoints.applicationCurrentUser(), {
894
888
  json: {
895
- custom_install_url: options.customInstallUrl,
889
+ custom_install_url: options.customInstallURL,
896
890
  description: options.description,
897
- role_connections_verification_url: options.roleConnectionsVerificationUrl,
891
+ role_connections_verification_url: options.roleConnectionsVerificationURL,
898
892
  install_params: options.installParams,
899
893
  flags: options.flags,
900
894
  icon: options.icon,
901
895
  cover_image: options.coverImage,
902
- interactions_endpoint_url: options.interactionsEndpointUrl,
896
+ interactions_endpoint_url: options.interactionsEndpointURL,
903
897
  tags: options.tags,
904
898
  },
905
899
  });
@@ -1297,7 +1291,7 @@ class Client extends node_events_1.default {
1297
1291
  json: {
1298
1292
  content: options.content,
1299
1293
  username: options.username,
1300
- avatarUrl: options.avatarUrl,
1294
+ avatarURL: options.avatarURL,
1301
1295
  tts: options.tts,
1302
1296
  embeds: options.embeds !== null
1303
1297
  ? options.embeds?.map((embed) => this.util.embedToRaw(embed))
@@ -1375,15 +1369,7 @@ class Client extends node_events_1.default {
1375
1369
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildActiveThreads(guildId));
1376
1370
  return {
1377
1371
  threads: response.threads.map((thread) => this.util.channelFromRaw(thread)),
1378
- members: response.members.map((threadMember) => ({
1379
- id: threadMember.id,
1380
- userId: threadMember.user_id,
1381
- joinTimestamp: threadMember.join_timestamp,
1382
- flags: threadMember.flags,
1383
- member: threadMember.member !== undefined
1384
- ? this.util.guildMemberFromRaw(threadMember.member)
1385
- : undefined,
1386
- })),
1372
+ members: response.members.map((threadMember) => this.util.threadMemberFromRaw(threadMember)),
1387
1373
  };
1388
1374
  }
1389
1375
  /** https://discord.com/developers/docs/resources/channel#list-public-archived-threads */
@@ -1396,15 +1382,7 @@ class Client extends node_events_1.default {
1396
1382
  });
1397
1383
  return {
1398
1384
  threads: response.threads.map((thread) => this.util.channelFromRaw(thread)),
1399
- members: response.members.map((threadMember) => ({
1400
- id: threadMember.id,
1401
- userId: threadMember.user_id,
1402
- joinTimestamp: threadMember.join_timestamp,
1403
- flags: threadMember.flags,
1404
- member: threadMember.member !== undefined
1405
- ? this.util.guildMemberFromRaw(threadMember.member)
1406
- : undefined,
1407
- })),
1385
+ members: response.members.map((threadMember) => this.util.threadMemberFromRaw(threadMember)),
1408
1386
  hasMore: response.has_more,
1409
1387
  };
1410
1388
  }
@@ -1434,16 +1412,7 @@ class Client extends node_events_1.default {
1434
1412
  /** https://discord.com/developers/docs/interactions/application-commands#get-application-command-permissions */
1435
1413
  async getApplicationCommandPermissions(applicationId, guildId, commandId) {
1436
1414
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationCommandPermissions(applicationId, guildId, commandId));
1437
- return {
1438
- id: response.id,
1439
- applicationId: response.application_id,
1440
- guildId: response.guild_id,
1441
- permissions: response.permissions.map((permission) => ({
1442
- id: permission.id,
1443
- type: permission.type,
1444
- permission: permission.permission,
1445
- })),
1446
- };
1415
+ return this.util.guildApplicationCommandPermissionsFromRaw(response);
1447
1416
  }
1448
1417
  /** https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records */
1449
1418
  async getApplicationRoleConnectionMetadataRecords(applicationId) {
@@ -1604,16 +1573,7 @@ class Client extends node_events_1.default {
1604
1573
  /** https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */
1605
1574
  async getGuildApplicationCommandPermissions(applicationId, guildId) {
1606
1575
  const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildApplicationCommandsPermissions(applicationId, guildId));
1607
- return {
1608
- id: response.id,
1609
- applicationId: response.application_id,
1610
- guildId: response.guild_id,
1611
- permissions: response.permissions.map((permission) => ({
1612
- id: permission.id,
1613
- type: permission.type,
1614
- permission: permission.permission,
1615
- })),
1616
- };
1576
+ return this.util.guildApplicationCommandPermissionsFromRaw(response);
1617
1577
  }
1618
1578
  /** https://discord.com/developers/docs/resources/guild#get-guild-ban */
1619
1579
  async getGuildBan(guildId, userId) {
@@ -1777,8 +1737,8 @@ class Client extends node_events_1.default {
1777
1737
  return response.map((guildTemplate) => this.util.guildTemplateFromRaw(guildTemplate));
1778
1738
  }
1779
1739
  /** https://discord.com/developers/docs/resources/guild#get-guild-vanity-url */
1780
- getGuildVanityUrl(guildId) {
1781
- return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVanityUrl(guildId));
1740
+ getGuildVanityURL(guildId) {
1741
+ return this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.guildVanityURL(guildId));
1782
1742
  }
1783
1743
  /** https://discord.com/developers/docs/resources/guild#get-guild-voice-regions */
1784
1744
  async getGuildVoiceRegions(guildId) {
@@ -1871,15 +1831,7 @@ class Client extends node_events_1.default {
1871
1831
  });
1872
1832
  return {
1873
1833
  threads: response.threads.map((thread) => this.util.channelFromRaw(thread)),
1874
- members: response.members.map((threadMember) => ({
1875
- id: threadMember.id,
1876
- userId: threadMember.user_id,
1877
- joinTimestamp: threadMember.join_timestamp,
1878
- flags: threadMember.flags,
1879
- member: threadMember.member !== undefined
1880
- ? this.util.guildMemberFromRaw(threadMember.member)
1881
- : undefined,
1882
- })),
1834
+ members: response.members.map((threadMember) => this.util.threadMemberFromRaw(threadMember)),
1883
1835
  hasMore: response.has_more,
1884
1836
  };
1885
1837
  }
@@ -1946,8 +1898,8 @@ class Client extends node_events_1.default {
1946
1898
  };
1947
1899
  }
1948
1900
  /** https://discord.com/developers/docs/monetization/skus#list-skus */
1949
- async getSkus(applicationId) {
1950
- const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationSkus(applicationId));
1901
+ async getSKUs(applicationId) {
1902
+ const response = await this.rest.request(rest_1.RESTMethods.Get, rest_1.Endpoints.applicationSKUs(applicationId));
1951
1903
  return response.map((sku) => this.util.skuFromRaw(sku));
1952
1904
  }
1953
1905
  /** https://discord.com/developers/docs/resources/stage-instance#get-stage-instance */
@@ -1996,15 +1948,7 @@ class Client extends node_events_1.default {
1996
1948
  limit: options?.limit,
1997
1949
  },
1998
1950
  });
1999
- return response.map((threadMember) => ({
2000
- id: threadMember.id,
2001
- userId: threadMember.user_id,
2002
- joinTimestamp: threadMember.join_timestamp,
2003
- flags: threadMember.flags,
2004
- member: threadMember.member !== undefined
2005
- ? this.util.guildMemberFromRaw(threadMember.member)
2006
- : undefined,
2007
- }));
1951
+ return response.map((threadMember) => this.util.threadMemberFromRaw(threadMember));
2008
1952
  }
2009
1953
  /** https://discord.com/developers/docs/resources/user#get-user */
2010
1954
  async getUser(userId) {
@@ -110,7 +110,8 @@ export declare enum ButtonStyles {
110
110
  Secondary = 2,
111
111
  Success = 3,
112
112
  Danger = 4,
113
- Link = 5
113
+ Link = 5,
114
+ Premium = 6
114
115
  }
115
116
  /** https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles */
116
117
  export declare enum TextInputStyles {
@@ -833,7 +834,7 @@ export declare enum JSONErrorCodes {
833
834
  UnknownWebhookService = 10016,
834
835
  UnknownSession = 10020,
835
836
  UnknownBan = 10026,
836
- UnknownSku = 10027,
837
+ UnknownSKU = 10027,
837
838
  UnknownStoreListing = 10028,
838
839
  UnknownEntitlement = 10029,
839
840
  UnknownBuild = 10030,
@@ -958,7 +959,7 @@ export declare enum JSONErrorCodes {
958
959
  InvalidFileUploaded = 50046,
959
960
  CannotSelfRedeemThisGift = 50054,
960
961
  InvalidGuild = 50055,
961
- InvalidSku = 50057,
962
+ InvalidSKU = 50057,
962
963
  InvalidRequestOrigin = 50067,
963
964
  InvalidMessageType = 50068,
964
965
  PaymentSourceRequiredToRedeemGift = 50070,
@@ -1124,14 +1125,14 @@ export declare enum MembershipState {
1124
1125
  Accepted = 2
1125
1126
  }
1126
1127
  /** https://discord.com/developers/docs/monetization/skus#sku-object-sku-types */
1127
- export declare enum SkuTypes {
1128
+ export declare enum SKUTypes {
1128
1129
  Durable = 2,
1129
1130
  Consumable = 3,
1130
1131
  Subscription = 5,
1131
1132
  SubscriptionGroup = 6
1132
1133
  }
1133
1134
  /** https://discord.com/developers/docs/monetization/skus#sku-object-sku-flags */
1134
- export declare enum SkuFlags {
1135
+ export declare enum SKUFlags {
1135
1136
  Available = 4,
1136
1137
  GuildSubscription = 128,
1137
1138
  UserSubscription = 256
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LayoutType = exports.InviteTargetTypes = exports.InviteTypes = exports.GuildScheduledEventStatus = exports.GuildScheduledEventEntityTypes = exports.GuildScheduledEventPrivacyLevel = exports.ImageWidgetStyleOptions = exports.PromptTypes = exports.OnboardingMode = exports.IntegrationExpireBehaviors = exports.GuildMemberFlags = exports.MutableGuildFeatures = exports.GuildFeatures = exports.SystemChannelFlags = exports.PremiumTier = exports.GuildNSFWLevel = exports.VerificationLevel = exports.MFALevel = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.ReactionTypes = exports.AllowedMentionTypes = exports.AttachmentFlags = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.ForumLayoutTypes = exports.SortOrderTypes = exports.ChannelFlags = exports.VideoQualityModes = exports.ChannelTypes = exports.ActionTypes = exports.EventTypes = exports.KeywordPresetTypes = exports.TriggerTypes = exports.AuditLogEvents = exports.ApplicationRoleConnectionMetadataType = exports.ApplicationFlags = exports.ApplicationIntegrationTypes = exports.TextInputStyles = exports.ButtonStyles = exports.InteractionCallbackType = exports.ComponentTypes = exports.InteractionContextTypes = exports.InteractionType = exports.ApplicationCommandPermissionType = exports.ApplicationCommandOptionType = exports.ApplicationCommandTypes = exports.Locales = exports.ImageFormats = void 0;
4
- exports.EntitlementTypes = exports.SkuFlags = exports.SkuTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = void 0;
4
+ exports.EntitlementTypes = exports.SKUFlags = exports.SKUTypes = exports.MembershipState = exports.TeamMemberRoleTypes = exports.RoleFlags = exports.BitwisePermissionFlags = exports.RPCCloseEventCodes = exports.RPCErrorCodes = exports.JSONErrorCodes = exports.HTTPResponseCodes = exports.VoiceCloseEventCodes = exports.VoiceOPCodes = exports.GatewayCloseEventCodes = exports.GatewayOPCodes = exports.OAuth2Scopes = exports.ActivityFlags = exports.ActivityType = exports.GatewayEvents = exports.StatusTypes = exports.GatewayIntents = exports.DeviceType = exports.WebhookTypes = exports.VisibilityTypes = exports.Services = exports.PremiumTypes = exports.UserFlags = exports.StickerFormatTypes = exports.StickerTypes = exports.PrivacyLevel = void 0;
5
5
  /** https://discord.com/developers/docs/reference#image-formatting-image-formats */
6
6
  var ImageFormats;
7
7
  (function (ImageFormats) {
@@ -125,6 +125,7 @@ var ButtonStyles;
125
125
  ButtonStyles[ButtonStyles["Success"] = 3] = "Success";
126
126
  ButtonStyles[ButtonStyles["Danger"] = 4] = "Danger";
127
127
  ButtonStyles[ButtonStyles["Link"] = 5] = "Link";
128
+ ButtonStyles[ButtonStyles["Premium"] = 6] = "Premium";
128
129
  })(ButtonStyles || (exports.ButtonStyles = ButtonStyles = {}));
129
130
  /** https://discord.com/developers/docs/interactions/message-components#text-inputs-text-input-styles */
130
131
  var TextInputStyles;
@@ -908,7 +909,7 @@ var JSONErrorCodes;
908
909
  JSONErrorCodes[JSONErrorCodes["UnknownWebhookService"] = 10016] = "UnknownWebhookService";
909
910
  JSONErrorCodes[JSONErrorCodes["UnknownSession"] = 10020] = "UnknownSession";
910
911
  JSONErrorCodes[JSONErrorCodes["UnknownBan"] = 10026] = "UnknownBan";
911
- JSONErrorCodes[JSONErrorCodes["UnknownSku"] = 10027] = "UnknownSku";
912
+ JSONErrorCodes[JSONErrorCodes["UnknownSKU"] = 10027] = "UnknownSKU";
912
913
  JSONErrorCodes[JSONErrorCodes["UnknownStoreListing"] = 10028] = "UnknownStoreListing";
913
914
  JSONErrorCodes[JSONErrorCodes["UnknownEntitlement"] = 10029] = "UnknownEntitlement";
914
915
  JSONErrorCodes[JSONErrorCodes["UnknownBuild"] = 10030] = "UnknownBuild";
@@ -1033,7 +1034,7 @@ var JSONErrorCodes;
1033
1034
  JSONErrorCodes[JSONErrorCodes["InvalidFileUploaded"] = 50046] = "InvalidFileUploaded";
1034
1035
  JSONErrorCodes[JSONErrorCodes["CannotSelfRedeemThisGift"] = 50054] = "CannotSelfRedeemThisGift";
1035
1036
  JSONErrorCodes[JSONErrorCodes["InvalidGuild"] = 50055] = "InvalidGuild";
1036
- JSONErrorCodes[JSONErrorCodes["InvalidSku"] = 50057] = "InvalidSku";
1037
+ JSONErrorCodes[JSONErrorCodes["InvalidSKU"] = 50057] = "InvalidSKU";
1037
1038
  JSONErrorCodes[JSONErrorCodes["InvalidRequestOrigin"] = 50067] = "InvalidRequestOrigin";
1038
1039
  JSONErrorCodes[JSONErrorCodes["InvalidMessageType"] = 50068] = "InvalidMessageType";
1039
1040
  JSONErrorCodes[JSONErrorCodes["PaymentSourceRequiredToRedeemGift"] = 50070] = "PaymentSourceRequiredToRedeemGift";
@@ -1204,20 +1205,20 @@ var MembershipState;
1204
1205
  MembershipState[MembershipState["Accepted"] = 2] = "Accepted";
1205
1206
  })(MembershipState || (exports.MembershipState = MembershipState = {}));
1206
1207
  /** https://discord.com/developers/docs/monetization/skus#sku-object-sku-types */
1207
- var SkuTypes;
1208
- (function (SkuTypes) {
1209
- SkuTypes[SkuTypes["Durable"] = 2] = "Durable";
1210
- SkuTypes[SkuTypes["Consumable"] = 3] = "Consumable";
1211
- SkuTypes[SkuTypes["Subscription"] = 5] = "Subscription";
1212
- SkuTypes[SkuTypes["SubscriptionGroup"] = 6] = "SubscriptionGroup";
1213
- })(SkuTypes || (exports.SkuTypes = SkuTypes = {}));
1208
+ var SKUTypes;
1209
+ (function (SKUTypes) {
1210
+ SKUTypes[SKUTypes["Durable"] = 2] = "Durable";
1211
+ SKUTypes[SKUTypes["Consumable"] = 3] = "Consumable";
1212
+ SKUTypes[SKUTypes["Subscription"] = 5] = "Subscription";
1213
+ SKUTypes[SKUTypes["SubscriptionGroup"] = 6] = "SubscriptionGroup";
1214
+ })(SKUTypes || (exports.SKUTypes = SKUTypes = {}));
1214
1215
  /** https://discord.com/developers/docs/monetization/skus#sku-object-sku-flags */
1215
- var SkuFlags;
1216
- (function (SkuFlags) {
1217
- SkuFlags[SkuFlags["Available"] = 4] = "Available";
1218
- SkuFlags[SkuFlags["GuildSubscription"] = 128] = "GuildSubscription";
1219
- SkuFlags[SkuFlags["UserSubscription"] = 256] = "UserSubscription";
1220
- })(SkuFlags || (exports.SkuFlags = SkuFlags = {}));
1216
+ var SKUFlags;
1217
+ (function (SKUFlags) {
1218
+ SKUFlags[SKUFlags["Available"] = 4] = "Available";
1219
+ SKUFlags[SKUFlags["GuildSubscription"] = 128] = "GuildSubscription";
1220
+ SKUFlags[SKUFlags["UserSubscription"] = 256] = "UserSubscription";
1221
+ })(SKUFlags || (exports.SKUFlags = SKUFlags = {}));
1221
1222
  /** https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-types */
1222
1223
  var EntitlementTypes;
1223
1224
  (function (EntitlementTypes) {
@@ -117,16 +117,7 @@ class Shard {
117
117
  this.client.emit(constants_1.GatewayEvents.Resumed);
118
118
  break;
119
119
  case "APPLICATION_COMMAND_PERMISSIONS_UPDATE":
120
- this.client.emit(constants_1.GatewayEvents.ApplicationCommandPermissionsUpdate, {
121
- id: packet.d.id,
122
- applicationId: packet.d.application_id,
123
- guildId: packet.d.guild_id,
124
- permissions: packet.d.permissions.map((permission) => ({
125
- id: permission.id,
126
- type: permission.type,
127
- permission: permission.permission,
128
- })),
129
- });
120
+ this.client.emit(constants_1.GatewayEvents.ApplicationCommandPermissionsUpdate, this.client.util.guildApplicationCommandPermissionsFromRaw(packet.d));
130
121
  break;
131
122
  case "AUTO_MODERATION_RULE_CREATE":
132
123
  this.client.emit(constants_1.GatewayEvents.AutoModerationRuleCreate, this.client.util.autoModerationRuleFromRaw(packet.d));
@@ -189,15 +180,7 @@ class Shard {
189
180
  guildId: packet.d.guild_id,
190
181
  channelIds: packet.d.channel_ids,
191
182
  threads: packet.d.threads.map((thread) => this.client.util.channelFromRaw(thread)),
192
- members: packet.d.members.map((threadMember) => ({
193
- id: threadMember.id,
194
- userId: threadMember.user_id,
195
- joinTimestamp: threadMember.join_timestamp,
196
- flags: threadMember.flags,
197
- member: threadMember.member !== undefined
198
- ? this.client.util.guildMemberFromRaw(threadMember.member)
199
- : undefined,
200
- })),
183
+ members: packet.d.members.map((threadMember) => this.client.util.threadMemberFromRaw(threadMember)),
201
184
  });
202
185
  break;
203
186
  case "THREAD_MEMBER_UPDATE":
@@ -217,15 +200,7 @@ class Shard {
217
200
  id: packet.d.id,
218
201
  guildId: packet.d.guild_id,
219
202
  memberCount: packet.d.member_count,
220
- addedMembers: packet.d.members.map((threadMember) => ({
221
- id: threadMember.id,
222
- userId: threadMember.user_id,
223
- joinTimestamp: threadMember.join_timestamp,
224
- flags: threadMember.flags,
225
- member: threadMember.member !== undefined
226
- ? this.client.util.guildMemberFromRaw(threadMember.member)
227
- : undefined,
228
- })),
203
+ addedMembers: packet.d.members.map((threadMember) => this.client.util.threadMemberFromRaw(threadMember)),
229
204
  removedMemberIds: packet.d.removed_member_ids,
230
205
  });
231
206
  break;
@@ -33,7 +33,7 @@ export declare const guildSticker: (guildId: snowflake, stickerId: snowflake) =>
33
33
  export declare const guildStickers: (guildId: snowflake) => `guilds/${string}/stickers`;
34
34
  export declare const guildTemplate: (guildId: snowflake, code: string) => `guilds/${string}/templates/${string}`;
35
35
  export declare const guildTemplates: (guildId: snowflake) => `guilds/${string}/templates`;
36
- export declare const guildVanityUrl: (guildId: snowflake) => `guilds/${string}/vanity-url`;
36
+ export declare const guildVanityURL: (guildId: snowflake) => `guilds/${string}/vanity-url`;
37
37
  export declare const guildVoiceRegions: (guildId: snowflake) => `guilds/${string}/regions`;
38
38
  export declare const guildVoiceState: (guildId: snowflake, userId?: snowflake | "@me") => `guilds/${string}/voice-states/${string}`;
39
39
  export declare const guildWebhooks: (guildId: snowflake) => `guilds/${string}/webhooks`;
@@ -78,7 +78,7 @@ export declare const applicationEntitlements: (applicationId: snowflake) => `app
78
78
  export declare const applicationGuildCommand: (applicationId: snowflake, guildId: snowflake, commandId: snowflake) => `applications/${string}/guilds/${string}/commands/${string}`;
79
79
  export declare const applicationGuildCommands: (applicationId: snowflake, guildId: snowflake) => `applications/${string}/guilds/${string}/commands`;
80
80
  export declare const applicationRoleConnectionMetadata: (applicationId: snowflake) => `applications/${string}/role-connections/metadata`;
81
- export declare const applicationSkus: (applicationId: snowflake) => `applications/${string}/skus`;
81
+ export declare const applicationSKUs: (applicationId: snowflake) => `applications/${string}/skus`;
82
82
  export declare const guildApplicationCommandsPermissions: (applicationId: snowflake, guildId: snowflake) => `applications/${string}/guilds/${string}/commands/permissions`;
83
83
  export declare const webhook: (webhookId: snowflake, webhookToken?: string) => `webhooks/${string}`;
84
84
  export declare const webhookMessage: (webhookId: snowflake, webhookToken: string, messageId?: snowflake | "@original") => `webhooks/${string}/${string}/messages/${string}`;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityUrl = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildEmojis = exports.guildEmoji = exports.guildCurrentMemberNickname = exports.guildChannels = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = exports.bulkGuildBan = void 0;
4
- exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2CurrentAuthorization = exports.oauth2CurrentApplication = exports.oauth2Authorization = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSkus = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationCurrentUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = void 0;
3
+ exports.channelMessageCrosspost = exports.channelMessageAllReactions = exports.channelMessage = exports.channelInvites = exports.channelFollowers = exports.channelBulkDelete = exports.channel = exports.template = exports.guildWidgetSettings = exports.guildWidgetJSON = exports.guildWidgetImage = exports.guildWelcomeScreen = exports.guildWebhooks = exports.guildVoiceState = exports.guildVoiceRegions = exports.guildVanityURL = exports.guildTemplates = exports.guildTemplate = exports.guildStickers = exports.guildSticker = exports.guildScheduledEventUsers = exports.guildScheduledEvents = exports.guildScheduledEvent = exports.guildRoles = exports.guildRole = exports.guildPrune = exports.guildPreview = exports.guildOnboarding = exports.guildMemberVerification = exports.guildMembersSearch = exports.guildMembers = exports.guildMemberRole = exports.guildMember = exports.guildMFA = exports.guildInvites = exports.guildIntegrations = exports.guildIntegration = exports.guildEmojis = exports.guildEmoji = exports.guildCurrentMemberNickname = exports.guildChannels = exports.guildBans = exports.guildBan = exports.guildAutoModerationRules = exports.guildAutoModerationRule = exports.guildAuditLog = exports.guildActiveThreads = exports.guilds = exports.guild = exports.bulkGuildBan = void 0;
4
+ exports.voiceRegions = exports.stickerPacks = exports.sticker = exports.stageInstances = exports.stageInstance = exports.invite = exports.interactionCallback = exports.oauth2TokenRevocation = exports.oauth2TokenExchange = exports.oauth2CurrentAuthorization = exports.oauth2CurrentApplication = exports.oauth2Authorization = exports.gatewayBot = exports.gateway = exports.webhookPlatform = exports.webhookMessage = exports.webhook = exports.guildApplicationCommandsPermissions = exports.applicationSKUs = exports.applicationRoleConnectionMetadata = exports.applicationGuildCommands = exports.applicationGuildCommand = exports.applicationEntitlements = exports.applicationEntitlementConsume = exports.applicationEntitlement = exports.applicationCurrentUser = exports.applicationCommandPermissions = exports.applicationCommands = exports.applicationCommand = exports.userGuilds = exports.userGuild = exports.userConnections = exports.userChannels = exports.userApplicationRoleConnection = exports.user = exports.pollExpire = exports.pollAnswerVoters = exports.threadMembers = exports.threads = exports.channelWebhooks = exports.channelTyping = exports.channelThreads = exports.channelRecipient = exports.channelPins = exports.channelPin = exports.channelPermission = exports.channelMessages = exports.channelMessageReaction = void 0;
5
5
  // Guilds
6
6
  const bulkGuildBan = (guildId) => `guilds/${guildId}/bulk-ban`;
7
7
  exports.bulkGuildBan = bulkGuildBan;
@@ -71,8 +71,8 @@ const guildTemplate = (guildId, code) => `guilds/${guildId}/templates/${code}`;
71
71
  exports.guildTemplate = guildTemplate;
72
72
  const guildTemplates = (guildId) => `guilds/${guildId}/templates`;
73
73
  exports.guildTemplates = guildTemplates;
74
- const guildVanityUrl = (guildId) => `guilds/${guildId}/vanity-url`;
75
- exports.guildVanityUrl = guildVanityUrl;
74
+ const guildVanityURL = (guildId) => `guilds/${guildId}/vanity-url`;
75
+ exports.guildVanityURL = guildVanityURL;
76
76
  const guildVoiceRegions = (guildId) => `guilds/${guildId}/regions`;
77
77
  exports.guildVoiceRegions = guildVoiceRegions;
78
78
  const guildVoiceState = (guildId, userId = "@me") => `guilds/${guildId}/voice-states/${userId}`;
@@ -172,8 +172,8 @@ const applicationGuildCommands = (applicationId, guildId) => `applications/${app
172
172
  exports.applicationGuildCommands = applicationGuildCommands;
173
173
  const applicationRoleConnectionMetadata = (applicationId) => `applications/${applicationId}/role-connections/metadata`;
174
174
  exports.applicationRoleConnectionMetadata = applicationRoleConnectionMetadata;
175
- const applicationSkus = (applicationId) => `applications/${applicationId}/skus`;
176
- exports.applicationSkus = applicationSkus;
175
+ const applicationSKUs = (applicationId) => `applications/${applicationId}/skus`;
176
+ exports.applicationSKUs = applicationSKUs;
177
177
  const guildApplicationCommandsPermissions = (applicationId, guildId) => `applications/${applicationId}/guilds/${guildId}/commands/permissions`;
178
178
  exports.guildApplicationCommandsPermissions = guildApplicationCommandsPermissions;
179
179
  // Webhooks
@@ -49,25 +49,25 @@ export interface Application {
49
49
  rpcOrigins?: Array<string>;
50
50
  botPublic: boolean;
51
51
  botRequireCodeGrant: boolean;
52
- termsOfServiceUrl?: string;
53
- privacyPolicyUrl?: string;
52
+ termsOfServiceURL?: string;
53
+ privacyPolicyURL?: string;
54
54
  owner?: User;
55
55
  verifyKey: string;
56
56
  team: Team | null;
57
57
  guildId?: snowflake;
58
58
  guild?: Guild;
59
- primarySkuId?: snowflake;
59
+ primarySKUId?: snowflake;
60
60
  slug?: string;
61
61
  coverImage?: string;
62
62
  flags?: ApplicationFlags;
63
63
  approximateGuildCount?: number;
64
64
  redirectURIs?: Array<string>;
65
- interactionsEndpointUrl?: string;
66
- roleConnectionsVerificationUrl?: string;
65
+ interactionsEndpointURL?: string;
66
+ roleConnectionsVerificationURL?: string;
67
67
  tags?: Array<string>;
68
68
  installParams?: InstallParams;
69
69
  integrationTypesConfig?: Record<ApplicationIntegrationTypes, ApplicationIntegrationTypeConfiguration>;
70
- customInstallUrl?: string;
70
+ customInstallURL?: string;
71
71
  }
72
72
  export interface ApplicationIntegrationTypeConfiguration {
73
73
  oauth2InstallParams: InstallParams;
@@ -427,19 +427,19 @@ export interface Embed {
427
427
  }
428
428
  export interface EmbedThumbnail {
429
429
  url: string;
430
- proxyUrl?: string;
430
+ proxyURL?: string;
431
431
  height?: number;
432
432
  width?: number;
433
433
  }
434
434
  export interface EmbedVideo {
435
435
  url?: string;
436
- proxyUrl?: string;
436
+ proxyURL?: string;
437
437
  height?: number;
438
438
  width?: number;
439
439
  }
440
440
  export interface EmbedImage {
441
441
  url: string;
442
- proxyUrl?: string;
442
+ proxyURL?: string;
443
443
  height?: number;
444
444
  width?: number;
445
445
  }
@@ -450,13 +450,13 @@ export interface EmbedProvider {
450
450
  export interface EmbedAuthor {
451
451
  name: string;
452
452
  url?: string;
453
- iconUrl?: string;
454
- proxyIconUrl?: string;
453
+ iconURL?: string;
454
+ proxyIconURL?: string;
455
455
  }
456
456
  export interface EmbedFooter {
457
457
  text: string;
458
- iconUrl?: string;
459
- proxyIconUrl?: string;
458
+ iconURL?: string;
459
+ proxyIconURL?: string;
460
460
  }
461
461
  export interface EmbedField {
462
462
  name: string;
@@ -470,7 +470,7 @@ export interface Attachment {
470
470
  contentType?: string;
471
471
  size: number;
472
472
  url: string;
473
- proxyUrl: string;
473
+ proxyURL: string;
474
474
  height?: number;
475
475
  width?: number;
476
476
  ephemeral?: boolean;
@@ -206,7 +206,7 @@ export interface Guild {
206
206
  rulesChannelId: snowflake | null;
207
207
  maxPresences?: number | null;
208
208
  maxMembers?: number;
209
- vanityUrlCode: string | null;
209
+ vanityURLCode: string | null;
210
210
  description: string | null;
211
211
  banner: string | null;
212
212
  premiumTier: PremiumTier;
@@ -1,10 +1,10 @@
1
- import type { ApplicationCommandOptionType, ApplicationCommandTypes, ComponentTypes, InteractionCallbackType, InteractionType, MessageFlags } from "../constants";
1
+ import type { ApplicationCommandOptionType, ApplicationCommandTypes, ApplicationIntegrationTypes, ComponentTypes, InteractionCallbackType, InteractionContextTypes, InteractionType, Locales, MessageFlags } from "../constants";
2
2
  import type { File } from "../rest";
3
3
  import type { RawApplicationCommandOptionChoice, ApplicationCommandOptionChoice } from "./application-command";
4
4
  import type { RawChannel, RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Channel, Message, Attachment, Embed, AllowedMentions } from "./channel";
5
5
  import type { snowflake } from "./common";
6
6
  import type { RawEntitlement, Entitlement } from "./entitlements";
7
- import type { RawGuildMember, GuildMember } from "./guild";
7
+ import type { RawGuildMember, GuildMember, Guild, RawGuild } from "./guild";
8
8
  import type { RawTextInput, RawActionRow, TextInput, ActionRow } from "./message-components";
9
9
  import type { RawPollCreateParams, PollCreateParams } from "./poll";
10
10
  import type { RawRole, Role } from "./role";
@@ -15,6 +15,9 @@ export interface RawInteraction {
15
15
  application_id: snowflake;
16
16
  type: InteractionType;
17
17
  data?: RawApplicationCommandData & RawMessageComponentData & RawModalSubmitData;
18
+ guild?: {
19
+ locale: Locales;
20
+ } & Pick<RawGuild, "id" | "features">;
18
21
  guild_id?: snowflake;
19
22
  channel?: RawChannel;
20
23
  channel_id?: snowflake;
@@ -27,6 +30,8 @@ export interface RawInteraction {
27
30
  locale?: string;
28
31
  guild_locale?: string;
29
32
  entitlements: Array<RawEntitlement>;
33
+ authorizing_integration_owners: Record<ApplicationIntegrationTypes, string>;
34
+ context?: InteractionContextTypes;
30
35
  }
31
36
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-application-command-data-structure */
32
37
  export interface RawApplicationCommandData {
@@ -103,6 +108,9 @@ export interface Interaction {
103
108
  applicationId: snowflake;
104
109
  type: InteractionType;
105
110
  data?: ApplicationCommandData & MessageComponentData & ModalSubmitData;
111
+ guild?: {
112
+ locale: Locales;
113
+ } & Pick<Guild, "id" | "features">;
106
114
  guildId?: snowflake;
107
115
  channel?: Channel;
108
116
  channelId?: snowflake;
@@ -115,6 +123,8 @@ export interface Interaction {
115
123
  locale?: string;
116
124
  guildLocale?: string;
117
125
  entitlements: Array<Entitlement>;
126
+ authorizingIntegrationOwners: Record<ApplicationIntegrationTypes, string>;
127
+ context?: InteractionContextTypes;
118
128
  }
119
129
  export interface ApplicationCommandData {
120
130
  id: snowflake;
@@ -8,6 +8,7 @@ export interface RawButton {
8
8
  label?: string;
9
9
  emoji?: Pick<RawEmoji, "name" | "id" | "animated">;
10
10
  custom_id?: string;
11
+ sku_id?: snowflake;
11
12
  url?: string;
12
13
  disabled?: boolean;
13
14
  }
@@ -59,6 +60,7 @@ export interface Button {
59
60
  label?: string;
60
61
  emoji?: Pick<Emoji, "name" | "id" | "animated">;
61
62
  customId?: string;
63
+ skuId?: snowflake;
62
64
  url?: string;
63
65
  disabled?: boolean;
64
66
  }
@@ -1,9 +1,9 @@
1
- import type { SkuFlags, SkuTypes } from "../constants";
1
+ import type { SKUFlags, SKUTypes } from "../constants";
2
2
  import type { snowflake } from "./common";
3
3
  /** https://discord.com/developers/docs/monetization/skus#sku-object-sku-structure */
4
- export interface RawSku {
4
+ export interface RawSKU {
5
5
  id: snowflake;
6
- type: SkuTypes;
6
+ type: SKUTypes;
7
7
  dependent_sku_id?: string | null;
8
8
  application_id: snowflake;
9
9
  manifest_labels?: null;
@@ -12,13 +12,13 @@ export interface RawSku {
12
12
  features?: [];
13
13
  release_date?: null;
14
14
  slug: string;
15
- flags: SkuFlags;
15
+ flags: SKUFlags;
16
16
  show_age_gate?: boolean;
17
17
  }
18
- export interface Sku {
18
+ export interface SKU {
19
19
  id: snowflake;
20
- type: SkuTypes;
21
- dependentSkuId?: string | null;
20
+ type: SKUTypes;
21
+ dependentSKUId?: string | null;
22
22
  applicationId: snowflake;
23
23
  manifestLabels?: null;
24
24
  accessType?: number;
@@ -26,6 +26,6 @@ export interface Sku {
26
26
  features?: [];
27
27
  releaseDate?: null;
28
28
  slug: string;
29
- flags: SkuFlags;
29
+ flags: SKUFlags;
30
30
  showAgeGate?: boolean;
31
31
  }
@@ -1,7 +1,7 @@
1
1
  import type { Application, RawApplication } from "../types/application";
2
- import type { ApplicationCommand, RawApplicationCommand } from "../types/application-command";
2
+ import type { ApplicationCommand, GuildApplicationCommandPermissions, RawApplicationCommand, RawGuildApplicationCommandPermissions } from "../types/application-command";
3
3
  import type { AutoModerationRule, RawAutoModerationRule } from "../types/auto-moderation";
4
- import type { Attachment, Channel, Embed, Message, MessageInteractionMetadata, RawAttachment, RawChannel, RawEmbed, RawMessage, RawMessageInteractionMetadata } from "../types/channel";
4
+ import type { Attachment, Channel, Embed, Message, MessageInteractionMetadata, RawAttachment, RawChannel, RawEmbed, RawMessage, RawMessageInteractionMetadata, RawThreadMember, ThreadMember } from "../types/channel";
5
5
  import type { Emoji, RawEmoji } from "../types/emoji";
6
6
  import type { Guild, GuildMember, Integration, RawGuild, RawGuildMember, RawIntegration } from "../types/guild";
7
7
  import type { GuildScheduledEvent, RawGuildScheduledEvent } from "../types/guild-scheduled-event";
@@ -19,7 +19,7 @@ import type { ActionRow, RawActionRow } from "../types/message-components";
19
19
  import type { Interaction, RawInteraction, RawResolvedData, ResolvedData } from "../types/interaction";
20
20
  import type { Entitlement, RawEntitlement } from "../types/entitlements";
21
21
  import type { AuditLog, AuditLogEntry, RawAuditLog, RawAuditLogEntry } from "../types/audit-log";
22
- import type { RawSku, Sku } from "../types/sku";
22
+ import type { RawSKU, SKU } from "../types/sku";
23
23
  import type { PresenceUpdateEventFields, RawPresenceUpdateEventFields } from "../types/gateway-events";
24
24
  export declare class Util {
25
25
  auditLogFromRaw(auditLog: RawAuditLog): AuditLog;
@@ -42,6 +42,8 @@ export declare class Util {
42
42
  emojiToRaw(emoji: Emoji): RawEmoji;
43
43
  entitlementFromRaw(entitlement: RawEntitlement): Entitlement;
44
44
  entitlementToRaw(entitlement: Entitlement): RawEntitlement;
45
+ guildApplicationCommandPermissionsFromRaw(guildApplicationCommandPermissions: RawGuildApplicationCommandPermissions): GuildApplicationCommandPermissions;
46
+ guildApplicationCommandPermissionsToRaw(guildApplicationCommandPermissions: GuildApplicationCommandPermissions): RawGuildApplicationCommandPermissions;
45
47
  guildFromRaw(guild: RawGuild): Guild;
46
48
  guildToRaw(guild: Guild): RawGuild;
47
49
  guildMemberFromRaw(guildMember: RawGuildMember): GuildMember;
@@ -71,14 +73,16 @@ export declare class Util {
71
73
  pollToRaw(poll: Poll): RawPoll;
72
74
  roleFromRaw(role: RawRole): Role;
73
75
  roleToRaw(role: Role): RawRole;
74
- skuFromRaw(sku: RawSku): Sku;
75
- skuToRaw(sku: Sku): RawSku;
76
+ skuFromRaw(sku: RawSKU): SKU;
77
+ skuToRaw(sku: SKU): RawSKU;
76
78
  stageInstanceFromRaw(stageInstance: RawStageInstance): StageInstance;
77
79
  stageInstanceToRaw(stageInstance: StageInstance): RawStageInstance;
78
80
  stickerFromRaw(sticker: RawSticker): Sticker;
79
81
  stickerToRaw(sticker: Sticker): RawSticker;
80
82
  teamFromRaw(team: RawTeam): Team;
81
83
  teamToRaw(team: Team): RawTeam;
84
+ threadMemberFromRaw(threadMember: RawThreadMember): ThreadMember;
85
+ threadMemberToRaw(threadMember: ThreadMember): RawThreadMember;
82
86
  testEntitlementFromRaw(entitlement: Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">): Omit<Entitlement, "startsAt" | "endsAt" | "subscriptionId">;
83
87
  testEntitlementToRaw(entitlement: Omit<Entitlement, "startsAt" | "endsAt" | "subscriptionId">): Omit<RawEntitlement, "starts_at" | "ends_at" | "subscription_id">;
84
88
  userFromRaw(user: RawUser): User;
@@ -153,7 +153,7 @@ class Util {
153
153
  contentType: attachment.content_type,
154
154
  size: attachment.size,
155
155
  url: attachment.url,
156
- proxyUrl: attachment.proxy_url,
156
+ proxyURL: attachment.proxy_url,
157
157
  height: attachment.height,
158
158
  width: attachment.width,
159
159
  ephemeral: attachment.ephemeral,
@@ -170,7 +170,7 @@ class Util {
170
170
  content_type: attachment.contentType,
171
171
  size: attachment.size,
172
172
  url: attachment.url,
173
- proxy_url: attachment.proxyUrl,
173
+ proxy_url: attachment.proxyURL,
174
174
  height: attachment.height,
175
175
  width: attachment.width,
176
176
  ephemeral: attachment.ephemeral,
@@ -188,8 +188,8 @@ class Util {
188
188
  rpcOrigins: application.rpc_origins,
189
189
  botPublic: application.bot_public,
190
190
  botRequireCodeGrant: application.bot_require_code_grant,
191
- termsOfServiceUrl: application.terms_of_service_url,
192
- privacyPolicyUrl: application.privacy_policy_url,
191
+ termsOfServiceURL: application.terms_of_service_url,
192
+ privacyPolicyURL: application.privacy_policy_url,
193
193
  owner: application.owner !== undefined
194
194
  ? this.userFromRaw(application.owner)
195
195
  : undefined,
@@ -199,14 +199,14 @@ class Util {
199
199
  guild: application.guild !== undefined
200
200
  ? this.guildFromRaw(application.guild)
201
201
  : undefined,
202
- primarySkuId: application.primary_sku_id,
202
+ primarySKUId: application.primary_sku_id,
203
203
  slug: application.slug,
204
204
  coverImage: application.cover_image,
205
205
  flags: application.flags,
206
206
  approximateGuildCount: application.approximate_guild_count,
207
207
  redirectURIs: application.redirect_uris,
208
- interactionsEndpointUrl: application.interactions_endpoint_url,
209
- roleConnectionsVerificationUrl: application.role_connections_verification_url,
208
+ interactionsEndpointURL: application.interactions_endpoint_url,
209
+ roleConnectionsVerificationURL: application.role_connections_verification_url,
210
210
  tags: application.tags,
211
211
  installParams: application.install_params,
212
212
  integrationTypesConfig: application.integration_types_config !== undefined
@@ -221,7 +221,7 @@ class Util {
221
221
  },
222
222
  }
223
223
  : undefined,
224
- customInstallUrl: application.custom_install_url,
224
+ customInstallURL: application.custom_install_url,
225
225
  };
226
226
  }
227
227
  applicationToRaw(application) {
@@ -233,8 +233,8 @@ class Util {
233
233
  rpc_origins: application.rpcOrigins,
234
234
  bot_public: application.botPublic,
235
235
  bot_require_code_grant: application.botRequireCodeGrant,
236
- terms_of_service_url: application.termsOfServiceUrl,
237
- privacy_policy_url: application.privacyPolicyUrl,
236
+ terms_of_service_url: application.termsOfServiceURL,
237
+ privacy_policy_url: application.privacyPolicyURL,
238
238
  owner: application.owner !== undefined
239
239
  ? this.userToRaw(application.owner)
240
240
  : undefined,
@@ -244,14 +244,14 @@ class Util {
244
244
  guild: application.guild !== undefined
245
245
  ? this.guildToRaw(application.guild)
246
246
  : undefined,
247
- primary_sku_id: application.primarySkuId,
247
+ primary_sku_id: application.primarySKUId,
248
248
  slug: application.slug,
249
249
  cover_image: application.coverImage,
250
250
  flags: application.flags,
251
251
  approximate_guild_count: application.approximateGuildCount,
252
252
  redirect_uris: application.redirectURIs,
253
- interactions_endpoint_url: application.interactionsEndpointUrl,
254
- role_connections_verification_url: application.roleConnectionsVerificationUrl,
253
+ interactions_endpoint_url: application.interactionsEndpointURL,
254
+ role_connections_verification_url: application.roleConnectionsVerificationURL,
255
255
  tags: application.tags,
256
256
  install_params: application.installParams,
257
257
  integration_types_config: application.integrationTypesConfig !== undefined
@@ -264,7 +264,7 @@ class Util {
264
264
  },
265
265
  }
266
266
  : undefined,
267
- custom_install_url: application.customInstallUrl,
267
+ custom_install_url: application.customInstallURL,
268
268
  };
269
269
  }
270
270
  applicationCommandFromRaw(applicationCommand) {
@@ -570,14 +570,14 @@ class Util {
570
570
  footer: embed.footer !== undefined
571
571
  ? {
572
572
  text: embed.footer.text,
573
- iconUrl: embed.footer.icon_url,
574
- proxyIconUrl: embed.footer.proxy_icon_url,
573
+ iconURL: embed.footer.icon_url,
574
+ proxyIconURL: embed.footer.proxy_icon_url,
575
575
  }
576
576
  : undefined,
577
577
  image: embed.image !== undefined
578
578
  ? {
579
579
  url: embed.image.url,
580
- proxyUrl: embed.image.proxy_url,
580
+ proxyURL: embed.image.proxy_url,
581
581
  height: embed.image.height,
582
582
  width: embed.image.width,
583
583
  }
@@ -585,14 +585,14 @@ class Util {
585
585
  thumbnail: embed.thumbnail !== undefined
586
586
  ? {
587
587
  url: embed.thumbnail.url,
588
- proxyUrl: embed.thumbnail.proxy_url,
588
+ proxyURL: embed.thumbnail.proxy_url,
589
589
  height: embed.thumbnail.height,
590
590
  width: embed.thumbnail.width,
591
591
  }
592
592
  : undefined,
593
593
  video: {
594
594
  url: embed.video?.url,
595
- proxyUrl: embed.video?.proxy_url,
595
+ proxyURL: embed.video?.proxy_url,
596
596
  height: embed.video?.height,
597
597
  width: embed.video?.width,
598
598
  },
@@ -604,8 +604,8 @@ class Util {
604
604
  ? {
605
605
  name: embed.author.name,
606
606
  url: embed.author.url,
607
- iconUrl: embed.author.icon_url,
608
- proxyIconUrl: embed.author.proxy_icon_url,
607
+ iconURL: embed.author.icon_url,
608
+ proxyIconURL: embed.author.proxy_icon_url,
609
609
  }
610
610
  : undefined,
611
611
  fields: embed.fields?.map((field) => ({
@@ -626,14 +626,14 @@ class Util {
626
626
  footer: embed.footer !== undefined
627
627
  ? {
628
628
  text: embed.footer.text,
629
- icon_url: embed.footer.iconUrl,
630
- proxy_icon_url: embed.footer.proxyIconUrl,
629
+ icon_url: embed.footer.iconURL,
630
+ proxy_icon_url: embed.footer.proxyIconURL,
631
631
  }
632
632
  : undefined,
633
633
  image: embed.image !== undefined
634
634
  ? {
635
635
  url: embed.image.url,
636
- proxy_url: embed.image.proxyUrl,
636
+ proxy_url: embed.image.proxyURL,
637
637
  height: embed.image.height,
638
638
  width: embed.image.width,
639
639
  }
@@ -641,14 +641,14 @@ class Util {
641
641
  thumbnail: embed.thumbnail !== undefined
642
642
  ? {
643
643
  url: embed.thumbnail.url,
644
- proxy_url: embed.thumbnail.proxyUrl,
644
+ proxy_url: embed.thumbnail.proxyURL,
645
645
  height: embed.thumbnail.height,
646
646
  width: embed.thumbnail.width,
647
647
  }
648
648
  : undefined,
649
649
  video: {
650
650
  url: embed.video?.url,
651
- proxy_url: embed.video?.proxyUrl,
651
+ proxy_url: embed.video?.proxyURL,
652
652
  height: embed.video?.height,
653
653
  width: embed.video?.width,
654
654
  },
@@ -660,8 +660,8 @@ class Util {
660
660
  ? {
661
661
  name: embed.author.name,
662
662
  url: embed.author.url,
663
- icon_url: embed.author.iconUrl,
664
- proxy_icon_url: embed.author.proxyIconUrl,
663
+ icon_url: embed.author.iconURL,
664
+ proxy_icon_url: embed.author.proxyIconURL,
665
665
  }
666
666
  : undefined,
667
667
  fields: embed.fields?.map((field) => ({
@@ -729,6 +729,30 @@ class Util {
729
729
  subscription_id: entitlement.subscriptionId,
730
730
  };
731
731
  }
732
+ guildApplicationCommandPermissionsFromRaw(guildApplicationCommandPermissions) {
733
+ return {
734
+ id: guildApplicationCommandPermissions.id,
735
+ applicationId: guildApplicationCommandPermissions.application_id,
736
+ guildId: guildApplicationCommandPermissions.guild_id,
737
+ permissions: guildApplicationCommandPermissions.permissions.map((permission) => ({
738
+ id: permission.id,
739
+ type: permission.type,
740
+ permission: permission.permission,
741
+ })),
742
+ };
743
+ }
744
+ guildApplicationCommandPermissionsToRaw(guildApplicationCommandPermissions) {
745
+ return {
746
+ id: guildApplicationCommandPermissions.id,
747
+ application_id: guildApplicationCommandPermissions.applicationId,
748
+ guild_id: guildApplicationCommandPermissions.guildId,
749
+ permissions: guildApplicationCommandPermissions.permissions.map((permission) => ({
750
+ id: permission.id,
751
+ type: permission.type,
752
+ permission: permission.permission,
753
+ })),
754
+ };
755
+ }
732
756
  guildFromRaw(guild) {
733
757
  return {
734
758
  id: guild.id,
@@ -758,7 +782,7 @@ class Util {
758
782
  rulesChannelId: guild.rules_channel_id,
759
783
  maxPresences: guild.max_presences,
760
784
  maxMembers: guild.max_members,
761
- vanityUrlCode: guild.vanity_url_code,
785
+ vanityURLCode: guild.vanity_url_code,
762
786
  description: guild.description,
763
787
  banner: guild.banner,
764
788
  premiumTier: guild.premium_tier,
@@ -815,7 +839,7 @@ class Util {
815
839
  rules_channel_id: guild.rulesChannelId,
816
840
  max_presences: guild.maxPresences,
817
841
  max_members: guild.maxMembers,
818
- vanity_url_code: guild.vanityUrlCode,
842
+ vanity_url_code: guild.vanityURLCode,
819
843
  description: guild.description,
820
844
  banner: guild.banner,
821
845
  premium_tier: guild.premiumTier,
@@ -1052,6 +1076,13 @@ class Util {
1052
1076
  })),
1053
1077
  }
1054
1078
  : undefined,
1079
+ guild: interaction.guild !== undefined
1080
+ ? {
1081
+ locale: interaction.guild.locale,
1082
+ id: interaction.guild.id,
1083
+ features: interaction.guild.features,
1084
+ }
1085
+ : undefined,
1055
1086
  guildId: interaction.guild_id,
1056
1087
  channel: interaction.channel !== undefined
1057
1088
  ? this.channelFromRaw(interaction.channel)
@@ -1072,6 +1103,11 @@ class Util {
1072
1103
  locale: interaction.locale,
1073
1104
  guildLocale: interaction.guild_locale,
1074
1105
  entitlements: interaction.entitlements.map((entitlement) => this.entitlementFromRaw(entitlement)),
1106
+ authorizingIntegrationOwners: {
1107
+ "0": interaction.authorizing_integration_owners[0],
1108
+ "1": interaction.authorizing_integration_owners[1],
1109
+ },
1110
+ context: interaction.context,
1075
1111
  };
1076
1112
  }
1077
1113
  interactionToRaw(interaction) {
@@ -1109,6 +1145,13 @@ class Util {
1109
1145
  })),
1110
1146
  }
1111
1147
  : undefined,
1148
+ guild: interaction.guild !== undefined
1149
+ ? {
1150
+ locale: interaction.guild.locale,
1151
+ id: interaction.guild.id,
1152
+ features: interaction.guild.features,
1153
+ }
1154
+ : undefined,
1112
1155
  guild_id: interaction.guildId,
1113
1156
  channel: interaction.channel !== undefined
1114
1157
  ? this.channelToRaw(interaction.channel)
@@ -1129,6 +1172,11 @@ class Util {
1129
1172
  locale: interaction.locale,
1130
1173
  guild_locale: interaction.guildLocale,
1131
1174
  entitlements: interaction.entitlements.map((entitlement) => this.entitlementToRaw(entitlement)),
1175
+ authorizing_integration_owners: {
1176
+ "0": interaction.authorizingIntegrationOwners[0],
1177
+ "1": interaction.authorizingIntegrationOwners[1],
1178
+ },
1179
+ context: interaction.context,
1132
1180
  };
1133
1181
  }
1134
1182
  interactionMetadataFromRaw(interactionMetadata) {
@@ -1247,6 +1295,7 @@ class Util {
1247
1295
  }
1248
1296
  : undefined,
1249
1297
  customId: c.custom_id,
1298
+ skuId: c.sku_id,
1250
1299
  url: c.url,
1251
1300
  disabled: c.disabled,
1252
1301
  };
@@ -1334,6 +1383,7 @@ class Util {
1334
1383
  }
1335
1384
  : undefined,
1336
1385
  custom_id: c.customId,
1386
+ sku_id: c.skuId,
1337
1387
  url: c.url,
1338
1388
  disabled: c.disabled,
1339
1389
  };
@@ -1892,7 +1942,7 @@ class Util {
1892
1942
  return {
1893
1943
  id: sku.id,
1894
1944
  type: sku.type,
1895
- dependentSkuId: sku.dependent_sku_id,
1945
+ dependentSKUId: sku.dependent_sku_id,
1896
1946
  applicationId: sku.application_id,
1897
1947
  manifestLabels: sku.manifest_labels,
1898
1948
  accessType: sku.access_type,
@@ -1908,7 +1958,7 @@ class Util {
1908
1958
  return {
1909
1959
  id: sku.id,
1910
1960
  type: sku.type,
1911
- dependent_sku_id: sku.dependentSkuId,
1961
+ dependent_sku_id: sku.dependentSKUId,
1912
1962
  application_id: sku.applicationId,
1913
1963
  manifest_labels: sku.manifestLabels,
1914
1964
  access_type: sku.accessType,
@@ -2002,6 +2052,28 @@ class Util {
2002
2052
  owner_user_id: team.ownerUserId,
2003
2053
  };
2004
2054
  }
2055
+ threadMemberFromRaw(threadMember) {
2056
+ return {
2057
+ id: threadMember.id,
2058
+ userId: threadMember.user_id,
2059
+ joinTimestamp: threadMember.join_timestamp,
2060
+ flags: threadMember.flags,
2061
+ member: threadMember.member !== undefined
2062
+ ? this.guildMemberFromRaw(threadMember.member)
2063
+ : undefined,
2064
+ };
2065
+ }
2066
+ threadMemberToRaw(threadMember) {
2067
+ return {
2068
+ id: threadMember.id,
2069
+ user_id: threadMember.userId,
2070
+ join_timestamp: threadMember.joinTimestamp,
2071
+ flags: threadMember.flags,
2072
+ member: threadMember.member !== undefined
2073
+ ? this.guildMemberToRaw(threadMember.member)
2074
+ : undefined,
2075
+ };
2076
+ }
2005
2077
  testEntitlementFromRaw(entitlement) {
2006
2078
  return {
2007
2079
  id: entitlement.id,
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.0-dev.301452e",
3
+ "version": "2.2.0-dev.a9ab94a",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
@@ -13,6 +13,9 @@
13
13
  "bot",
14
14
  "discord",
15
15
  "gateway",
16
+ "http",
17
+ "https",
18
+ "rest",
16
19
  "wrapper"
17
20
  ],
18
21
  "author": "XenKys",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.0-dev.301452e",
3
+ "version": "2.2.0-dev.a9ab94a",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
@@ -13,6 +13,9 @@
13
13
  "bot",
14
14
  "discord",
15
15
  "gateway",
16
+ "http",
17
+ "https",
18
+ "rest",
16
19
  "wrapper"
17
20
  ],
18
21
  "author": "XenKys",