@fallencodes/seyfert-utils 1.2.4 → 1.2.6
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/build/handleCommand.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ModalSubmitInteraction, ComponentInteraction } from 'seyfert';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function handleMessageComponent(this: HandleCommand, interaction: ComponentInteraction): Promise<void>;
|
|
2
|
+
export declare function handleModal(interaction: ModalSubmitInteraction): Promise<void>;
|
|
3
|
+
export declare function handleMessageComponent(interaction: ComponentInteraction): Promise<void>;
|
|
5
4
|
//# sourceMappingURL=handleCommand.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleCommand.d.ts","sourceRoot":"","sources":["../src/handleCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAwE,oBAAoB,EAAoB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"handleCommand.d.ts","sourceRoot":"","sources":["../src/handleCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAwE,oBAAoB,EAAoB,MAAM,SAAS,CAAC;AAG/J,wBAAsB,WAAW,CAAC,WAAW,EAAE,sBAAsB,iBAgBpE;AAGD,wBAAsB,sBAAsB,CAAC,WAAW,EAAE,oBAAoB,iBAkB7E"}
|
package/build/handleCommand.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ModalContext, InteractionCommandType, ComponentContext } from 'seyfert';
|
|
2
2
|
/* My custom modal handler to support advanced custom IDs. */
|
|
3
3
|
export async function handleModal(interaction) {
|
|
4
|
-
const context = new ModalContext(
|
|
5
|
-
const extended =
|
|
4
|
+
const context = new ModalContext(interaction.client, interaction);
|
|
5
|
+
const extended = interaction.client.options.context?.(interaction) ?? {};
|
|
6
6
|
Object.assign(context, extended);
|
|
7
|
-
const modal =
|
|
7
|
+
const modal = interaction.client.components.commands.find((component) => (component.type === InteractionCommandType.MODAL &&
|
|
8
8
|
component.customId === interaction.customId.split(':')[0]));
|
|
9
9
|
try {
|
|
10
10
|
context.command = modal;
|
|
11
|
-
await
|
|
11
|
+
await interaction.client.components.execute(modal, context);
|
|
12
12
|
}
|
|
13
13
|
catch (error) {
|
|
14
|
-
|
|
14
|
+
interaction.client.components.onFail(error);
|
|
15
15
|
}
|
|
16
16
|
;
|
|
17
17
|
}
|
|
@@ -19,18 +19,18 @@ export async function handleModal(interaction) {
|
|
|
19
19
|
/* My custom message component handler to support advanced custom IDs. */
|
|
20
20
|
export async function handleMessageComponent(interaction) {
|
|
21
21
|
// @ts-expect-error
|
|
22
|
-
const context = new ComponentContext(
|
|
23
|
-
const extended =
|
|
22
|
+
const context = new ComponentContext(interaction.client, interaction);
|
|
23
|
+
const extended = interaction.client.options.context?.(interaction) ?? {};
|
|
24
24
|
Object.assign(context, extended);
|
|
25
|
-
const component =
|
|
25
|
+
const component = interaction.client.components.commands.find((component) => (component.type === InteractionCommandType.COMPONENT &&
|
|
26
26
|
component.cType === interaction.componentType &&
|
|
27
27
|
component.customId === interaction.customId.split(':')[0]));
|
|
28
28
|
try {
|
|
29
29
|
context.command = component;
|
|
30
|
-
await
|
|
30
|
+
await interaction.client.components.execute(component, context);
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
|
-
await
|
|
33
|
+
await interaction.client.components.onFail(error);
|
|
34
34
|
}
|
|
35
35
|
;
|
|
36
36
|
}
|
package/build/utilities.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { User, GuildMember } from 'seyfert';
|
|
1
|
+
import { User, GuildMember, InteractionGuildMember } from 'seyfert';
|
|
2
2
|
export declare function s(content: string): string;
|
|
3
3
|
export declare function randomId(length: number): string;
|
|
4
4
|
export declare function wait(time: number): Promise<unknown>;
|
|
5
5
|
export declare function isValidSnowflake(snowflake: string): boolean;
|
|
6
6
|
export declare function truncateString(string: string, maxLength?: number): string;
|
|
7
7
|
type NameType = 'display' | 'display-s' | 'display-username' | 'display-username-s' | 'username-id' | 'username-id-s';
|
|
8
|
-
export declare function name(user: User | GuildMember, type?: NameType): string;
|
|
8
|
+
export declare function name(user: User | GuildMember | InteractionGuildMember, type?: NameType): string;
|
|
9
9
|
export declare function reviver(_key: string, value: any): any;
|
|
10
10
|
export declare function replacer(_key: string, value: any): any;
|
|
11
11
|
export declare function numberToHex(color: number): string;
|
package/build/utilities.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGpE,wBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzC;AAGD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAGD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnD;AAGD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAI3D;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,CAI9E;AAED,KAAK,QAAQ,GACX,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,eAAe,CAAA;AAGjB,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,sBAAsB,EAAE,IAAI,GAAE,QAAoB,GAAG,MAAM,CAW1G;AAGD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAG/C;AAGD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAIhD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAExC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fallencodes/seyfert-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.6",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "A collection of various utility/helper code I use in my Seyfert projects.",
|
|
7
7
|
"main": "build/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dayjs": "^1.11.19",
|
|
37
37
|
"multibyte": "^1.0.5",
|
|
38
38
|
"nanoid": "^5.1.6",
|
|
39
|
-
"seyfert": "4.0.1-dev-
|
|
39
|
+
"seyfert": "4.0.1-dev-21273098940.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^25.0.8",
|