@elara-services/packages 4.8.0 → 5.1.0

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/CHANGELOG CHANGED
@@ -1,4 +1,16 @@
1
- # v4.8.0
1
+ # v5.1.0
2
+ - Added `name_localizations` for `SlashBuilder.choice`
3
+ - Added typings for `min_length` and `max_length` for `SlashBuilder.option` for STRING options.
4
+ - Fixed typings for `Interactions.button` to have `label` and `title`
5
+ - Fixed `Interactions.button` to allow for `title` and `label`
6
+
7
+
8
+ # v5.0.0
9
+ ### BREAKING CHANGES
10
+ - `locale` option for `SlashBuilder.context.user` and `SlashBuilder.context.message` was turned into `options` taking in more options (to support both permissions and locale)
11
+ - `defaultPermission`/`default_permission` was removed, since it's deprecated. (if you want to use it then stay on v4.8.1)
12
+
13
+ # v4.8.0/v4.8.1
2
14
  - Added: `dmPermission` (`dm_permission`) for SlashBuilder.create
3
15
  - Added: `defaultMemberPermissions` (`default_member_permissions`) for SlashBuilder.create
4
16
  - Deprecated `defaultPermission` (`default_permission`) for SlashBuilder.create
package/index.d.ts CHANGED
@@ -54,6 +54,8 @@ declare module "@elara-services/packages" {
54
54
  autocomplete?: boolean;
55
55
  min_value?: number;
56
56
  max_value?: number;
57
+ min_length?: number;
58
+ max_length?: number;
57
59
  choices?: { name: string, value: string }[];
58
60
  options?: SlashOptions[];
59
61
  locale?: {
@@ -76,10 +78,6 @@ declare module "@elara-services/packages" {
76
78
  names?: object;
77
79
  descriptions?: object;
78
80
  }
79
- /** @deprecated - Use defaultMemberPermissions or dmPermission */
80
- defaultPermission?: boolean;
81
- /** @deprecated - Use defaultMemberPermissions or dmPermission */
82
- default_permission?: boolean;
83
81
  }
84
82
 
85
83
  export class SlashBuilder {
@@ -104,11 +102,11 @@ declare module "@elara-services/packages" {
104
102
  };
105
103
 
106
104
  public static context: {
107
- user(name: string, locale?: { names?: object }): Slash;
108
- message(name: string, locale?: { names?: object }): Slash;
105
+ user(name: string, options?: Omit<Slash, "options"|"type">): Slash;
106
+ message(name: string, options?: Omit<Slash, "options"|"type">): Slash;
109
107
  };
110
108
 
111
- public static choice(name: string, value: string|number): { name: string, value: string|number };
109
+ public static choice(name: string, value: string|number, name_localizations?: object): { name: string, value: string|number, name_localizations: object };
112
110
  public static option(data: SlashOptions): Slash;
113
111
  public static create(name: string, description: string, options: Slash): Slash;
114
112
  }
@@ -125,6 +123,8 @@ declare module "@elara-services/packages" {
125
123
 
126
124
  export type ButtonOptions = {
127
125
  id?: Button['custom_id'];
126
+ title?: Button['label'];
127
+ label?: Button['label'];
128
128
  custom_id?: Button['custom_id'];
129
129
  type?: Button['type'];
130
130
  style?: ButtonStyles | Button['style'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elara-services/packages",
3
- "version": "4.8.0",
3
+ "version": "5.1.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "./index.d.ts",
@@ -12,7 +12,7 @@ module.exports = class Interactions extends null {
12
12
  }
13
13
  return {
14
14
  custom_id: options?.id ?? options?.custom_id ?? "",
15
- label: options?.title ?? "",
15
+ label: options?.title ?? options?.label ?? "",
16
16
  type: options?.type ?? 2,
17
17
  style: options?.style ? options.style : 2,
18
18
  disabled: Boolean(options.disabled),
@@ -24,13 +24,13 @@ module.exports = class SlashBuilder extends null {
24
24
 
25
25
  static get context() {
26
26
  return {
27
- user: (name, locale) => this.create(name, "", { type: this.types.context.user, locale }),
28
- message: (name, locale) => this.create(name, "", { type: this.types.context.message, locale })
27
+ user: (name, options) => this.create(name, "", { type: this.types.context.user, ...options }),
28
+ message: (name, options) => this.create(name, "", { type: this.types.context.message, ...options })
29
29
  }
30
30
  };
31
31
 
32
- static choice(name, value) {
33
- return { name, value };
32
+ static choice(name, value, name_localizations) {
33
+ return { name, value, name_localizations };
34
34
  };
35
35
 
36
36
  static option(data) {
@@ -48,12 +48,8 @@ module.exports = class SlashBuilder extends null {
48
48
  if (options?.options?.length) obj.options = options.options;
49
49
  if (options?.type) obj.type = options.type;
50
50
 
51
- // TODO: Remove this, as it's deprecated.
52
- if ("defaultPermission" in options) obj.default_permission = options.defaultPermission;
53
- else if ("default_permission" in options) obj.default_permission = options.default_permission;
54
-
55
- if ("dmPermission" in options) obj.dm_permission = obj.dmPermission;
56
- else if ("dm_permission" in options) obj.dm_permission = obj.dm_permission;
51
+ if ("dmPermission" in options) obj.dm_permission = options.dmPermission;
52
+ else if ("dm_permission" in options) obj.dm_permission = options.dm_permission;
57
53
 
58
54
  if ("default_member_permissions" in options) obj.default_member_permissions = options.default_member_permissions;
59
55
  else if ("defaultMemberPermissions" in options) obj.default_member_permissions = options.defaultMemberPermissions;