@saykit/carbon 0.11.0 → 0.12.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/dist/index.d.mts +3 -11
- package/dist/index.mjs +6 -12
- package/package.json +6 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import { APIInteraction, BaseCommand, BaseComponent, Modal, Plugin } from "@buape/carbon";
|
|
2
2
|
import { Catalogue, View } from "saykit";
|
|
3
|
-
//#region src/extensions/base-interaction.d.ts
|
|
4
3
|
declare module '@buape/carbon' {
|
|
5
4
|
interface BaseInteraction<T extends APIInteraction> {
|
|
6
5
|
get say(): View;
|
|
7
6
|
}
|
|
8
7
|
}
|
|
9
8
|
declare function applyBaseInteractionExtension(): () => void;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region src/extensions/guild.d.ts
|
|
12
9
|
declare module '@buape/carbon' {
|
|
13
10
|
interface Guild {
|
|
14
11
|
get say(): View;
|
|
15
12
|
}
|
|
16
13
|
}
|
|
17
14
|
declare function applyGuildExtension(): () => void;
|
|
18
|
-
//#endregion
|
|
19
|
-
//#region src/mixers/with-say.d.ts
|
|
20
15
|
type Keys = 'name' | 'description' | 'label' | 'title' | 'placeholder' | 'content' | 'options' | 'components' | 'subcommands' | 'subcommandGroups';
|
|
21
16
|
type AbstractConstructor<Args extends any[] = any[], Instance extends object = object> = abstract new (...args: Args) => Instance;
|
|
22
17
|
type SayProps<T> = Pick<T, Extract<keyof T, Keys>>;
|
|
@@ -65,9 +60,7 @@ interface WithSay {
|
|
|
65
60
|
* @throws If the base class is neither a {@link BaseCommand} nor a
|
|
66
61
|
* {@link BaseComponent}
|
|
67
62
|
*/
|
|
68
|
-
declare function createWithSay(catalogue: Catalogue): WithSay;
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/plugin.d.ts
|
|
63
|
+
export declare function createWithSay(catalogue: Catalogue): WithSay;
|
|
71
64
|
/**
|
|
72
65
|
* A Carbon plugin that provides a singleton {@link Catalogue}.
|
|
73
66
|
*
|
|
@@ -81,9 +74,8 @@ declare function createWithSay(catalogue: Catalogue): WithSay;
|
|
|
81
74
|
* const client = new Client({ ... }, { ... }, [new SayPlugin(catalogue)]);
|
|
82
75
|
* ```
|
|
83
76
|
*/
|
|
84
|
-
declare class SayPlugin extends Plugin {
|
|
77
|
+
export declare class SayPlugin extends Plugin {
|
|
85
78
|
id: string;
|
|
86
79
|
constructor(catalogue: Catalogue);
|
|
87
80
|
}
|
|
88
|
-
|
|
89
|
-
export { SayPlugin, type applyBaseInteractionExtension, type applyGuildExtension, createWithSay };
|
|
81
|
+
export type { applyBaseInteractionExtension, applyGuildExtension };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseCommand, BaseComponent, BaseInteraction, Guild, Locale, Modal, Plugin } from "@buape/carbon";
|
|
2
|
-
|
|
2
|
+
// src/utils/combine-command-options.ts
|
|
3
3
|
const ALLOWED_LOCALES = Object.values(Locale);
|
|
4
4
|
function combineCommandOptions(mappedOptions, baseLocale) {
|
|
5
5
|
const options = mappedOptions[baseLocale];
|
|
@@ -19,8 +19,7 @@ function combineCommandOptions(mappedOptions, baseLocale) {
|
|
|
19
19
|
}
|
|
20
20
|
return options;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//#region src/mixers/with-say.ts
|
|
22
|
+
// src/mixers/with-say.ts
|
|
24
23
|
function createWithSay(catalogue) {
|
|
25
24
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
26
25
|
return function withSay(Base) {
|
|
@@ -60,11 +59,9 @@ function createSayComponent(Base) {
|
|
|
60
59
|
}
|
|
61
60
|
return SayComponent;
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
//#region src/constants.ts
|
|
62
|
+
// src/constants.ts
|
|
65
63
|
const kSay = Symbol.for("saykit.say");
|
|
66
|
-
|
|
67
|
-
//#region src/extensions/base-interaction.ts
|
|
64
|
+
// src/extensions/base-interaction.ts
|
|
68
65
|
function applyBaseInteractionExtension() {
|
|
69
66
|
Object.defineProperty(BaseInteraction.prototype, "say", { get() {
|
|
70
67
|
const catalogue = Reflect.get(globalThis, kSay);
|
|
@@ -75,8 +72,7 @@ function applyBaseInteractionExtension() {
|
|
|
75
72
|
Object.defineProperty(BaseInteraction.prototype, "say", { value: void 0 });
|
|
76
73
|
};
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
//#region src/extensions/guild.ts
|
|
75
|
+
// src/extensions/guild.ts
|
|
80
76
|
function applyGuildExtension() {
|
|
81
77
|
Object.defineProperty(Guild.prototype, "say", { get() {
|
|
82
78
|
const catalogue = Reflect.get(globalThis, kSay);
|
|
@@ -87,8 +83,7 @@ function applyGuildExtension() {
|
|
|
87
83
|
Object.defineProperty(Guild.prototype, "say", { value: void 0 });
|
|
88
84
|
};
|
|
89
85
|
}
|
|
90
|
-
|
|
91
|
-
//#region src/plugin.ts
|
|
86
|
+
// src/plugin.ts
|
|
92
87
|
var SayPlugin = class extends Plugin {
|
|
93
88
|
id = "saykit";
|
|
94
89
|
constructor(catalogue) {
|
|
@@ -98,5 +93,4 @@ var SayPlugin = class extends Plugin {
|
|
|
98
93
|
applyGuildExtension();
|
|
99
94
|
}
|
|
100
95
|
};
|
|
101
|
-
//#endregion
|
|
102
96
|
export { SayPlugin, createWithSay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saykit/carbon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Carbon Discord framework integration for saykit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bot",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
],
|
|
26
26
|
"type": "module",
|
|
27
27
|
"sideEffects": false,
|
|
28
|
+
"imports": {
|
|
29
|
+
"#/*": "./src/*"
|
|
30
|
+
},
|
|
28
31
|
"exports": {
|
|
29
32
|
".": {
|
|
30
33
|
"types": "./dist/index.d.mts",
|
|
@@ -36,8 +39,8 @@
|
|
|
36
39
|
"provenance": true
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@buape/carbon": "0.
|
|
40
|
-
"saykit": "^0.
|
|
42
|
+
"@buape/carbon": "0.17.0",
|
|
43
|
+
"saykit": "^0.12.0"
|
|
41
44
|
},
|
|
42
45
|
"peerDependencies": {
|
|
43
46
|
"@buape/carbon": "*",
|