@open-discord-bots/framework 0.2.5 → 0.2.7
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/api/main.js +1 -1
- package/dist/api/modules/action.d.ts +4 -4
- package/dist/api/modules/base.d.ts +12 -6
- package/dist/api/modules/builder.d.ts +25 -25
- package/dist/api/modules/checker.d.ts +7 -7
- package/dist/api/modules/client.d.ts +13 -13
- package/dist/api/modules/code.d.ts +4 -4
- package/dist/api/modules/config.d.ts +4 -4
- package/dist/api/modules/console.d.ts +4 -4
- package/dist/api/modules/cooldown.d.ts +4 -4
- package/dist/api/modules/database.d.ts +13 -13
- package/dist/api/modules/event.d.ts +4 -4
- package/dist/api/modules/flag.d.ts +4 -4
- package/dist/api/modules/helpmenu.d.ts +7 -7
- package/dist/api/modules/language.d.ts +6 -6
- package/dist/api/modules/permission.d.ts +4 -4
- package/dist/api/modules/plugin.d.ts +7 -7
- package/dist/api/modules/post.d.ts +4 -4
- package/dist/api/modules/progressbar.d.ts +8 -8
- package/dist/api/modules/responder.d.ts +19 -19
- package/dist/api/modules/session.d.ts +4 -4
- package/dist/api/modules/startscreen.d.ts +4 -4
- package/dist/api/modules/statistic.d.ts +15 -15
- package/dist/api/modules/verifybar.d.ts +4 -4
- package/package.json +1 -1
- package/src/api/main.ts +1 -1
- package/src/api/modules/action.ts +4 -4
- package/src/api/modules/base.ts +15 -10
- package/src/api/modules/builder.ts +25 -25
- package/src/api/modules/checker.ts +7 -7
- package/src/api/modules/client.ts +13 -13
- package/src/api/modules/code.ts +4 -4
- package/src/api/modules/config.ts +4 -4
- package/src/api/modules/console.ts +4 -4
- package/src/api/modules/cooldown.ts +4 -4
- package/src/api/modules/database.ts +13 -13
- package/src/api/modules/event.ts +4 -4
- package/src/api/modules/flag.ts +4 -4
- package/src/api/modules/helpmenu.ts +7 -7
- package/src/api/modules/language.ts +6 -6
- package/src/api/modules/permission.ts +4 -4
- package/src/api/modules/plugin.ts +7 -7
- package/src/api/modules/post.ts +4 -4
- package/src/api/modules/progressbar.ts +8 -8
- package/src/api/modules/responder.ts +19 -19
- package/src/api/modules/session.ts +4 -4
- package/src/api/modules/startscreen.ts +4 -4
- package/src/api/modules/statistic.ts +15 -15
- package/src/api/modules/verifybar.ts +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODManagerData, ODValidId, ODVersion } from "./base";
|
|
1
|
+
import { ODManager, ODManagerData, ODNoGeneric, ODValidId, ODVersion } from "./base";
|
|
2
2
|
import { ODDebugger } from "./console";
|
|
3
3
|
/**## ODUnknownCrashedPlugin `interface`
|
|
4
4
|
* Basic details for a plugin that crashed while loading the `plugin.json` file.
|
|
@@ -30,11 +30,11 @@ export declare class ODPluginManager<IdList extends ODPluginManagerIdConstraint
|
|
|
30
30
|
constructor(debug: ODDebugger);
|
|
31
31
|
/**Check if a plugin has been loaded successfully and is available for usage.*/
|
|
32
32
|
isPluginLoaded(id: ODValidId): boolean;
|
|
33
|
-
get<PluginId extends keyof IdList
|
|
33
|
+
get<PluginId extends keyof ODNoGeneric<IdList>>(id: PluginId): IdList[PluginId];
|
|
34
34
|
get(id: ODValidId): ODPlugin | null;
|
|
35
|
-
remove<PluginId extends keyof IdList
|
|
35
|
+
remove<PluginId extends keyof ODNoGeneric<IdList>>(id: PluginId): IdList[PluginId];
|
|
36
36
|
remove(id: ODValidId): ODPlugin | null;
|
|
37
|
-
exists(id: keyof IdList): boolean;
|
|
37
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
38
38
|
exists(id: ODValidId): boolean;
|
|
39
39
|
}
|
|
40
40
|
/**## ODPluginData `interface`
|
|
@@ -148,10 +148,10 @@ export type ODPluginClassManagerIdConstraint = Record<string, ODManagerData>;
|
|
|
148
148
|
*/
|
|
149
149
|
export declare class ODPluginClassManager<IdList extends ODPluginClassManagerIdConstraint = ODPluginClassManagerIdConstraint> extends ODManager<ODManagerData> {
|
|
150
150
|
constructor(debug: ODDebugger);
|
|
151
|
-
get<PluginClassId extends keyof IdList
|
|
151
|
+
get<PluginClassId extends keyof ODNoGeneric<IdList>>(id: PluginClassId): IdList[PluginClassId];
|
|
152
152
|
get(id: ODValidId): ODManagerData | null;
|
|
153
|
-
remove<PluginClassId extends keyof IdList
|
|
153
|
+
remove<PluginClassId extends keyof ODNoGeneric<IdList>>(id: PluginClassId): IdList[PluginClassId];
|
|
154
154
|
remove(id: ODValidId): ODManagerData | null;
|
|
155
|
-
exists(id: keyof IdList): boolean;
|
|
155
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
156
156
|
exists(id: ODValidId): boolean;
|
|
157
157
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODManagerData, ODValidId } from "./base";
|
|
1
|
+
import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
|
|
2
2
|
import { ODMessageBuildResult, ODMessageBuildSentResult } from "./builder";
|
|
3
3
|
import { ODDebugger } from "./console";
|
|
4
4
|
import * as discord from "discord.js";
|
|
@@ -19,11 +19,11 @@ export declare class ODPostManager<IdList extends ODPostManagerIdConstraint = OD
|
|
|
19
19
|
add(data: ODPost<discord.GuildBasedChannel>, overwrite?: boolean): boolean;
|
|
20
20
|
/**Initialize the post manager & all posts. */
|
|
21
21
|
init(guild: discord.Guild): Promise<void>;
|
|
22
|
-
get<PostId extends keyof IdList
|
|
22
|
+
get<PostId extends keyof ODNoGeneric<IdList>>(id: PostId): IdList[PostId];
|
|
23
23
|
get(id: ODValidId): ODPost<discord.GuildBasedChannel> | null;
|
|
24
|
-
remove<PostId extends keyof IdList
|
|
24
|
+
remove<PostId extends keyof ODNoGeneric<IdList>>(id: PostId): IdList[PostId];
|
|
25
25
|
remove(id: ODValidId): ODPost<discord.GuildBasedChannel> | null;
|
|
26
|
-
exists(id: keyof IdList): boolean;
|
|
26
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
27
27
|
exists(id: ODValidId): boolean;
|
|
28
28
|
}
|
|
29
29
|
/**## ODPost `class`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODManagerData, ODValidId } from "./base";
|
|
1
|
+
import { ODManager, ODManagerData, ODValidId, ODNoGeneric } from "./base";
|
|
2
2
|
import { ODDebugger, ODValidConsoleColor } from "./console";
|
|
3
3
|
/**## ODProgressBarRendererManagerIdConstraint `type`
|
|
4
4
|
* The constraint/layout for id mappings/interfaces of the `ODProgressBarRendererManager` class.
|
|
@@ -13,11 +13,11 @@ export type ODProgressBarRendererManagerIdConstraint = Record<string, ODProgress
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class ODProgressBarRendererManager<IdList extends ODProgressBarRendererManagerIdConstraint = ODProgressBarRendererManagerIdConstraint> extends ODManager<ODProgressBarRenderer<{}>> {
|
|
15
15
|
constructor(debug: ODDebugger);
|
|
16
|
-
get<RendererId extends keyof IdList
|
|
16
|
+
get<RendererId extends keyof ODNoGeneric<IdList>>(id: RendererId): IdList[RendererId];
|
|
17
17
|
get(id: ODValidId): ODProgressBarRenderer<{}> | null;
|
|
18
|
-
remove<RendererId extends keyof IdList
|
|
18
|
+
remove<RendererId extends keyof ODNoGeneric<IdList>>(id: RendererId): IdList[RendererId];
|
|
19
19
|
remove(id: ODValidId): ODProgressBarRenderer<{}> | null;
|
|
20
|
-
exists(id: keyof IdList): boolean;
|
|
20
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
21
21
|
exists(id: ODValidId): boolean;
|
|
22
22
|
}
|
|
23
23
|
/**## ODProgressBarManagerIdConstraint `type`
|
|
@@ -33,13 +33,13 @@ export type ODProgressBarManagerIdConstraint = Record<string, ODProgressBar>;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare class ODProgressBarManager<IdList extends ODProgressBarManagerIdConstraint = ODProgressBarManagerIdConstraint, RendererIdList extends ODProgressBarRendererManagerIdConstraint = ODProgressBarRendererManagerIdConstraint> extends ODManager<ODProgressBar> {
|
|
35
35
|
/**A collection of render types for progress bars. */
|
|
36
|
-
renderers: ODProgressBarRendererManager<
|
|
36
|
+
renderers: ODProgressBarRendererManager<RendererIdList>;
|
|
37
37
|
constructor(debug: ODDebugger);
|
|
38
|
-
get<ProgressBarId extends keyof IdList
|
|
38
|
+
get<ProgressBarId extends keyof ODNoGeneric<IdList>>(id: ProgressBarId): IdList[ProgressBarId];
|
|
39
39
|
get(id: ODValidId): ODProgressBar | null;
|
|
40
|
-
remove<ProgressBarId extends keyof IdList
|
|
40
|
+
remove<ProgressBarId extends keyof ODNoGeneric<IdList>>(id: ProgressBarId): IdList[ProgressBarId];
|
|
41
41
|
remove(id: ODValidId): ODProgressBar | null;
|
|
42
|
-
exists(id: keyof IdList): boolean;
|
|
42
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
43
43
|
exists(id: ODValidId): boolean;
|
|
44
44
|
}
|
|
45
45
|
/**## ODProgressBarRenderFunc `type`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODValidId, ODManagerData } from "./base";
|
|
1
|
+
import { ODManager, ODValidId, ODManagerData, ODNoGeneric } from "./base";
|
|
2
2
|
import * as discord from "discord.js";
|
|
3
3
|
import { ODWorkerManager, ODWorkerCallback } from "./worker";
|
|
4
4
|
import { ODDebugger } from "./console";
|
|
@@ -81,11 +81,11 @@ export declare class ODCommandResponderManager<IdList extends ODCommandResponder
|
|
|
81
81
|
/**Set the message to send when the response times out! */
|
|
82
82
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODCommandResponderInstance, "slash" | "text"> | null, ms: number | null): void;
|
|
83
83
|
add(data: ODCommandResponder<"slash" | "text", any>, overwrite?: boolean): boolean;
|
|
84
|
-
get<CommandResponderId extends keyof IdList
|
|
84
|
+
get<CommandResponderId extends keyof ODNoGeneric<IdList>>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["source"], IdList[CommandResponderId]["params"], IdList[CommandResponderId]["workers"]>;
|
|
85
85
|
get(id: ODValidId): ODCommandResponder<"slash" | "text", any> | null;
|
|
86
|
-
remove<CommandResponderId extends keyof IdList
|
|
86
|
+
remove<CommandResponderId extends keyof ODNoGeneric<IdList>>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["source"], IdList[CommandResponderId]["params"], IdList[CommandResponderId]["workers"]>;
|
|
87
87
|
remove(id: ODValidId): ODCommandResponder<"slash" | "text", any> | null;
|
|
88
|
-
exists(id: keyof IdList): boolean;
|
|
88
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
89
89
|
exists(id: ODValidId): boolean;
|
|
90
90
|
}
|
|
91
91
|
/**## ODCommandResponderInstanceOptions `class`
|
|
@@ -196,11 +196,11 @@ export declare class ODButtonResponderManager<IdList extends ODButtonResponderMa
|
|
|
196
196
|
/**Set the message to send when the response times out! */
|
|
197
197
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODButtonResponderInstance, "button"> | null, ms: number | null): void;
|
|
198
198
|
add(data: ODButtonResponder<"button", any>, overwrite?: boolean): boolean;
|
|
199
|
-
get<ButtonResponderId extends keyof IdList
|
|
199
|
+
get<ButtonResponderId extends keyof ODNoGeneric<IdList>>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["source"], IdList[ButtonResponderId]["params"], IdList[ButtonResponderId]["workers"]>;
|
|
200
200
|
get(id: ODValidId): ODButtonResponder<"button", any> | null;
|
|
201
|
-
remove<ButtonResponderId extends keyof IdList
|
|
201
|
+
remove<ButtonResponderId extends keyof ODNoGeneric<IdList>>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["source"], IdList[ButtonResponderId]["params"], IdList[ButtonResponderId]["workers"]>;
|
|
202
202
|
remove(id: ODValidId): ODButtonResponder<"button", any> | null;
|
|
203
|
-
exists(id: keyof IdList): boolean;
|
|
203
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
204
204
|
exists(id: ODValidId): boolean;
|
|
205
205
|
}
|
|
206
206
|
/**## ODButtonResponderInstance `class`
|
|
@@ -278,11 +278,11 @@ export declare class ODDropdownResponderManager<IdList extends ODDropdownRespond
|
|
|
278
278
|
/**Set the message to send when the response times out! */
|
|
279
279
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODDropdownResponderInstance, "dropdown"> | null, ms: number | null): void;
|
|
280
280
|
add(data: ODDropdownResponder<"dropdown", any>, overwrite?: boolean): boolean;
|
|
281
|
-
get<DropdownResponderId extends keyof IdList
|
|
281
|
+
get<DropdownResponderId extends keyof ODNoGeneric<IdList>>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["source"], IdList[DropdownResponderId]["params"], IdList[DropdownResponderId]["workers"]>;
|
|
282
282
|
get(id: ODValidId): ODDropdownResponder<"dropdown", any> | null;
|
|
283
|
-
remove<DropdownResponderId extends keyof IdList
|
|
283
|
+
remove<DropdownResponderId extends keyof ODNoGeneric<IdList>>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["source"], IdList[DropdownResponderId]["params"], IdList[DropdownResponderId]["workers"]>;
|
|
284
284
|
remove(id: ODValidId): ODDropdownResponder<"dropdown", any> | null;
|
|
285
|
-
exists(id: keyof IdList): boolean;
|
|
285
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
286
286
|
exists(id: ODValidId): boolean;
|
|
287
287
|
}
|
|
288
288
|
/**## ODDropdownResponderInstanceValues `class`
|
|
@@ -381,11 +381,11 @@ export declare class ODModalResponderManager<IdList extends ODModalResponderMana
|
|
|
381
381
|
/**Set the message to send when the response times out! */
|
|
382
382
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODModalResponderInstance, "modal"> | null, ms: number | null): void;
|
|
383
383
|
add(data: ODModalResponder<"modal", any>, overwrite?: boolean): boolean;
|
|
384
|
-
get<ModalResponderId extends keyof IdList
|
|
384
|
+
get<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
385
385
|
get(id: ODValidId): ODModalResponder<"modal", any> | null;
|
|
386
|
-
remove<ModalResponderId extends keyof IdList
|
|
386
|
+
remove<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
387
387
|
remove(id: ODValidId): ODModalResponder<"modal", any> | null;
|
|
388
|
-
exists(id: keyof IdList): boolean;
|
|
388
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
389
389
|
exists(id: ODValidId): boolean;
|
|
390
390
|
}
|
|
391
391
|
/**## ODModalResponderInstanceValues `class`
|
|
@@ -464,11 +464,11 @@ export declare class ODContextMenuResponderManager<IdList extends ODContextMenuR
|
|
|
464
464
|
/**Set the message to send when the response times out! */
|
|
465
465
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODContextMenuResponderInstance, "context-menu"> | null, ms: number | null): void;
|
|
466
466
|
add(data: ODContextMenuResponder<"context-menu", any>, overwrite?: boolean): boolean;
|
|
467
|
-
get<ModalResponderId extends keyof IdList
|
|
467
|
+
get<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
468
468
|
get(id: ODValidId): ODContextMenuResponder<"context-menu", any> | null;
|
|
469
|
-
remove<ModalResponderId extends keyof IdList
|
|
469
|
+
remove<ModalResponderId extends keyof ODNoGeneric<IdList>>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
|
|
470
470
|
remove(id: ODValidId): ODContextMenuResponder<"context-menu", any> | null;
|
|
471
|
-
exists(id: keyof IdList): boolean;
|
|
471
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
472
472
|
exists(id: ODValidId): boolean;
|
|
473
473
|
}
|
|
474
474
|
/**## ODContextMenuResponderInstance `class`
|
|
@@ -539,11 +539,11 @@ export declare class ODAutocompleteResponderManager<IdList extends ODAutocomplet
|
|
|
539
539
|
/**Set the message to send when the response times out! */
|
|
540
540
|
setTimeoutErrorCallback(callback: ODResponderTimeoutErrorCallback<ODAutocompleteResponderInstance, "autocomplete"> | null, ms: number | null): void;
|
|
541
541
|
add(data: ODAutocompleteResponder<"autocomplete", any>, overwrite?: boolean): boolean;
|
|
542
|
-
get<AutocompleteResponderId extends keyof IdList
|
|
542
|
+
get<AutocompleteResponderId extends keyof ODNoGeneric<IdList>>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["source"], IdList[AutocompleteResponderId]["params"], IdList[AutocompleteResponderId]["workers"]>;
|
|
543
543
|
get(id: ODValidId): ODAutocompleteResponder<"autocomplete", any> | null;
|
|
544
|
-
remove<AutocompleteResponderId extends keyof IdList
|
|
544
|
+
remove<AutocompleteResponderId extends keyof ODNoGeneric<IdList>>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["source"], IdList[AutocompleteResponderId]["params"], IdList[AutocompleteResponderId]["workers"]>;
|
|
545
545
|
remove(id: ODValidId): ODAutocompleteResponder<"autocomplete", any> | null;
|
|
546
|
-
exists(id: keyof IdList): boolean;
|
|
546
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
547
547
|
exists(id: ODValidId): boolean;
|
|
548
548
|
}
|
|
549
549
|
/**## ODAutocompleteResponderInstance `class`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODManagerData, ODValidId } from "./base";
|
|
1
|
+
import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
|
|
2
2
|
import { ODDebugger } from "./console";
|
|
3
3
|
/**## ODSessionManagerIdConstraint `type`
|
|
4
4
|
* The constraint/layout for id mappings/interfaces of the `ODSessionManager` class.
|
|
@@ -14,11 +14,11 @@ export type ODSessionManagerIdConstraint = Record<string, ODSession>;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class ODSessionManager<IdList extends ODSessionManagerIdConstraint = ODSessionManagerIdConstraint> extends ODManager<ODSession> {
|
|
16
16
|
constructor(debug: ODDebugger);
|
|
17
|
-
get<SessionId extends keyof IdList
|
|
17
|
+
get<SessionId extends keyof ODNoGeneric<IdList>>(id: SessionId): IdList[SessionId];
|
|
18
18
|
get(id: ODValidId): ODSession | null;
|
|
19
|
-
remove<SessionId extends keyof IdList
|
|
19
|
+
remove<SessionId extends keyof ODNoGeneric<IdList>>(id: SessionId): IdList[SessionId];
|
|
20
20
|
remove(id: ODValidId): ODSession | null;
|
|
21
|
-
exists(id: keyof IdList): boolean;
|
|
21
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
22
22
|
exists(id: ODValidId): boolean;
|
|
23
23
|
}
|
|
24
24
|
/**## ODSessionInstance `interface`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODManagerData, ODValidId } from "./base";
|
|
1
|
+
import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
|
|
2
2
|
import { ODDebugger, ODLiveStatusManager, ODLiveStatusManagerIdConstraint } from "./console";
|
|
3
3
|
import { ODFlag } from "./flag";
|
|
4
4
|
import { ODPlugin, ODUnknownCrashedPlugin } from "./plugin";
|
|
@@ -25,11 +25,11 @@ export declare class ODStartScreenManager<IdList extends ODStartScreenManagerIdC
|
|
|
25
25
|
getSortedComponents(priority: "ascending" | "descending"): ODStartScreenComponent[];
|
|
26
26
|
/**Render all startscreen components in priority order. */
|
|
27
27
|
renderAllComponents(): Promise<void>;
|
|
28
|
-
get<StartScreenId extends keyof IdList
|
|
28
|
+
get<StartScreenId extends keyof ODNoGeneric<IdList>>(id: StartScreenId): IdList[StartScreenId];
|
|
29
29
|
get(id: ODValidId): ODStartScreenComponent | null;
|
|
30
|
-
remove<StartScreenId extends keyof IdList
|
|
30
|
+
remove<StartScreenId extends keyof ODNoGeneric<IdList>>(id: StartScreenId): IdList[StartScreenId];
|
|
31
31
|
remove(id: ODValidId): ODStartScreenComponent | null;
|
|
32
|
-
exists(id: keyof IdList): boolean;
|
|
32
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
33
33
|
exists(id: ODValidId): boolean;
|
|
34
34
|
}
|
|
35
35
|
/**## ODStartScreenComponent `class`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODId, ODManager, ODManagerData, ODValidId } from "./base";
|
|
1
|
+
import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
|
|
2
2
|
import { ODDebugger } from "./console";
|
|
3
3
|
import { ODDatabase, ODDatabaseIdConstraint, ODJsonDatabaseStructure } from "./database";
|
|
4
4
|
import * as discord from "discord.js";
|
|
@@ -42,11 +42,11 @@ export declare class ODStatisticManager<IdList extends ODStatisticManagerIdConst
|
|
|
42
42
|
reset(): Promise<void>;
|
|
43
43
|
/**Run a function when the statistics are initialized. This can be used to clear statistics from users that left the server or tickets which don't exist anymore. */
|
|
44
44
|
onInit(callback: ODStatisticManagerInitCallback): void;
|
|
45
|
-
get<ScopeId extends keyof IdList
|
|
45
|
+
get<ScopeId extends keyof ODNoGeneric<IdList>>(id: ScopeId): IdList[ScopeId];
|
|
46
46
|
get(id: ODValidId): ODStatisticScope | null;
|
|
47
|
-
remove<ScopeId extends keyof IdList
|
|
47
|
+
remove<ScopeId extends keyof ODNoGeneric<IdList>>(id: ScopeId): IdList[ScopeId];
|
|
48
48
|
remove(id: ODValidId): ODStatisticScope | null;
|
|
49
|
-
exists(id: keyof IdList): boolean;
|
|
49
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
50
50
|
exists(id: ODValidId): boolean;
|
|
51
51
|
}
|
|
52
52
|
/**## ODStatisticScopeIdConstraint `type`
|
|
@@ -74,10 +74,10 @@ export declare class ODStatisticScope<IdList extends ODStatisticScopeIdConstrain
|
|
|
74
74
|
/**Select the database to use to read/write all statistics from/to. (Automatically assigned when used in `ODStatisticManager`) */
|
|
75
75
|
useDatabase(database: ODDatabase<ODDatabaseIdConstraint>): void;
|
|
76
76
|
/**Get the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
|
|
77
|
-
getStat<StatisticId extends keyof IdList
|
|
77
|
+
getStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId, scopeId: string): Promise<ODValidStatisticValue | null>;
|
|
78
78
|
getStat(id: ODValidId, scopeId: string): Promise<ODValidStatisticValue | null>;
|
|
79
79
|
/**Get the value of a statistic for all `scopeId`'s. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
|
|
80
|
-
getAllStats<StatisticId extends keyof IdList
|
|
80
|
+
getAllStats<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): Promise<{
|
|
81
81
|
id: string;
|
|
82
82
|
value: ODValidStatisticValue;
|
|
83
83
|
}[]>;
|
|
@@ -86,20 +86,20 @@ export declare class ODStatisticScope<IdList extends ODStatisticScopeIdConstrain
|
|
|
86
86
|
value: ODValidStatisticValue;
|
|
87
87
|
}[]>;
|
|
88
88
|
/**Set, increase or decrease the value of a statistic. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
|
|
89
|
-
setStat<StatisticId extends keyof IdList
|
|
89
|
+
setStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId, scopeId: string, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
|
|
90
90
|
setStat(id: ODValidId, scopeId: string, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
|
|
91
91
|
/**Reset the value of a statistic to the initial value. The `scopeId` is the unique id of the user, channel, role, etc that the statistics are related to. */
|
|
92
|
-
resetStat<StatisticId extends keyof IdList
|
|
92
|
+
resetStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: ODValidId, scopeId: string): Promise<ODValidStatisticValue | null>;
|
|
93
93
|
resetStat(id: ODValidId, scopeId: string): Promise<ODValidStatisticValue | null>;
|
|
94
94
|
/**Initialize this statistic scope & return a list of all statistic ids in the following format: `<scopeid>_<statid>` */
|
|
95
95
|
init(): string[];
|
|
96
96
|
/**Render all statistics in this scope for usage in a discord message/embed. */
|
|
97
97
|
render(scopeId: string, guild: discord.Guild, channel: discord.TextBasedChannel, user: discord.User): Promise<string>;
|
|
98
|
-
get<StatisticId extends keyof IdList
|
|
98
|
+
get<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): IdList[StatisticId];
|
|
99
99
|
get(id: ODValidId): ODStatistic | null;
|
|
100
|
-
remove<StatisticId extends keyof IdList
|
|
100
|
+
remove<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): IdList[StatisticId];
|
|
101
101
|
remove(id: ODValidId): ODStatistic | null;
|
|
102
|
-
exists(id: keyof IdList): boolean;
|
|
102
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
103
103
|
exists(id: ODValidId): boolean;
|
|
104
104
|
}
|
|
105
105
|
/**## ODStatisticGlobalScope `class`
|
|
@@ -111,9 +111,9 @@ export declare class ODStatisticScope<IdList extends ODStatisticScopeIdConstrain
|
|
|
111
111
|
* This scope is made specifically for the global statistics of Open Discord.
|
|
112
112
|
*/
|
|
113
113
|
export declare class ODStatisticGlobalScope<IdList extends ODStatisticScopeIdConstraint = ODStatisticScopeIdConstraint> extends ODStatisticScope<IdList> {
|
|
114
|
-
getStat<StatisticId extends keyof IdList
|
|
114
|
+
getStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): Promise<ODValidStatisticValue | null>;
|
|
115
115
|
getStat(id: ODValidId): Promise<ODValidStatisticValue | null>;
|
|
116
|
-
getAllStats<StatisticId extends keyof IdList
|
|
116
|
+
getAllStats<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): Promise<{
|
|
117
117
|
id: string;
|
|
118
118
|
value: ODValidStatisticValue;
|
|
119
119
|
}[]>;
|
|
@@ -121,9 +121,9 @@ export declare class ODStatisticGlobalScope<IdList extends ODStatisticScopeIdCon
|
|
|
121
121
|
id: string;
|
|
122
122
|
value: ODValidStatisticValue;
|
|
123
123
|
}[]>;
|
|
124
|
-
setStat<StatisticId extends keyof IdList
|
|
124
|
+
setStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
|
|
125
125
|
setStat(id: ODValidId, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
|
|
126
|
-
resetStat<StatisticId extends keyof IdList
|
|
126
|
+
resetStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: ODValidId): Promise<ODValidStatisticValue | null>;
|
|
127
127
|
resetStat(id: ODValidId): Promise<ODValidStatisticValue | null>;
|
|
128
128
|
render(scopeId: "GLOBAL", guild: discord.Guild, channel: discord.TextBasedChannel, user: discord.User): Promise<string>;
|
|
129
129
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ODManager, ODManagerData, ODValidId } from "./base";
|
|
1
|
+
import { ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
|
|
2
2
|
import { ODMessage } from "./builder";
|
|
3
3
|
import { ODDebugger } from "./console";
|
|
4
4
|
import { ODButtonResponderInstance } from "./responder";
|
|
@@ -59,10 +59,10 @@ export type ODVerifyBarManagerIdConstraint = Record<string, {
|
|
|
59
59
|
*/
|
|
60
60
|
export declare class ODVerifyBarManager<IdList extends ODVerifyBarManagerIdConstraint = ODVerifyBarManagerIdConstraint> extends ODManager<ODVerifyBar> {
|
|
61
61
|
constructor(debug: ODDebugger);
|
|
62
|
-
get<VerifyBarId extends keyof IdList
|
|
62
|
+
get<VerifyBarId extends keyof ODNoGeneric<IdList>>(id: VerifyBarId): ODVerifyBar<IdList[VerifyBarId]["successWorkerIds"], IdList[VerifyBarId]["failureWorkerIds"]>;
|
|
63
63
|
get(id: ODValidId): ODVerifyBar | null;
|
|
64
|
-
remove<VerifyBarId extends keyof IdList
|
|
64
|
+
remove<VerifyBarId extends keyof ODNoGeneric<IdList>>(id: VerifyBarId): ODVerifyBar<IdList[VerifyBarId]["successWorkerIds"], IdList[VerifyBarId]["failureWorkerIds"]>;
|
|
65
65
|
remove(id: ODValidId): ODVerifyBar | null;
|
|
66
|
-
exists(id: keyof IdList): boolean;
|
|
66
|
+
exists(id: keyof ODNoGeneric<IdList>): boolean;
|
|
67
67
|
exists(id: ODValidId): boolean;
|
|
68
68
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-discord-bots/framework",
|
|
3
3
|
"author": "DJj123dj",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.7",
|
|
5
5
|
"description": "The core framework of the popular open-source discord bots: Open Ticket & Open Moderation.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
package/src/api/main.ts
CHANGED
|
@@ -142,7 +142,7 @@ export class ODMain implements ODMainManagers {
|
|
|
142
142
|
constructor(managers:ODMainManagers,project:ODProjectType){
|
|
143
143
|
this.project = project
|
|
144
144
|
this.versions = managers.versions
|
|
145
|
-
this.versions.add(ODVersion.fromString("opendiscord:api","
|
|
145
|
+
this.versions.add(ODVersion.fromString("opendiscord:api","v0.2.7"))
|
|
146
146
|
this.versions.add(ODVersion.fromString("opendiscord:livestatus","v2.0.0"))
|
|
147
147
|
|
|
148
148
|
this.debugfile = managers.debugfile
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
///////////////////////////////////////
|
|
2
2
|
//ACTION MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
|
-
import { ODId, ODManager, ODValidId, ODSystemError, ODManagerData } from "./base"
|
|
4
|
+
import { ODId, ODManager, ODValidId, ODSystemError, ODManagerData, ODNoGeneric } from "./base"
|
|
5
5
|
import { ODWorkerManager, ODWorkerCallback, ODWorker } from "./worker"
|
|
6
6
|
import { ODDebugger } from "./console"
|
|
7
7
|
|
|
@@ -47,21 +47,21 @@ export class ODActionManager<IdList extends ODActionManagerIdConstraint = ODActi
|
|
|
47
47
|
super(debug,"action")
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
get<ActionId extends keyof IdList
|
|
50
|
+
get<ActionId extends keyof ODNoGeneric<IdList>>(id:ActionId): ODAction<IdList[ActionId]["source"],IdList[ActionId]["params"],IdList[ActionId]["result"],IdList[ActionId]["workers"]>
|
|
51
51
|
get(id:ODValidId): ODAction<string,{},{},string>|null
|
|
52
52
|
|
|
53
53
|
get(id:ODValidId): ODAction<string,{},{},string>|null {
|
|
54
54
|
return super.get(id)
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
remove<ActionId extends keyof IdList
|
|
57
|
+
remove<ActionId extends keyof ODNoGeneric<IdList>>(id:ActionId): ODAction<IdList[ActionId]["source"],IdList[ActionId]["params"],IdList[ActionId]["result"],IdList[ActionId]["workers"]>
|
|
58
58
|
remove(id:ODValidId): ODAction<string,{},{},string>|null
|
|
59
59
|
|
|
60
60
|
remove(id:ODValidId): ODAction<string,{},{},string>|null {
|
|
61
61
|
return super.remove(id)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
exists(id:keyof IdList): boolean
|
|
64
|
+
exists(id:keyof ODNoGeneric<IdList>): boolean
|
|
65
65
|
exists(id:ODValidId): boolean
|
|
66
66
|
|
|
67
67
|
exists(id:ODValidId): boolean {
|
package/src/api/modules/base.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//BASE MODULE
|
|
3
3
|
///////////////////////////////////////
|
|
4
4
|
import * as fs from "fs"
|
|
5
|
-
import {
|
|
5
|
+
import { ODDebugger } from "./console"
|
|
6
6
|
import type { ODMain } from "../main"
|
|
7
7
|
|
|
8
8
|
/**## ODPromiseVoid `type`
|
|
@@ -15,7 +15,6 @@ export type ODPromiseVoid = void|Promise<void>
|
|
|
15
15
|
*/
|
|
16
16
|
export type ODOptionalPromise<T> = T|Promise<T>
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
/**## ODValidButtonColor `type`
|
|
20
19
|
* This is a collection of all the possible button colors.
|
|
21
20
|
*/
|
|
@@ -27,22 +26,21 @@ export type ODValidButtonColor = "gray"|"red"|"green"|"blue"
|
|
|
27
26
|
export type ODProjectType = "openticket"|"openmoderation"
|
|
28
27
|
|
|
29
28
|
/**## ODValidId `type`
|
|
30
|
-
*
|
|
29
|
+
* A valid Open Discord identifier. It can be an `ODId` or `string`!
|
|
31
30
|
*
|
|
32
31
|
* You will see this type in many functions from Open Discord.
|
|
33
32
|
*/
|
|
34
33
|
export type ODValidId = string|number|symbol|ODId
|
|
35
34
|
|
|
36
35
|
/**## ODValidJsonType `type`
|
|
37
|
-
*
|
|
36
|
+
* A collection of all types that can be stored in a JSON file!
|
|
38
37
|
*
|
|
39
38
|
* list: `string`, `number`, `boolean`, `array`, `object`, `null`
|
|
40
39
|
*/
|
|
41
40
|
export type ODValidJsonType = string|number|boolean|object|ODValidJsonType[]|null
|
|
42
41
|
|
|
43
|
-
|
|
44
42
|
/**## ODInterfaceWithPartialProperty `type`
|
|
45
|
-
*
|
|
43
|
+
* A utility type to create an interface where some properties are optional!
|
|
46
44
|
*/
|
|
47
45
|
export type ODInterfaceWithPartialProperty<Interface,Key extends keyof Interface> = Omit<Interface,Key> & Partial<Pick<Interface,Key>>
|
|
48
46
|
|
|
@@ -51,6 +49,13 @@ export type ODInterfaceWithPartialProperty<Interface,Key extends keyof Interface
|
|
|
51
49
|
*/
|
|
52
50
|
export type ODDiscordIdType = "role"|"server"|"channel"|"category"|"user"|"member"|"interaction"|"message"
|
|
53
51
|
|
|
52
|
+
/**## ODNoGeneric `type`
|
|
53
|
+
* A utility type to remove generic index signatures from interfaces. This is required for providing autocomplete in all `IdList`'s of the `ODManagers`.
|
|
54
|
+
*/
|
|
55
|
+
export type ODNoGeneric<T extends Record<string|number|symbol,any>> = {
|
|
56
|
+
[K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : K]: T[K]
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
/**## ODId `class`
|
|
55
60
|
* This is an Open Discord identifier.
|
|
56
61
|
*
|
|
@@ -210,7 +215,7 @@ export class ODManager<DataType extends ODManagerData> extends ODManagerChangeHe
|
|
|
210
215
|
this.#debug = debug
|
|
211
216
|
this.#debugname = debugname
|
|
212
217
|
}
|
|
213
|
-
|
|
218
|
+
|
|
214
219
|
/**Add data to the manager. The `ODId` in the data class will be used as identifier! You can optionally select to overwrite existing data!*/
|
|
215
220
|
add(data:DataType|DataType[], overwrite?:boolean): boolean {
|
|
216
221
|
//repeat same command when data is an array
|
|
@@ -407,21 +412,21 @@ export class ODVersionManager<IdList extends ODVersionManagerIdConstraint = ODVe
|
|
|
407
412
|
super()
|
|
408
413
|
}
|
|
409
414
|
|
|
410
|
-
get<VersionId extends keyof IdList
|
|
415
|
+
get<VersionId extends keyof ODNoGeneric<IdList>>(id:VersionId): IdList[VersionId]
|
|
411
416
|
get(id:ODValidId): ODVersion|null
|
|
412
417
|
|
|
413
418
|
get(id:ODValidId): ODVersion|null {
|
|
414
419
|
return super.get(id)
|
|
415
420
|
}
|
|
416
421
|
|
|
417
|
-
remove<VersionId extends keyof IdList
|
|
422
|
+
remove<VersionId extends keyof ODNoGeneric<IdList>>(id:VersionId): IdList[VersionId]
|
|
418
423
|
remove(id:ODValidId): ODVersion|null
|
|
419
424
|
|
|
420
425
|
remove(id:ODValidId): ODVersion|null {
|
|
421
426
|
return super.remove(id)
|
|
422
427
|
}
|
|
423
428
|
|
|
424
|
-
exists(id:keyof IdList): boolean
|
|
429
|
+
exists(id:keyof ODNoGeneric<IdList>): boolean
|
|
425
430
|
exists(id:ODValidId): boolean
|
|
426
431
|
|
|
427
432
|
exists(id:ODValidId): boolean {
|