disgroove 2.2.2 → 2.2.3-dev.10e8e97

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 (36) hide show
  1. package/README.md +2 -2
  2. package/dist/lib/Client.d.ts +72 -80
  3. package/dist/lib/Client.js +209 -100
  4. package/dist/lib/gateway/Shard.d.ts +1 -0
  5. package/dist/lib/gateway/Shard.js +11 -5
  6. package/dist/lib/gateway/index.d.ts +0 -1
  7. package/dist/lib/gateway/index.js +0 -1
  8. package/dist/lib/transformers/ApplicationCommands.d.ts +7 -0
  9. package/dist/lib/transformers/ApplicationCommands.js +90 -0
  10. package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.d.ts +5 -0
  11. package/dist/lib/transformers/ApplicationRoleConnectionMetadatas.js +26 -0
  12. package/dist/lib/transformers/Applications.d.ts +0 -3
  13. package/dist/lib/transformers/Applications.js +0 -114
  14. package/dist/lib/transformers/AuditLogs.js +3 -3
  15. package/dist/lib/transformers/AutoModeration.d.ts +5 -1
  16. package/dist/lib/transformers/AutoModeration.js +44 -32
  17. package/dist/lib/transformers/Guilds.js +16 -0
  18. package/dist/lib/transformers/Presences.d.ts +0 -3
  19. package/dist/lib/transformers/Presences.js +52 -44
  20. package/dist/lib/transformers/Users.js +16 -2
  21. package/dist/lib/transformers/index.d.ts +2 -0
  22. package/dist/lib/transformers/index.js +2 -0
  23. package/dist/lib/types/gateway-events.d.ts +4 -4
  24. package/dist/lib/types/guild.d.ts +3 -1
  25. package/dist/lib/types/user.d.ts +2 -2
  26. package/dist/lib/utils/errors.js +4 -4
  27. package/dist/lib/utils/formatters.d.ts +7 -0
  28. package/dist/lib/utils/formatters.js +7 -1
  29. package/dist/lib/utils/index.d.ts +0 -1
  30. package/dist/lib/utils/index.js +0 -1
  31. package/dist/package.json +1 -1
  32. package/package.json +1 -1
  33. package/dist/lib/gateway/ShardManager.d.ts +0 -10
  34. package/dist/lib/gateway/ShardManager.js +0 -18
  35. package/dist/lib/utils/Util.d.ts +0 -4
  36. package/dist/lib/utils/Util.js +0 -63
@@ -4,7 +4,7 @@ import type { snowflake, timestamp } from "./common";
4
4
  import type { RawEmoji, Emoji } from "./emoji";
5
5
  import type { RawRole, Role } from "./role";
6
6
  import type { RawSticker, Sticker } from "./sticker";
7
- import type { RawUser, User } from "./user";
7
+ import type { AvatarDecorationData, RawAvatarDecorationData, RawUser, User } from "./user";
8
8
  /** https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */
9
9
  export interface RawGuild {
10
10
  id: snowflake;
@@ -98,6 +98,7 @@ export interface RawGuildMember {
98
98
  pending?: boolean;
99
99
  permissions?: string;
100
100
  communication_disabled_until?: number | null;
101
+ avatar_decoration_data?: RawAvatarDecorationData | null;
101
102
  }
102
103
  /** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */
103
104
  export interface RawIntegration {
@@ -265,6 +266,7 @@ export interface GuildMember {
265
266
  pending?: boolean;
266
267
  permissions?: string;
267
268
  communicationDisabledUntil?: number | null;
269
+ avatarDecorationData?: AvatarDecorationData | null;
268
270
  }
269
271
  export interface Integration {
270
272
  id: snowflake;
@@ -20,7 +20,7 @@ export interface RawUser {
20
20
  flags?: UserFlags;
21
21
  premium_type?: PremiumTypes;
22
22
  public_flags?: UserFlags;
23
- avatar_decoration?: string | null;
23
+ avatar_decoration_data?: RawAvatarDecorationData | null;
24
24
  }
25
25
  /** https://discord.com/developers/docs/resources/user#avatar-decoration-data-object-avatar-decoration-data-structure */
26
26
  export interface RawAvatarDecorationData {
@@ -63,7 +63,7 @@ export interface User {
63
63
  flags?: UserFlags;
64
64
  premiumType?: PremiumTypes;
65
65
  publicFlags?: UserFlags;
66
- avatarDecoration?: string | null;
66
+ avatarDecorationData?: AvatarDecorationData | null;
67
67
  }
68
68
  export interface AvatarDecorationData {
69
69
  asset: string;
@@ -11,7 +11,7 @@ class RESTError extends Error {
11
11
  this.endpoint = endpoint;
12
12
  }
13
13
  static flattenErrors(errors, prefix = "") {
14
- let result = "";
14
+ let message = "";
15
15
  if (errors) {
16
16
  for (const [key, value] of Object.entries(errors)) {
17
17
  if (errors.hasOwnProperty(key)) {
@@ -20,17 +20,17 @@ class RESTError extends Error {
20
20
  if (typeof error === "object" &&
21
21
  error !== null &&
22
22
  "message" in error) {
23
- result += `${prefix ? `${prefix}: [${error.code}]` : `[${error.code}]`} ${error.message}\n`;
23
+ message += `${prefix ? `${prefix}: [${error.code}]` : `[${error.code}]`} ${error.message}\n`;
24
24
  }
25
25
  }
26
26
  }
27
27
  else if (typeof value === "object" && value !== null) {
28
- result += this.flattenErrors(value, prefix ? `${prefix}.${key}` : key);
28
+ message += this.flattenErrors(value, prefix ? `${prefix}.${key}` : key);
29
29
  }
30
30
  }
31
31
  }
32
32
  }
33
- return result;
33
+ return message;
34
34
  }
35
35
  }
36
36
  exports.RESTError = RESTError;
@@ -1,9 +1,16 @@
1
1
  import type { GuildNavigationTypes, TimestampStyles } from "../constants";
2
2
  import type { snowflake } from "../types/common";
3
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
3
4
  export declare function userMention(userID: snowflake): string;
5
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
4
6
  export declare function channelMention(channelID: snowflake): string;
7
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
5
8
  export declare function roleMention(roleID: snowflake): string;
9
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
6
10
  export declare function slashCommandMention(commandName: string, commandID: snowflake, subCommandName?: string, subCommandGroupName?: string): string;
11
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
7
12
  export declare function customEmoji(emojiName: string, emojiID: snowflake, animated?: boolean): string;
13
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
8
14
  export declare function unixTimestamp(time: number, style?: TimestampStyles): string;
15
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
9
16
  export declare function guildNavigation(guildID: snowflake, type: GuildNavigationTypes): string;
@@ -1,19 +1,22 @@
1
1
  "use strict";
2
- /* https://discord.com/developers/docs/reference#message-formatting */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.guildNavigation = exports.unixTimestamp = exports.customEmoji = exports.slashCommandMention = exports.roleMention = exports.channelMention = exports.userMention = void 0;
4
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
5
5
  function userMention(userID) {
6
6
  return `<@${userID}>`;
7
7
  }
8
8
  exports.userMention = userMention;
9
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
9
10
  function channelMention(channelID) {
10
11
  return `<#${channelID}>`;
11
12
  }
12
13
  exports.channelMention = channelMention;
14
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
13
15
  function roleMention(roleID) {
14
16
  return `<@&${roleID}>`;
15
17
  }
16
18
  exports.roleMention = roleMention;
19
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
17
20
  function slashCommandMention(commandName, commandID, subCommandName, subCommandGroupName) {
18
21
  return subCommandName
19
22
  ? subCommandGroupName
@@ -22,16 +25,19 @@ function slashCommandMention(commandName, commandID, subCommandName, subCommandG
22
25
  : `</${commandName}:${commandID}>`;
23
26
  }
24
27
  exports.slashCommandMention = slashCommandMention;
28
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
25
29
  function customEmoji(emojiName, emojiID, animated) {
26
30
  return animated
27
31
  ? `<a:${emojiName}:${emojiID}>`
28
32
  : `<:${emojiName}:${emojiID}>`;
29
33
  }
30
34
  exports.customEmoji = customEmoji;
35
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
31
36
  function unixTimestamp(time, style) {
32
37
  return style ? `<t:${time}:${style}>` : `<t:${time}>`;
33
38
  }
34
39
  exports.unixTimestamp = unixTimestamp;
40
+ /** https://discord.com/developers/docs/reference#message-formatting-formats */
35
41
  function guildNavigation(guildID, type) {
36
42
  return `<${guildID}:${type}>`;
37
43
  }
@@ -1,4 +1,3 @@
1
1
  export * as CDN from "./CDN";
2
2
  export * from "./errors";
3
3
  export * from "./formatters";
4
- export * from "./Util";
@@ -30,4 +30,3 @@ exports.CDN = void 0;
30
30
  exports.CDN = __importStar(require("./CDN"));
31
31
  __exportStar(require("./errors"), exports);
32
32
  __exportStar(require("./formatters"), exports);
33
- __exportStar(require("./Util"), exports);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.2",
3
+ "version": "2.2.3-dev.10e8e97",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.2",
3
+ "version": "2.2.3-dev.10e8e97",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
@@ -1,10 +0,0 @@
1
- import type { Shard } from ".";
2
- import type { GatewayPresenceUpdate } from "../types/gateway-events";
3
- export declare class ShardManager extends Map<number, Shard> {
4
- /** https://discord.com/developers/docs/topics/gateway#connections */
5
- connect(): void;
6
- /** https://discord.com/developers/docs/topics/gateway#connections */
7
- disconnect(): void;
8
- /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
9
- updatePresence(options: Partial<Pick<GatewayPresenceUpdate, "activities" | "status" | "afk">>): void;
10
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShardManager = void 0;
4
- class ShardManager extends Map {
5
- /** https://discord.com/developers/docs/topics/gateway#connections */
6
- connect() {
7
- this.forEach((shard) => shard.connect());
8
- }
9
- /** https://discord.com/developers/docs/topics/gateway#connections */
10
- disconnect() {
11
- this.forEach((shard) => shard.disconnect());
12
- }
13
- /** https://discord.com/developers/docs/topics/gateway-events#update-presence */
14
- updatePresence(options) {
15
- this.forEach((shard) => shard.updatePresence(options));
16
- }
17
- }
18
- exports.ShardManager = ShardManager;
@@ -1,4 +0,0 @@
1
- import type { ApplicationCommand, RawApplicationCommand } from "../types/application-command";
2
- export declare class Util {
3
- partialApplicationCommandToRaw(applicationCommand: Partial<ApplicationCommand>): Partial<RawApplicationCommand>;
4
- }
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Util = void 0;
4
- class Util {
5
- partialApplicationCommandToRaw(applicationCommand) {
6
- return {
7
- id: applicationCommand.id,
8
- type: applicationCommand.type,
9
- application_id: applicationCommand.applicationID,
10
- guild_id: applicationCommand.guildID,
11
- name: applicationCommand.name,
12
- name_localizations: applicationCommand.nameLocalizations,
13
- description: applicationCommand.description,
14
- description_localizations: applicationCommand.descriptionLocalizations,
15
- options: applicationCommand.options?.map((option) => ({
16
- type: option.type,
17
- name: option.name,
18
- name_localizations: option.nameLocalizations,
19
- description: option.description,
20
- description_localizations: option.descriptionLocalizations,
21
- required: option.required,
22
- choices: option.choices?.map((choice) => ({
23
- name: choice.name,
24
- name_localizations: choice.nameLocalizations,
25
- value: choice.value,
26
- })),
27
- options: option.options?.map((o) => ({
28
- type: o.type,
29
- name: o.name,
30
- name_localizations: o.nameLocalizations,
31
- description: o.description,
32
- description_localizations: o.descriptionLocalizations,
33
- required: o.required,
34
- choices: o.choices?.map((choice) => ({
35
- name: choice.name,
36
- name_localizations: choice.nameLocalizations,
37
- value: choice.value,
38
- })),
39
- channel_types: o.channelTypes,
40
- min_value: o.minValue,
41
- max_value: o.maxValue,
42
- min_length: o.minLength,
43
- max_length: o.maxLength,
44
- autocomplete: o.autocomplete,
45
- })),
46
- channel_types: option.channelTypes,
47
- min_value: option.minValue,
48
- max_value: option.maxValue,
49
- min_length: option.minLength,
50
- max_length: option.maxLength,
51
- autocomplete: option.autocomplete,
52
- })),
53
- default_member_permissions: applicationCommand.defaultMemberPermissions,
54
- dm_permission: applicationCommand.dmPermission,
55
- default_permission: applicationCommand.defaultPermission,
56
- integration_types: applicationCommand.integrationTypes,
57
- contexts: applicationCommand.contexts,
58
- nsfw: applicationCommand.nsfw,
59
- version: applicationCommand.version,
60
- };
61
- }
62
- }
63
- exports.Util = Util;