reciple 10.0.1-dev.7 → 10.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/README.md +69 -0
- package/assets/config/reciple.config.js +7 -0
- package/assets/config/reciple.config.ts +5 -0
- package/assets/global/nodemon.json +1 -0
- package/assets/templates/javascript/jsconfig.json +14 -2
- package/assets/templates/typescript/tsconfig.json +14 -2
- package/dist/_virtual/{_@oxc-project_runtime@0.99.0 → _@oxc-project_runtime@0.108.0}/helpers/decorate.mjs +1 -1
- package/dist/bin/commands/build.mjs +1 -1
- package/dist/bin/commands/build.mjs.map +1 -1
- package/dist/bin/commands/create.mjs +3 -2
- package/dist/bin/commands/create.mjs.map +1 -1
- package/dist/bin/commands/createModule.mjs +2 -2
- package/dist/bin/commands/createModule.mjs.map +1 -1
- package/dist/bin/commands/start.mjs +10 -9
- package/dist/bin/commands/start.mjs.map +1 -1
- package/dist/bin/commands/startSharding.d.mts +18 -0
- package/dist/bin/commands/startSharding.mjs +101 -0
- package/dist/bin/commands/startSharding.mjs.map +1 -0
- package/dist/bin/reciple.mjs +0 -0
- package/dist/classes/cli/CLI.d.mts +1 -1
- package/dist/classes/cli/CLI.mjs +6 -5
- package/dist/classes/cli/CLI.mjs.map +1 -1
- package/dist/classes/cli/ConfigReader.d.mts +24 -29
- package/dist/classes/cli/ConfigReader.mjs +45 -61
- package/dist/classes/cli/ConfigReader.mjs.map +1 -1
- package/dist/classes/cli/RuntimeEnvironment.mjs +1 -1
- package/dist/classes/cli/RuntimeEnvironment.mjs.map +1 -1
- package/dist/classes/client/EventListeners.mjs +3 -2
- package/dist/classes/client/EventListeners.mjs.map +1 -1
- package/dist/classes/client/ModuleLoader.d.mts +3 -3
- package/dist/classes/client/ModuleLoader.mjs +10 -8
- package/dist/classes/client/ModuleLoader.mjs.map +1 -1
- package/dist/classes/managers/ModuleManager.mjs +5 -5
- package/dist/classes/managers/ModuleManager.mjs.map +1 -1
- package/dist/classes/modules/BaseModule.d.mts +0 -3
- package/dist/classes/modules/BaseModule.mjs +2 -4
- package/dist/classes/modules/BaseModule.mjs.map +1 -1
- package/dist/classes/modules/PostconditionModule.d.mts +1 -1
- package/dist/classes/modules/PostconditionModule.mjs +5 -5
- package/dist/classes/modules/PostconditionModule.mjs.map +1 -1
- package/dist/classes/modules/PreconditionModule.d.mts +1 -1
- package/dist/classes/modules/PreconditionModule.mjs +5 -5
- package/dist/classes/modules/PreconditionModule.mjs.map +1 -1
- package/dist/classes/modules/commands/ContextMenuCommandModule.d.mts +1 -1
- package/dist/classes/modules/commands/ContextMenuCommandModule.mjs +5 -5
- package/dist/classes/modules/commands/ContextMenuCommandModule.mjs.map +1 -1
- package/dist/classes/modules/commands/MessageCommandModule.d.mts +1 -1
- package/dist/classes/modules/commands/MessageCommandModule.mjs +5 -5
- package/dist/classes/modules/commands/MessageCommandModule.mjs.map +1 -1
- package/dist/classes/modules/commands/SlashCommandModule.d.mts +1 -1
- package/dist/classes/modules/commands/SlashCommandModule.mjs +5 -5
- package/dist/classes/modules/commands/SlashCommandModule.mjs.map +1 -1
- package/dist/classes/modules/events/EventModule.d.mts +3 -4
- package/dist/classes/modules/events/EventModule.mjs +3 -4
- package/dist/classes/modules/events/EventModule.mjs.map +1 -1
- package/dist/classes/templates/ModuleTemplateBuilder.d.mts +1 -1
- package/dist/classes/templates/ModuleTemplateBuilder.mjs +3 -3
- package/dist/classes/templates/ModuleTemplateBuilder.mjs.map +1 -1
- package/dist/classes/templates/TemplateBuilder.mjs +29 -24
- package/dist/classes/templates/TemplateBuilder.mjs.map +1 -1
- package/dist/classes/validation/BaseModuleValidator.d.mts +11 -11
- package/dist/classes/validation/CommandModuleValidator.d.mts +18 -18
- package/dist/classes/validation/EventModuleValidator.d.mts +28 -12
- package/dist/classes/validation/PostconditionModule.d.mts +9 -9
- package/dist/classes/validation/PreconditionModule.d.mts +7 -7
- package/dist/helpers/constants.d.mts +1 -2
- package/dist/helpers/constants.mjs +8 -8
- package/dist/helpers/constants.mjs.map +1 -1
- package/dist/helpers/types.d.mts +3 -1
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +3 -4
- package/dist/index.mjs.map +1 -1
- package/dist/package.mjs +18 -15
- package/dist/package.mjs.map +1 -1
- package/package.json +17 -14
- package/LICENSE +0 -155
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../modules/BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../helpers/constants.mjs";
|
|
3
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
4
4
|
import { BaseManager, RecipleError } from "@reciple/core";
|
|
5
5
|
import { mix } from "ts-mixer";
|
|
6
6
|
import { EventEmitter } from "node:events";
|
|
7
7
|
|
|
8
8
|
//#region src/classes/managers/ModuleManager.ts
|
|
9
|
-
let ModuleManager = class ModuleManager
|
|
9
|
+
let ModuleManager = class ModuleManager {
|
|
10
10
|
holds = BaseModule;
|
|
11
11
|
constructor(client) {
|
|
12
12
|
this.client = client;
|
|
@@ -59,6 +59,7 @@ let ModuleManager = class ModuleManager$1 {
|
|
|
59
59
|
}
|
|
60
60
|
add(module) {
|
|
61
61
|
this.cache.set(module.id, module);
|
|
62
|
+
if (!("moduleType" in module)) return;
|
|
62
63
|
switch (module.moduleType) {
|
|
63
64
|
case ModuleType.Command:
|
|
64
65
|
this.client.commands?.add(module);
|
|
@@ -72,12 +73,12 @@ let ModuleManager = class ModuleManager$1 {
|
|
|
72
73
|
case ModuleType.Postcondition:
|
|
73
74
|
this.client.postconditions?.cache.set(module.id, module);
|
|
74
75
|
break;
|
|
75
|
-
case ModuleType.Base:
|
|
76
76
|
default: break;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
remove(module) {
|
|
80
80
|
this.cache.delete(module.id);
|
|
81
|
+
if (!("moduleType" in module)) return;
|
|
81
82
|
switch (module.moduleType) {
|
|
82
83
|
case ModuleType.Command:
|
|
83
84
|
this.client.commands?.cache.delete(module.id);
|
|
@@ -91,7 +92,6 @@ let ModuleManager = class ModuleManager$1 {
|
|
|
91
92
|
case ModuleType.Postcondition:
|
|
92
93
|
this.client.postconditions?.cache.delete(module.id);
|
|
93
94
|
break;
|
|
94
|
-
case ModuleType.Base:
|
|
95
95
|
default: break;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModuleManager.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ModuleManager.mjs","names":[],"sources":["../../../src/classes/managers/ModuleManager.ts"],"sourcesContent":["import { mix } from 'ts-mixer';\nimport { BaseModule } from '../modules/BaseModule.js';\nimport { BaseManager, RecipleError, type Client } from '@reciple/core';\nimport { EventEmitter } from 'node:events';\nimport type { AnyModule } from '../../helpers/types.js';\nimport { ModuleType } from '../../helpers/constants.js';\n\nexport interface ModuleManager extends BaseManager<string, AnyModule, BaseModule.Resolvable>, EventEmitter<ModuleManager.Events> {}\n\n@mix(BaseManager, EventEmitter)\nexport class ModuleManager {\n public readonly holds = BaseModule;\n\n constructor(public readonly client: Client) {}\n\n public async enableModules({ modules, removeFromCacheOnError }: ModuleManager.EventExecuteData & { removeFromCacheOnError?: boolean; } = { modules: Array.from(this.cache.values()) }): Promise<AnyModule[]> {\n const enabledModules: AnyModule[] = [];\n\n for (const module of modules ?? []) {\n this.emit('modulePreEnable', module);\n\n await module.onEnable({ client: this.client }).catch(e => {\n if (removeFromCacheOnError) this.cache.delete(module.id);\n this.emitOrThrow('moduleEnableError', module, e);\n });\n\n this.emit('moduleEnable', module);\n this.add(module);\n enabledModules.push(module);\n }\n\n this.emit('enabledModules', enabledModules);\n return enabledModules;\n }\n\n public async readyModules({ modules, removeFromCacheOnError }: ModuleManager.EventExecuteData & { removeFromCacheOnError?: boolean; } = { modules: Array.from(this.cache.values()) }): Promise<AnyModule[]> {\n const readyModules: AnyModule[] = [];\n\n if (!this.client.isReady()) throw new RecipleError(RecipleError.Code.ClientNotReady());\n\n for (const module of modules ?? []) {\n this.emit('modulePreReady', module);\n\n await module.onReady({ client: this.client }).catch(e => {\n if (removeFromCacheOnError !== false) this.remove(module);\n this.emitOrThrow('moduleReadyError', module, e);\n });\n\n this.emit('moduleReady', module);\n this.cache.set(module.id, module);\n readyModules.push(module);\n }\n\n this.emit('readyModules', readyModules);\n return readyModules;\n }\n\n public async disableModules({ modules, removeFromCache }: ModuleManager.EventExecuteData & { removeFromCache?: boolean; } = { modules: Array.from(this.cache.values()) }): Promise<AnyModule[]> {\n const disabledModules: AnyModule[] = [];\n\n for (const module of modules ?? []) {\n this.emit('modulePreDisable', module);\n\n await module.onDisable({ client: this.client }).catch(e => {\n if (removeFromCache !== false) this.remove(module);\n this.emitOrThrow('moduleDisableError', module, e);\n });\n\n this.emit('moduleDisable', module);\n if (removeFromCache !== false) this.remove(module);\n disabledModules.push(module);\n }\n\n this.emit('disabledModules', disabledModules);\n return disabledModules;\n }\n\n public add(module: AnyModule): void {\n this.cache.set(module.id, module);\n\n if (!('moduleType' in module)) return;\n\n switch (module.moduleType) {\n case ModuleType.Command:\n this.client.commands?.add(module);\n break;\n case ModuleType.Event:\n this.client.eventListeners.register(module);\n break;\n case ModuleType.Precondition:\n this.client.preconditions?.cache.set(module.id, module);\n break;\n case ModuleType.Postcondition:\n this.client.postconditions?.cache.set(module.id, module);\n break;\n default:\n break;\n }\n }\n\n public remove(module: AnyModule): void {\n this.cache.delete(module.id);\n\n if (!('moduleType' in module)) return;\n\n switch (module.moduleType) {\n case ModuleType.Command:\n this.client.commands?.cache.delete(module.id);\n break;\n case ModuleType.Event:\n this.client.eventListeners.unregister(module);\n break;\n case ModuleType.Precondition:\n this.client.preconditions?.cache.delete(module.id);\n break;\n case ModuleType.Postcondition:\n this.client.postconditions?.cache.delete(module.id);\n break;\n default:\n break;\n }\n }\n\n private emitOrThrow<K extends keyof Pick<ModuleManager.Events, 'moduleDisableError'|'moduleEnableError'|'moduleReadyError'>>(event: K, ...args: ModuleManager.Events[K]) {\n if (this.client.listenerCount(event) > 0) {\n return this.emit(event, ...(args as never));\n }\n\n throw args[1];\n }\n}\n\nexport namespace ModuleManager {\n export interface Events {\n modulePreEnable: [module: AnyModule];\n moduleEnable: [module: AnyModule];\n moduleEnableError: [module: AnyModule, error: Error];\n enabledModules: [modules: AnyModule[]];\n\n modulePreReady: [module: AnyModule];\n moduleReady: [module: AnyModule];\n moduleReadyError: [module: AnyModule, error: Error];\n readyModules: [modules: AnyModule[]];\n\n modulePreDisable: [module: AnyModule];\n moduleDisable: [module: AnyModule];\n moduleDisableError: [module: AnyModule, error: Error];\n disabledModules: [modules: AnyModule[]];\n }\n\n export interface EventExecuteData {\n modules?: AnyModule[];\n }\n}\n"],"mappings":";;;;;;;;AAUO,0BAAM,cAAc;CACvB,AAAgB,QAAQ;CAExB,YAAY,AAAgB,QAAgB;EAAhB;;CAE5B,MAAa,cAAc,EAAE,SAAS,2BAAmG,EAAE,SAAS,MAAM,KAAK,KAAK,MAAM,QAAQ,CAAC,EAAE,EAAwB;EACzM,MAAM,iBAA8B,EAAE;AAEtC,OAAK,MAAM,UAAU,WAAW,EAAE,EAAE;AAChC,QAAK,KAAK,mBAAmB,OAAO;AAEpC,SAAM,OAAO,SAAS,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,OAAM,MAAK;AACtD,QAAI,uBAAwB,MAAK,MAAM,OAAO,OAAO,GAAG;AACxD,SAAK,YAAY,qBAAqB,QAAQ,EAAE;KAClD;AAEF,QAAK,KAAK,gBAAgB,OAAO;AACjC,QAAK,IAAI,OAAO;AAChB,kBAAe,KAAK,OAAO;;AAG/B,OAAK,KAAK,kBAAkB,eAAe;AAC3C,SAAO;;CAGX,MAAa,aAAa,EAAE,SAAS,2BAAmG,EAAE,SAAS,MAAM,KAAK,KAAK,MAAM,QAAQ,CAAC,EAAE,EAAwB;EACxM,MAAM,eAA4B,EAAE;AAEpC,MAAI,CAAC,KAAK,OAAO,SAAS,CAAE,OAAM,IAAI,aAAa,aAAa,KAAK,gBAAgB,CAAC;AAEtF,OAAK,MAAM,UAAU,WAAW,EAAE,EAAE;AAChC,QAAK,KAAK,kBAAkB,OAAO;AAEnC,SAAM,OAAO,QAAQ,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,OAAM,MAAK;AACrD,QAAI,2BAA2B,MAAO,MAAK,OAAO,OAAO;AACzD,SAAK,YAAY,oBAAoB,QAAQ,EAAE;KACjD;AAEF,QAAK,KAAK,eAAe,OAAO;AAChC,QAAK,MAAM,IAAI,OAAO,IAAI,OAAO;AACjC,gBAAa,KAAK,OAAO;;AAG7B,OAAK,KAAK,gBAAgB,aAAa;AACvC,SAAO;;CAGX,MAAa,eAAe,EAAE,SAAS,oBAAqF,EAAE,SAAS,MAAM,KAAK,KAAK,MAAM,QAAQ,CAAC,EAAE,EAAwB;EAC5L,MAAM,kBAA+B,EAAE;AAEvC,OAAK,MAAM,UAAU,WAAW,EAAE,EAAE;AAChC,QAAK,KAAK,oBAAoB,OAAO;AAErC,SAAM,OAAO,UAAU,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,OAAM,MAAK;AACvD,QAAI,oBAAoB,MAAO,MAAK,OAAO,OAAO;AAClD,SAAK,YAAY,sBAAsB,QAAQ,EAAE;KACnD;AAEF,QAAK,KAAK,iBAAiB,OAAO;AAClC,OAAI,oBAAoB,MAAO,MAAK,OAAO,OAAO;AAClD,mBAAgB,KAAK,OAAO;;AAGhC,OAAK,KAAK,mBAAmB,gBAAgB;AAC7C,SAAO;;CAGX,AAAO,IAAI,QAAyB;AAChC,OAAK,MAAM,IAAI,OAAO,IAAI,OAAO;AAEjC,MAAI,EAAE,gBAAgB,QAAS;AAE/B,UAAQ,OAAO,YAAf;GACI,KAAK,WAAW;AACZ,SAAK,OAAO,UAAU,IAAI,OAAO;AACjC;GACJ,KAAK,WAAW;AACZ,SAAK,OAAO,eAAe,SAAS,OAAO;AAC3C;GACJ,KAAK,WAAW;AACZ,SAAK,OAAO,eAAe,MAAM,IAAI,OAAO,IAAI,OAAO;AACvD;GACJ,KAAK,WAAW;AACZ,SAAK,OAAO,gBAAgB,MAAM,IAAI,OAAO,IAAI,OAAO;AACxD;GACJ,QACI;;;CAIZ,AAAO,OAAO,QAAyB;AACnC,OAAK,MAAM,OAAO,OAAO,GAAG;AAE5B,MAAI,EAAE,gBAAgB,QAAS;AAE/B,UAAQ,OAAO,YAAf;GACI,KAAK,WAAW;AACZ,SAAK,OAAO,UAAU,MAAM,OAAO,OAAO,GAAG;AAC7C;GACJ,KAAK,WAAW;AACZ,SAAK,OAAO,eAAe,WAAW,OAAO;AAC7C;GACJ,KAAK,WAAW;AACZ,SAAK,OAAO,eAAe,MAAM,OAAO,OAAO,GAAG;AAClD;GACJ,KAAK,WAAW;AACZ,SAAK,OAAO,gBAAgB,MAAM,OAAO,OAAO,GAAG;AACnD;GACJ,QACI;;;CAIZ,AAAQ,YAAqH,OAAU,GAAG,MAA+B;AACrK,MAAI,KAAK,OAAO,cAAc,MAAM,GAAG,EACnC,QAAO,KAAK,KAAK,OAAO,GAAI,KAAe;AAG/C,QAAM,KAAK;;;4BAvHlB,IAAI,aAAa,aAAa"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { AnyModule } from "../../helpers/types.mjs";
|
|
3
2
|
import { Client } from "@reciple/core";
|
|
4
3
|
|
|
@@ -6,7 +5,6 @@ import { Client } from "@reciple/core";
|
|
|
6
5
|
declare class BaseModule implements BaseModule.Data {
|
|
7
6
|
private readonly __$filepath;
|
|
8
7
|
readonly id: string;
|
|
9
|
-
readonly moduleType: ModuleType.Base;
|
|
10
8
|
client: Client;
|
|
11
9
|
onEnable(data: BaseModule.EventData<boolean>): Promise<void>;
|
|
12
10
|
onReady(data: BaseModule.EventData<true>): Promise<void>;
|
|
@@ -20,7 +18,6 @@ declare namespace BaseModule {
|
|
|
20
18
|
const constructor: typeof BaseModule;
|
|
21
19
|
interface Data {
|
|
22
20
|
id?: string;
|
|
23
|
-
moduleType?: ModuleType.Base;
|
|
24
21
|
onEnable?(data: BaseModule.EventData<false>): Promise<void>;
|
|
25
22
|
onReady?(data: BaseModule.EventData<true>): Promise<void>;
|
|
26
23
|
onDisable?(data: BaseModule.EventData<boolean>): Promise<void>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { DiscordSnowflake } from "@sapphire/snowflake";
|
|
3
2
|
import { hasMixin } from "ts-mixer";
|
|
4
3
|
|
|
@@ -6,16 +5,15 @@ import { hasMixin } from "ts-mixer";
|
|
|
6
5
|
var BaseModule = class BaseModule {
|
|
7
6
|
__$filepath = "";
|
|
8
7
|
id = DiscordSnowflake.generate().toString();
|
|
9
|
-
moduleType = ModuleType.Base;
|
|
10
8
|
client;
|
|
11
9
|
async onEnable(data) {}
|
|
12
10
|
async onReady(data) {}
|
|
13
11
|
async onDisable(data) {}
|
|
14
12
|
static isModule(data) {
|
|
15
|
-
return
|
|
13
|
+
return hasMixin(data, BaseModule);
|
|
16
14
|
}
|
|
17
15
|
static from(data) {
|
|
18
|
-
if (
|
|
16
|
+
if (hasMixin(data, BaseModule)) return data;
|
|
19
17
|
const ModuleInstance = class extends BaseModule {};
|
|
20
18
|
Object.assign(ModuleInstance.prototype, data);
|
|
21
19
|
return new ModuleInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseModule.mjs","names":[],"sources":["../../../src/classes/modules/BaseModule.ts"],"sourcesContent":["import type { Client } from '@reciple/core';\nimport { DiscordSnowflake } from '@sapphire/snowflake';\nimport {
|
|
1
|
+
{"version":3,"file":"BaseModule.mjs","names":[],"sources":["../../../src/classes/modules/BaseModule.ts"],"sourcesContent":["import type { Client } from '@reciple/core';\nimport { DiscordSnowflake } from '@sapphire/snowflake';\nimport { hasMixin } from 'ts-mixer';\nimport type { AnyModule } from '../../helpers/types.js';\n\nexport class BaseModule implements BaseModule.Data {\n private readonly __$filepath: string = '';\n\n public readonly id: string = DiscordSnowflake.generate().toString();\n\n public client!: Client;\n\n public async onEnable(data: BaseModule.EventData<boolean>): Promise<void> {}\n\n public async onReady(data: BaseModule.EventData<true>): Promise<void> {}\n\n public async onDisable(data: BaseModule.EventData<boolean>): Promise<void> {}\n\n public static isModule(data: unknown): data is AnyModule {\n return hasMixin(data, BaseModule);\n }\n\n public static from(data: BaseModule.Resolvable): BaseModule {\n if (hasMixin(data, BaseModule)) return data;\n\n const ModuleInstance = class extends BaseModule {};\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n\n public static getFilepath(module: AnyModule): string {\n return (module as BaseModule).__$filepath || '';\n }\n}\n\nexport namespace BaseModule {\n export type Resolvable = BaseModule|Data;\n\n export const constructor = BaseModule;\n\n export interface Data {\n id?: string;\n onEnable?(data: BaseModule.EventData<false>): Promise<void>;\n onReady?(data: BaseModule.EventData<true>): Promise<void>;\n onDisable?(data: BaseModule.EventData<boolean>): Promise<void>;\n }\n\n export interface EventData<Ready extends boolean = boolean> {\n client: Client<Ready>;\n }\n}\n"],"mappings":";;;;AAKA,IAAa,aAAb,MAAa,WAAsC;CAC/C,AAAiB,cAAsB;CAEvC,AAAgB,KAAa,iBAAiB,UAAU,CAAC,UAAU;CAEnE,AAAO;CAEP,MAAa,SAAS,MAAoD;CAE1E,MAAa,QAAQ,MAAiD;CAEtE,MAAa,UAAU,MAAoD;CAE3E,OAAc,SAAS,MAAkC;AACrD,SAAO,SAAS,MAAM,WAAW;;CAGrC,OAAc,KAAK,MAAyC;AACxD,MAAI,SAAS,MAAM,WAAW,CAAE,QAAO;EAEvC,MAAM,iBAAiB,cAAc,WAAW;AAChD,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB;;CAG/B,OAAc,YAAY,QAA2B;AACjD,SAAQ,OAAsB,eAAe;;;;2BAOtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "./BaseModule.mjs";
|
|
2
|
+
import { ModuleType } from "../../helpers/constants.mjs";
|
|
3
3
|
import { CommandPostcondition, CommandPrecondition, CommandType } from "@reciple/core";
|
|
4
4
|
|
|
5
5
|
//#region src/classes/modules/PostconditionModule.d.ts
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "./BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../helpers/constants.mjs";
|
|
3
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
4
4
|
import { CommandPostcondition } from "@reciple/core";
|
|
5
5
|
import { hasMixin, mix } from "ts-mixer";
|
|
6
6
|
|
|
7
7
|
//#region src/classes/modules/PostconditionModule.ts
|
|
8
8
|
var _PostconditionModule;
|
|
9
|
-
let PostconditionModule = _PostconditionModule = class PostconditionModule
|
|
9
|
+
let PostconditionModule = _PostconditionModule = class PostconditionModule {
|
|
10
10
|
moduleType = ModuleType.Postcondition;
|
|
11
11
|
static from(data) {
|
|
12
|
-
if (
|
|
12
|
+
if (hasMixin(data, _PostconditionModule)) return data;
|
|
13
13
|
const ModuleInstance = class extends _PostconditionModule {
|
|
14
14
|
execute = data.execute;
|
|
15
15
|
};
|
|
@@ -17,7 +17,7 @@ let PostconditionModule = _PostconditionModule = class PostconditionModule$1 {
|
|
|
17
17
|
return new ModuleInstance();
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
PostconditionModule = _PostconditionModule = __decorate([mix(
|
|
20
|
+
PostconditionModule = _PostconditionModule = __decorate([mix(CommandPostcondition, BaseModule)], PostconditionModule);
|
|
21
21
|
|
|
22
22
|
//#endregion
|
|
23
23
|
export { PostconditionModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostconditionModule.mjs","names":[
|
|
1
|
+
{"version":3,"file":"PostconditionModule.mjs","names":[],"sources":["../../../src/classes/modules/PostconditionModule.ts"],"sourcesContent":["import { CommandPostcondition, type CommandPrecondition, type CommandType } from '@reciple/core';\nimport { BaseModule } from './BaseModule.js';\nimport { hasMixin, mix } from 'ts-mixer';\nimport { ModuleType } from '../../helpers/constants.js';\n\nexport interface PostconditionModule<D = any> extends Omit<BaseModule, 'moduleType'>, CommandPostcondition<D> {}\n\n@mix(CommandPostcondition, BaseModule)\nexport abstract class PostconditionModule<D = any> implements PostconditionModule<D> {\n public moduleType: ModuleType.Postcondition = ModuleType.Postcondition;\n\n public abstract execute<T extends CommandType>(data: CommandPostcondition.ExecuteData<T>, preconditionTrigger?: CommandPrecondition.ResultData<T, any>): Promise<CommandPostcondition.ResultDataResolvable<T, D>>;\n\n public static from<D = any>(data: PostconditionModule.Resolvable<D>): PostconditionModule<D> {\n if (hasMixin(data, PostconditionModule)) return data;\n\n const ModuleInstance = class extends PostconditionModule { execute = data.execute; };\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n}\n\nexport namespace PostconditionModule {\n export type Resolvable<D = any> = PostconditionModule<D>|PostconditionModule.Data<D>;\n\n export interface Data<D = any> extends Omit<BaseModule.Data, 'moduleType'>, Omit<CommandPostcondition.Data<D>, 'id'> {\n moduleType: ModuleType.Postcondition;\n }\n}\n"],"mappings":";;;;;;;;AAQO,uDAAe,oBAA+D;CACjF,AAAO,aAAuC,WAAW;CAIzD,OAAc,KAAc,MAAiE;AACzF,MAAI,SAAS,2BAA0B,CAAE,QAAO;EAEhD,MAAM,iBAAiB,mCAAkC;GAAE,UAAU,KAAK;;AAC1E,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB;;;yDAXlC,IAAI,sBAAsB,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "./BaseModule.mjs";
|
|
2
|
+
import { ModuleType } from "../../helpers/constants.mjs";
|
|
3
3
|
import { AnyCommandExecuteData, CommandPrecondition, CommandType } from "@reciple/core";
|
|
4
4
|
|
|
5
5
|
//#region src/classes/modules/PreconditionModule.d.ts
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "./BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../helpers/constants.mjs";
|
|
3
|
+
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
4
4
|
import { CommandPrecondition } from "@reciple/core";
|
|
5
5
|
import { hasMixin, mix } from "ts-mixer";
|
|
6
6
|
|
|
7
7
|
//#region src/classes/modules/PreconditionModule.ts
|
|
8
8
|
var _PreconditionModule;
|
|
9
|
-
let PreconditionModule = _PreconditionModule = class PreconditionModule
|
|
9
|
+
let PreconditionModule = _PreconditionModule = class PreconditionModule {
|
|
10
10
|
moduleType = ModuleType.Precondition;
|
|
11
11
|
static from(data) {
|
|
12
|
-
if (
|
|
12
|
+
if (hasMixin(data, _PreconditionModule)) return data;
|
|
13
13
|
const ModuleInstance = class extends _PreconditionModule {
|
|
14
14
|
execute = data.execute;
|
|
15
15
|
};
|
|
@@ -17,7 +17,7 @@ let PreconditionModule = _PreconditionModule = class PreconditionModule$1 {
|
|
|
17
17
|
return new ModuleInstance();
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
PreconditionModule = _PreconditionModule = __decorate([mix(
|
|
20
|
+
PreconditionModule = _PreconditionModule = __decorate([mix(CommandPrecondition, BaseModule)], PreconditionModule);
|
|
21
21
|
|
|
22
22
|
//#endregion
|
|
23
23
|
export { PreconditionModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreconditionModule.mjs","names":[
|
|
1
|
+
{"version":3,"file":"PreconditionModule.mjs","names":[],"sources":["../../../src/classes/modules/PreconditionModule.ts"],"sourcesContent":["import { CommandPrecondition, type AnyCommandExecuteData, type CommandType } from '@reciple/core';\nimport { BaseModule } from './BaseModule.js';\nimport { hasMixin, mix } from 'ts-mixer';\nimport { ModuleType } from '../../helpers/constants.js';\n\nexport interface PreconditionModule<D = any> extends Omit<BaseModule, 'moduleType'>, CommandPrecondition<D> {}\n\n@mix(CommandPrecondition, BaseModule)\nexport abstract class PreconditionModule<D = any> implements PreconditionModule<D> {\n public moduleType: ModuleType.Precondition = ModuleType.Precondition;\n\n public abstract execute<T extends CommandType>(data: AnyCommandExecuteData<T>): Promise<CommandPrecondition.ResultDataResolvable<T, D>>;\n\n public static from<D>(data: PreconditionModule.Resolvable<D>): PreconditionModule<D> {\n if (hasMixin(data, PreconditionModule)) return data;\n\n const ModuleInstance = class extends PreconditionModule { execute = data.execute; };\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n}\n\nexport namespace PreconditionModule {\n export type Resolvable<D = any> = PreconditionModule<D>|PreconditionModule.Data<D>;\n\n export interface Data<D = any> extends Omit<BaseModule.Data, 'moduleType'>, Omit<CommandPrecondition.Data<D>, 'id'> {\n moduleType: ModuleType.Precondition;\n }\n}\n"],"mappings":";;;;;;;;AAQO,qDAAe,mBAA6D;CAC/E,AAAO,aAAsC,WAAW;CAIxD,OAAc,KAAQ,MAA+D;AACjF,MAAI,SAAS,0BAAyB,CAAE,QAAO;EAE/C,MAAM,iBAAiB,kCAAiC;GAAE,UAAU,KAAK;;AACzE,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB;;;uDAXlC,IAAI,qBAAqB,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
3
|
import { AnyCommandBuilderMethods } from "../../../helpers/types.mjs";
|
|
4
4
|
import { ContextMenuCommand, ContextMenuCommandBuilder } from "@reciple/core";
|
|
5
5
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
|
+
import { __decorate } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
4
4
|
import { ContextMenuCommand } from "@reciple/core";
|
|
5
5
|
import { DiscordSnowflake } from "@sapphire/snowflake";
|
|
6
6
|
import { hasMixin, mix } from "ts-mixer";
|
|
7
7
|
|
|
8
8
|
//#region src/classes/modules/commands/ContextMenuCommandModule.ts
|
|
9
9
|
var _ContextMenuCommandModule;
|
|
10
|
-
let ContextMenuCommandModule = _ContextMenuCommandModule = class ContextMenuCommandModule
|
|
10
|
+
let ContextMenuCommandModule = _ContextMenuCommandModule = class ContextMenuCommandModule {
|
|
11
11
|
moduleType = ModuleType.Command;
|
|
12
12
|
id = DiscordSnowflake.generate().toString();
|
|
13
13
|
static from(data) {
|
|
14
|
-
if (
|
|
14
|
+
if (hasMixin(data, _ContextMenuCommandModule)) return data;
|
|
15
15
|
const ModuleInstance = class extends _ContextMenuCommandModule {
|
|
16
16
|
data = data.data;
|
|
17
17
|
execute = data.execute;
|
|
@@ -20,7 +20,7 @@ let ContextMenuCommandModule = _ContextMenuCommandModule = class ContextMenuComm
|
|
|
20
20
|
return new ModuleInstance();
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
ContextMenuCommandModule = _ContextMenuCommandModule = __decorate([mix(
|
|
23
|
+
ContextMenuCommandModule = _ContextMenuCommandModule = __decorate([mix(ContextMenuCommand, BaseModule)], ContextMenuCommandModule);
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
26
|
export { ContextMenuCommandModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenuCommandModule.mjs","names":[
|
|
1
|
+
{"version":3,"file":"ContextMenuCommandModule.mjs","names":[],"sources":["../../../../src/classes/modules/commands/ContextMenuCommandModule.ts"],"sourcesContent":["import { BaseModule } from '../BaseModule.js';\nimport { ModuleType } from '../../../helpers/constants.js';\nimport { DiscordSnowflake } from '@sapphire/snowflake';\nimport { hasMixin, mix } from 'ts-mixer';\nimport type { AnyCommandBuilderMethods } from '../../../helpers/types.js';\nimport { ContextMenuCommand, type ContextMenuCommandBuilder } from '@reciple/core';\n\nexport interface ContextMenuCommandModule extends Omit<BaseModule, 'moduleType'>, ContextMenuCommandModule.ContextMenuCommandWithoutBuilderMethods {}\n\n@mix(ContextMenuCommand, BaseModule)\nexport abstract class ContextMenuCommandModule implements ContextMenuCommandModule {\n public readonly moduleType: ModuleType.Command = ModuleType.Command;\n public readonly id: string = DiscordSnowflake.generate().toString();\n\n public abstract data: ContextMenuCommandBuilder.Data;\n\n public abstract execute(data: ContextMenuCommand.ExecuteData): Promise<void>;\n\n public static from(data: ContextMenuCommandModule.Resolvable): ContextMenuCommandModule {\n if (hasMixin(data, ContextMenuCommandModule)) return data;\n\n const ModuleInstance = class extends ContextMenuCommandModule { data = data.data; execute = data.execute; };\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n}\n\nexport namespace ContextMenuCommandModule {\n export type Resolvable = ContextMenuCommandModule|ContextMenuCommandModule.Data;\n\n export interface Data extends Omit<BaseModule.Data, 'moduleType'>, Omit<ContextMenuCommand.Data, 'id'> {\n moduleType: ModuleType.Command;\n }\n\n export type ContextMenuCommandWithoutBuilderMethods = Omit<ContextMenuCommand, AnyCommandBuilderMethods>;\n}\n"],"mappings":";;;;;;;;;AAUO,iEAAe,yBAA6D;CAC/E,AAAgB,aAAiC,WAAW;CAC5D,AAAgB,KAAa,iBAAiB,UAAU,CAAC,UAAU;CAMnE,OAAc,KAAK,MAAqE;AACpF,MAAI,SAAS,gCAA+B,CAAE,QAAO;EAErD,MAAM,iBAAiB,wCAAuC;GAAE,OAAO,KAAK;GAAM,UAAU,KAAK;;AACjG,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB;;;mEAdlC,IAAI,oBAAoB,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
3
|
import { AnyCommandBuilderMethods } from "../../../helpers/types.mjs";
|
|
4
4
|
import { MessageCommand, MessageCommandBuilder } from "@reciple/core";
|
|
5
5
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
|
+
import { __decorate } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
4
4
|
import { MessageCommand, MessageCommandBuilder } from "@reciple/core";
|
|
5
5
|
import { DiscordSnowflake } from "@sapphire/snowflake";
|
|
6
6
|
import { hasMixin, mix } from "ts-mixer";
|
|
7
7
|
|
|
8
8
|
//#region src/classes/modules/commands/MessageCommandModule.ts
|
|
9
9
|
var _MessageCommandModule;
|
|
10
|
-
let MessageCommandModule = _MessageCommandModule = class MessageCommandModule
|
|
10
|
+
let MessageCommandModule = _MessageCommandModule = class MessageCommandModule {
|
|
11
11
|
moduleType = ModuleType.Command;
|
|
12
12
|
id = DiscordSnowflake.generate().toString();
|
|
13
13
|
static from(data) {
|
|
14
|
-
if (
|
|
14
|
+
if (hasMixin(data, _MessageCommandModule)) return data;
|
|
15
15
|
const ModuleInstance = class extends _MessageCommandModule {
|
|
16
16
|
data = data.data;
|
|
17
17
|
execute = data.execute;
|
|
@@ -20,7 +20,7 @@ let MessageCommandModule = _MessageCommandModule = class MessageCommandModule$1
|
|
|
20
20
|
return new ModuleInstance();
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
MessageCommandModule = _MessageCommandModule = __decorate([mix(
|
|
23
|
+
MessageCommandModule = _MessageCommandModule = __decorate([mix(MessageCommand, BaseModule)], MessageCommandModule);
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
26
|
export { MessageCommandModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageCommandModule.mjs","names":[
|
|
1
|
+
{"version":3,"file":"MessageCommandModule.mjs","names":[],"sources":["../../../../src/classes/modules/commands/MessageCommandModule.ts"],"sourcesContent":["import { MessageCommand, MessageCommandBuilder } from '@reciple/core';\nimport { BaseModule } from '../BaseModule.js';\nimport { ModuleType } from '../../../helpers/constants.js';\nimport { DiscordSnowflake } from '@sapphire/snowflake';\nimport { hasMixin, mix } from 'ts-mixer';\nimport type { AnyCommandBuilderMethods } from '../../../helpers/types.js';\n\nexport interface MessageCommandModule extends Omit<BaseModule, 'moduleType'>, MessageCommandModule.MessageCommandWithoutBuilderMethods {}\n\n@mix(MessageCommand, BaseModule)\nexport abstract class MessageCommandModule implements MessageCommandModule {\n public readonly moduleType: ModuleType.Command = ModuleType.Command;\n public readonly id: string = DiscordSnowflake.generate().toString();\n\n public abstract data: MessageCommandBuilder.Data;\n\n public abstract execute(data: MessageCommand.ExecuteData): Promise<void>;\n\n public static from(data: MessageCommandModule.Resolvable): MessageCommandModule {\n if (hasMixin(data, MessageCommandModule)) return data;\n\n const ModuleInstance = class extends MessageCommandModule { data = data.data; execute = data.execute; };\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n}\n\nexport namespace MessageCommandModule {\n export type Resolvable = MessageCommandModule|MessageCommandModule.Data;\n\n export interface Data extends Omit<BaseModule.Data, 'moduleType'>, Omit<MessageCommand.Data, 'id'> {\n moduleType: ModuleType.Command;\n }\n\n export type MessageCommandWithoutBuilderMethods = Omit<MessageCommand, AnyCommandBuilderMethods|'options'|'flags'>;\n}\n"],"mappings":";;;;;;;;;AAUO,yDAAe,qBAAqD;CACvE,AAAgB,aAAiC,WAAW;CAC5D,AAAgB,KAAa,iBAAiB,UAAU,CAAC,UAAU;CAMnE,OAAc,KAAK,MAA6D;AAC5E,MAAI,SAAS,4BAA2B,CAAE,QAAO;EAEjD,MAAM,iBAAiB,oCAAmC;GAAE,OAAO,KAAK;GAAM,UAAU,KAAK;;AAC7F,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB;;;2DAdlC,IAAI,gBAAgB,WAAW"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
3
|
import { AnyCommandBuilderMethods } from "../../../helpers/types.mjs";
|
|
4
4
|
import { SlashCommand, SlashCommandBuilder } from "@reciple/core";
|
|
5
5
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
|
+
import { __decorate } from "../../../_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
4
4
|
import { SlashCommand } from "@reciple/core";
|
|
5
5
|
import { DiscordSnowflake } from "@sapphire/snowflake";
|
|
6
6
|
import { hasMixin, mix } from "ts-mixer";
|
|
7
7
|
|
|
8
8
|
//#region src/classes/modules/commands/SlashCommandModule.ts
|
|
9
9
|
var _SlashCommandModule;
|
|
10
|
-
let SlashCommandModule = _SlashCommandModule = class SlashCommandModule
|
|
10
|
+
let SlashCommandModule = _SlashCommandModule = class SlashCommandModule {
|
|
11
11
|
moduleType = ModuleType.Command;
|
|
12
12
|
id = DiscordSnowflake.generate().toString();
|
|
13
13
|
static from(data) {
|
|
14
|
-
if (
|
|
14
|
+
if (hasMixin(data, _SlashCommandModule)) return data;
|
|
15
15
|
const ModuleInstance = class extends _SlashCommandModule {
|
|
16
16
|
data = data.data;
|
|
17
17
|
execute = data.execute;
|
|
@@ -20,7 +20,7 @@ let SlashCommandModule = _SlashCommandModule = class SlashCommandModule$1 {
|
|
|
20
20
|
return new ModuleInstance();
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
SlashCommandModule = _SlashCommandModule = __decorate([mix(
|
|
23
|
+
SlashCommandModule = _SlashCommandModule = __decorate([mix(SlashCommand, BaseModule)], SlashCommandModule);
|
|
24
24
|
|
|
25
25
|
//#endregion
|
|
26
26
|
export { SlashCommandModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlashCommandModule.mjs","names":[
|
|
1
|
+
{"version":3,"file":"SlashCommandModule.mjs","names":[],"sources":["../../../../src/classes/modules/commands/SlashCommandModule.ts"],"sourcesContent":["import { BaseModule } from '../BaseModule.js';\nimport { ModuleType } from '../../../helpers/constants.js';\nimport { DiscordSnowflake } from '@sapphire/snowflake';\nimport { hasMixin, mix } from 'ts-mixer';\nimport { SlashCommand, type SlashCommandBuilder } from '@reciple/core';\nimport type { AnyCommandBuilderMethods } from '../../../helpers/types.js';\n\nexport interface SlashCommandModule extends Omit<BaseModule, 'moduleType'>, SlashCommandModule.SlashCommandWithoutBuilderMethods {}\n\n@mix(SlashCommand, BaseModule)\nexport abstract class SlashCommandModule implements SlashCommandModule {\n public readonly moduleType: ModuleType.Command = ModuleType.Command;\n public readonly id: string = DiscordSnowflake.generate().toString();\n\n public abstract data: SlashCommandBuilder.Data;\n\n public abstract execute(data: SlashCommand.ExecuteData): Promise<void>;\n\n public static from(data: SlashCommandModule.Resolvable): SlashCommandModule {\n if (hasMixin(data, SlashCommandModule)) return data;\n\n const ModuleInstance = class extends SlashCommandModule { data = data.data; execute = data.execute; };\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n}\n\nexport namespace SlashCommandModule {\n export type Resolvable = SlashCommandModule|SlashCommandModule.Data;\n\n export interface Data extends Omit<BaseModule.Data, 'moduleType'>, Omit<SlashCommand.Data, 'id'> {\n moduleType: ModuleType.Command;\n }\n\n export type SlashCommandWithoutBuilderMethods = Omit<SlashCommand, AnyCommandBuilderMethods>;\n}\n"],"mappings":";;;;;;;;;AAUO,qDAAe,mBAAiD;CACnE,AAAgB,aAAiC,WAAW;CAC5D,AAAgB,KAAa,iBAAiB,UAAU,CAAC,UAAU;CAMnE,OAAc,KAAK,MAAyD;AACxE,MAAI,SAAS,0BAAyB,CAAE,QAAO;EAE/C,MAAM,iBAAiB,kCAAiC;GAAE,OAAO,KAAK;GAAM,UAAU,KAAK;;AAC3F,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB;;;uDAdlC,IAAI,cAAc,WAAW"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
3
|
-
import {
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
|
+
import { Awaitable } from "discord.js";
|
|
4
4
|
import { EventEmitter } from "node:events";
|
|
5
5
|
|
|
6
6
|
//#region src/classes/modules/events/EventModule.d.ts
|
|
7
|
-
declare
|
|
8
|
-
declare abstract class EventModule<Events extends EventModule.EventMap = EventModule.EventMap, Event extends keyof Events = keyof Events> extends base implements EventModule.Data<Events, Event> {
|
|
7
|
+
declare abstract class EventModule<Events extends EventModule.EventMap = EventModule.EventMap, Event extends keyof Events = keyof Events> extends BaseModule implements EventModule.Data<Events, Event> {
|
|
9
8
|
readonly moduleType: ModuleType.Event;
|
|
10
9
|
abstract emitter: EventEmitter;
|
|
11
10
|
abstract event: Event;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
2
1
|
import { BaseModule } from "../BaseModule.mjs";
|
|
2
|
+
import { ModuleType } from "../../../helpers/constants.mjs";
|
|
3
3
|
import { hasMixin } from "ts-mixer";
|
|
4
4
|
import { EventEmitter } from "node:events";
|
|
5
5
|
|
|
6
6
|
//#region src/classes/modules/events/EventModule.ts
|
|
7
|
-
|
|
8
|
-
var EventModule = class EventModule extends base {
|
|
7
|
+
var EventModule = class EventModule extends BaseModule {
|
|
9
8
|
moduleType = ModuleType.Event;
|
|
10
9
|
once = false;
|
|
11
10
|
static from(data) {
|
|
12
|
-
if (
|
|
11
|
+
if (hasMixin(data, EventModule)) return data;
|
|
13
12
|
const ModuleInstance = class extends EventModule {
|
|
14
13
|
emitter = data.emitter;
|
|
15
14
|
event = data.event;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventModule.mjs","names":[
|
|
1
|
+
{"version":3,"file":"EventModule.mjs","names":[],"sources":["../../../../src/classes/modules/events/EventModule.ts"],"sourcesContent":["import { EventEmitter } from 'node:events';\nimport { BaseModule } from '../BaseModule.js';\nimport { ModuleType } from '../../../helpers/constants.js';\nimport type { Awaitable } from 'discord.js';\nimport { hasMixin } from 'ts-mixer';\n\nexport abstract class EventModule<Events extends EventModule.EventMap = EventModule.EventMap, Event extends keyof Events = keyof Events> extends BaseModule implements EventModule.Data<Events, Event> {\n public readonly moduleType: ModuleType.Event = ModuleType.Event;\n public abstract emitter: EventEmitter;\n public abstract event: Event;\n\n public once?: boolean = false;\n\n public abstract onEvent(...args: Events[Event]): Awaitable<void>;\n\n public static from(data: EventModule.Resolvable): EventModule {\n if (hasMixin(data, EventModule)) return data;\n\n const ModuleInstance = class extends EventModule {\n emitter = data.emitter;\n event = data.event;\n once = data.once;\n onEvent = data.onEvent;\n };\n\n Object.assign(ModuleInstance.prototype, data);\n return new ModuleInstance();\n }\n}\n\nexport namespace EventModule {\n export type EventMap = Record<string|symbol, any>;\n export type Resolvable<Events extends EventModule.EventMap = EventModule.EventMap, Event extends keyof Events = keyof Events> = EventModule<Events, Event>|EventModule.Data<Events, Event>;\n\n export interface Data<Events extends EventModule.EventMap = EventModule.EventMap, Event extends keyof Events = keyof Events> extends Omit<BaseModule.Data, 'moduleType'> {\n moduleType: ModuleType.Event;\n emitter: EventEmitter;\n event: Event;\n once?: boolean;\n onEvent: (...args: Events[Event]) => Awaitable<void>;\n }\n}\n"],"mappings":";;;;;;AAMA,IAAsB,cAAtB,MAAsB,oBAA2H,WAAsD;CACnM,AAAgB,aAA+B,WAAW;CAI1D,AAAO,OAAiB;CAIxB,OAAc,KAAK,MAA2C;AAC1D,MAAI,SAAS,MAAM,YAAY,CAAE,QAAO;EAExC,MAAM,iBAAiB,cAAc,YAAY;GAC7C,UAAU,KAAK;GACf,QAAQ,KAAK;GACb,OAAO,KAAK;GACZ,UAAU,KAAK;;AAGnB,SAAO,OAAO,eAAe,WAAW,KAAK;AAC7C,SAAO,IAAI,gBAAgB"}
|
|
@@ -59,7 +59,7 @@ declare namespace ModuleTemplateBuilder {
|
|
|
59
59
|
CommandContextMenuType = "$COMMAND_CONTEXT_MENU_TYPE$",
|
|
60
60
|
EventEmitter = "$EVENT_EMITTER$",
|
|
61
61
|
EventName = "$EVENT_NAME$",
|
|
62
|
-
EventOnce = "$EVENT_ONCE$"
|
|
62
|
+
EventOnce = "$EVENT_ONCE$"
|
|
63
63
|
}
|
|
64
64
|
const PlaceholderDefaultValues: Record<Placeholder, string>;
|
|
65
65
|
const SourceDirectory: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { NotAnError } from "../NotAnError.mjs";
|
|
2
2
|
import { CLI } from "../cli/CLI.mjs";
|
|
3
3
|
import { ConfigReader } from "../cli/ConfigReader.mjs";
|
|
4
|
-
import { ModuleType } from "../../helpers/constants.mjs";
|
|
5
4
|
import { BaseModule } from "../modules/BaseModule.mjs";
|
|
5
|
+
import { ModuleType } from "../../helpers/constants.mjs";
|
|
6
6
|
import { PostconditionModule } from "../modules/PostconditionModule.mjs";
|
|
7
7
|
import { PreconditionModule } from "../modules/PreconditionModule.mjs";
|
|
8
8
|
import { EventModule } from "../modules/events/EventModule.mjs";
|
|
@@ -13,9 +13,9 @@ import { ModuleLoader } from "../client/ModuleLoader.mjs";
|
|
|
13
13
|
import { ClientEventModule } from "../modules/events/ClientEventModule.mjs";
|
|
14
14
|
import { RESTEventModule } from "../modules/events/RESTEventModule.mjs";
|
|
15
15
|
import path from "node:path";
|
|
16
|
-
import { colors } from "@reciple/utils";
|
|
17
16
|
import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
18
17
|
import { confirm, intro, isCancel, outro, select, text } from "@clack/prompts";
|
|
18
|
+
import { colors } from "@prtty/prtty";
|
|
19
19
|
import { readTSConfig } from "pkg-types";
|
|
20
20
|
import { ApplicationCommandType } from "discord.js";
|
|
21
21
|
import { existsSync } from "node:fs";
|
|
@@ -48,7 +48,7 @@ var ModuleTemplateBuilder = class ModuleTemplateBuilder {
|
|
|
48
48
|
this.defaultAll = options?.defaultAll ?? false;
|
|
49
49
|
}
|
|
50
50
|
async init() {
|
|
51
|
-
intro(colors.bold(
|
|
51
|
+
intro(colors.bold().black().bgCyan(` ${this.cli.command.name()} create module - v${this.cli.build} `));
|
|
52
52
|
return this;
|
|
53
53
|
}
|
|
54
54
|
async setupLanguage(options) {
|