disgroove 2.2.2 → 2.2.3-dev.4f98e3d

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.
@@ -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.4f98e3d",
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.4f98e3d",
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,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;