@elara-services/packages 3.0.1 → 4.0.1
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 +16 -1
- package/index.d.ts +19 -9
- package/package.json +1 -1
- package/packages/SlashBuilder.js +13 -9
- package/packages/languages.js +13 -2
package/CHANGELOG
CHANGED
@@ -1,4 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# v4.0.1
|
2
|
+
Added
|
3
|
+
- Languages.find
|
4
|
+
- Languages.langs
|
5
|
+
|
6
|
+
# v4.0.0
|
7
|
+
__Breaking Change__
|
8
|
+
The following functions & methods for `SlashBuilder` was moved to `static`
|
9
|
+
> So you no longer need to do `new (require("@elara-services/packages").SlashBuilder)()`
|
10
|
+
|
11
|
+
|
12
|
+
# v3.0.3
|
13
|
+
Added 'types.context.user', 'types.context.message' and the typings for SlashBuilder
|
14
|
+
|
15
|
+
|
16
|
+
# v3.0.1, v3.0.2
|
2
17
|
|
3
18
|
Fixed the typings for modal and added the typings for "ButtonStyle"
|
4
19
|
|
package/index.d.ts
CHANGED
@@ -9,7 +9,11 @@ declare module "@elara-services/packages" {
|
|
9
9
|
public decrypt(encrypted: string): string;
|
10
10
|
}
|
11
11
|
|
12
|
-
export const Languages:
|
12
|
+
export const Languages: {
|
13
|
+
find(name: string): string | null;
|
14
|
+
langs: object
|
15
|
+
}
|
16
|
+
|
13
17
|
export class Minesweeper {
|
14
18
|
public constructor(options?: {
|
15
19
|
rows?: number;
|
@@ -62,8 +66,10 @@ declare module "@elara-services/packages" {
|
|
62
66
|
}
|
63
67
|
|
64
68
|
export class SlashBuilder {
|
65
|
-
|
66
|
-
public
|
69
|
+
|
70
|
+
public static TEXT_BASED_CHANNELS: number[];
|
71
|
+
|
72
|
+
public static types: {
|
67
73
|
sub_command: number,
|
68
74
|
sub_group: number,
|
69
75
|
string: number,
|
@@ -73,17 +79,21 @@ declare module "@elara-services/packages" {
|
|
73
79
|
channel: number,
|
74
80
|
role: number,
|
75
81
|
mentionable: number,
|
76
|
-
number: number
|
82
|
+
number: number,
|
83
|
+
context: {
|
84
|
+
user: number;
|
85
|
+
message: number;
|
86
|
+
}
|
77
87
|
};
|
78
88
|
|
79
|
-
public context: {
|
89
|
+
public static context: {
|
80
90
|
user(name: string): Slash;
|
81
91
|
message(name: string): Slash;
|
82
92
|
};
|
83
93
|
|
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;
|
94
|
+
public static choice(name: string, value: string|number): { name: string, value: string|number };
|
95
|
+
public static option(data: SlashOptions): Slash;
|
96
|
+
public static create(name: string, description: string, options: Slash): Slash;
|
87
97
|
}
|
88
98
|
|
89
99
|
export type Button = {
|
@@ -149,7 +159,7 @@ declare module "@elara-services/packages" {
|
|
149
159
|
value?: string;
|
150
160
|
placeholder?: string;
|
151
161
|
}[]
|
152
|
-
}
|
162
|
+
}[]
|
153
163
|
}
|
154
164
|
|
155
165
|
export type ModalOptions = {
|
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;
|
package/packages/languages.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
const langs = {
|
2
2
|
'en': 'English',
|
3
3
|
'fr': 'French',
|
4
4
|
'es': 'Spanish',
|
@@ -105,4 +105,15 @@ module.exports = {
|
|
105
105
|
'yi': 'Yiddish',
|
106
106
|
'yo': 'Yoruba',
|
107
107
|
'zu': 'Zulu'
|
108
|
-
};
|
108
|
+
};
|
109
|
+
/** @deprecated */
|
110
|
+
module.exports = langs;
|
111
|
+
module.exports.langs = langs;
|
112
|
+
|
113
|
+
module.exports.find = (name) => {
|
114
|
+
for (const key of Object.keys(langs)) {
|
115
|
+
if (key === name) return key;
|
116
|
+
if (langs[key] === name) return key;
|
117
|
+
}
|
118
|
+
return null;
|
119
|
+
}
|