@elara-services/packages 3.0.0 → 4.0.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 +15 -0
- package/index.d.ts +28 -17
- package/package.json +1 -1
- package/packages/SlashBuilder.js +13 -9
package/CHANGELOG
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# v4.0.0
|
2
|
+
__Breaking Change__
|
3
|
+
The following functions & methods for `SlashBuilder` was moved to `static`
|
4
|
+
> So you no longer need to do `new (require("@elara-services/packages").SlashBuilder)()`
|
5
|
+
|
6
|
+
|
7
|
+
# v3.0.3
|
8
|
+
Added 'types.context.user', 'types.context.message' and the typings for SlashBuilder
|
9
|
+
|
10
|
+
|
11
|
+
# v3.0.1, v3.0.2
|
12
|
+
|
13
|
+
Fixed the typings for modal and added the typings for "ButtonStyle"
|
14
|
+
|
15
|
+
|
1
16
|
# v3.0.0
|
2
17
|
|
3
18
|
__Breaking Changes__
|
package/index.d.ts
CHANGED
@@ -37,7 +37,7 @@ declare module "@elara-services/packages" {
|
|
37
37
|
public static button(options: ButtonOptions): Button;
|
38
38
|
public static select(options: SelectOptions): Select;
|
39
39
|
public static modal(options: ModalOptions): Modal;
|
40
|
-
}
|
40
|
+
}
|
41
41
|
|
42
42
|
export type ChannelTypes = 'GUILD_TEXT' | 'DM' | 'GUILD_VOICE' | 'GROUP_DM' | 'GUILD_CATEGORY' | 'GUILD_NEWS' | 'GUILD_STORE' | 'GUILD_NEWS_THREAD' | 'GUILD_PUBLIC_THREAD' | 'GUILD_PRIVATE_THREAD' | 'GUILD_STAGE_VOICE';
|
43
43
|
|
@@ -62,8 +62,10 @@ declare module "@elara-services/packages" {
|
|
62
62
|
}
|
63
63
|
|
64
64
|
export class SlashBuilder {
|
65
|
-
|
66
|
-
public
|
65
|
+
|
66
|
+
public static TEXT_BASED_CHANNELS: number[];
|
67
|
+
|
68
|
+
public static types: {
|
67
69
|
sub_command: number,
|
68
70
|
sub_group: number,
|
69
71
|
string: number,
|
@@ -73,17 +75,21 @@ declare module "@elara-services/packages" {
|
|
73
75
|
channel: number,
|
74
76
|
role: number,
|
75
77
|
mentionable: number,
|
76
|
-
number: number
|
78
|
+
number: number,
|
79
|
+
context: {
|
80
|
+
user: number;
|
81
|
+
message: number;
|
82
|
+
}
|
77
83
|
};
|
78
84
|
|
79
|
-
public context: {
|
85
|
+
public static context: {
|
80
86
|
user(name: string): Slash;
|
81
87
|
message(name: string): Slash;
|
82
88
|
};
|
83
89
|
|
84
|
-
public choice(name: string, value: string|number): { name: string, value: string|number };
|
85
|
-
public option(data: SlashOptions): Slash;
|
86
|
-
public create(name: string, description: string, options: Slash): Slash;
|
90
|
+
public static choice(name: string, value: string|number): { name: string, value: string|number };
|
91
|
+
public static option(data: SlashOptions): Slash;
|
92
|
+
public static create(name: string, description: string, options: Slash): Slash;
|
87
93
|
}
|
88
94
|
|
89
95
|
export type Button = {
|
@@ -106,6 +112,8 @@ declare module "@elara-services/packages" {
|
|
106
112
|
url?: Button['url']
|
107
113
|
}
|
108
114
|
|
115
|
+
export type ButtonStyles = 'PRIMARY' | 'BLURPLE' | 'SECONDARY' | 'GREY' | 'SUCCESS' | 'GREEN' | 'DANGER' | 'RED' | 'LINK' | 'URL'
|
116
|
+
|
109
117
|
export type Select = {
|
110
118
|
custom_id: string;
|
111
119
|
placeholder: string;
|
@@ -135,15 +143,18 @@ declare module "@elara-services/packages" {
|
|
135
143
|
title: string;
|
136
144
|
custom_id: string;
|
137
145
|
components: {
|
138
|
-
type: number
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
146
|
+
type: number,
|
147
|
+
components: {
|
148
|
+
type: number;
|
149
|
+
custom_id: string;
|
150
|
+
label: string;
|
151
|
+
style: 1 | 2 | number;
|
152
|
+
min_length?: number;
|
153
|
+
max_length?: number;
|
154
|
+
required?: boolean;
|
155
|
+
value?: string;
|
156
|
+
placeholder?: string;
|
157
|
+
}[]
|
147
158
|
}[]
|
148
159
|
}
|
149
160
|
|
package/package.json
CHANGED
package/packages/SlashBuilder.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module.exports = class SlashBuilder {
|
2
|
-
|
3
|
-
|
4
|
-
}
|
1
|
+
module.exports = class SlashBuilder extends null {
|
2
|
+
static get TEXT_BASED_CHANNELS() {
|
3
|
+
return [ 0, 5, 11, 12 ]
|
4
|
+
}
|
5
5
|
|
6
|
-
get types() {
|
6
|
+
static get types() {
|
7
7
|
return {
|
8
8
|
sub_command: 1,
|
9
9
|
sub_group: 2,
|
@@ -15,25 +15,29 @@ module.exports = class SlashBuilder {
|
|
15
15
|
role: 8,
|
16
16
|
mentionable: 9,
|
17
17
|
number: 10,
|
18
|
+
context: {
|
19
|
+
user: 2,
|
20
|
+
message: 3
|
21
|
+
}
|
18
22
|
};
|
19
23
|
}
|
20
24
|
|
21
|
-
get context() {
|
25
|
+
static get context() {
|
22
26
|
return {
|
23
27
|
user: (name) => this.create(name, "", { type: 2 }),
|
24
28
|
message: (name) => this.create(name, "", { type: 3 })
|
25
29
|
}
|
26
30
|
};
|
27
31
|
|
28
|
-
choice(name, value) {
|
32
|
+
static choice(name, value) {
|
29
33
|
return { name, value };
|
30
34
|
};
|
31
35
|
|
32
|
-
option(data) {
|
36
|
+
static option(data) {
|
33
37
|
return data;
|
34
38
|
};
|
35
39
|
|
36
|
-
create(name, description, options = { }) {
|
40
|
+
static create(name, description, options = { }) {
|
37
41
|
let obj = { name, description };
|
38
42
|
if (options?.options?.length) obj.options = options.options;
|
39
43
|
if (options.type) obj.type = options.type;
|