@open-discord-bots/framework 0.2.4 → 0.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.
Files changed (61) hide show
  1. package/README.md +1 -1
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +1 -1
  4. package/dist/api/main.d.ts +3 -3
  5. package/dist/api/main.js +2 -2
  6. package/dist/api/modules/action.d.ts +4 -4
  7. package/dist/api/modules/base.d.ts +12 -6
  8. package/dist/api/modules/builder.d.ts +25 -25
  9. package/dist/api/modules/checker.d.ts +7 -7
  10. package/dist/api/modules/client.d.ts +13 -13
  11. package/dist/api/modules/code.d.ts +5 -5
  12. package/dist/api/modules/code.js +1 -1
  13. package/dist/api/modules/config.d.ts +4 -4
  14. package/dist/api/modules/console.d.ts +4 -4
  15. package/dist/api/modules/console.js +2 -2
  16. package/dist/api/modules/cooldown.d.ts +4 -4
  17. package/dist/api/modules/database.d.ts +13 -13
  18. package/dist/api/modules/event.d.ts +4 -4
  19. package/dist/api/modules/flag.d.ts +4 -4
  20. package/dist/api/modules/fuse.d.ts +6 -6
  21. package/dist/api/modules/fuse.js +3 -3
  22. package/dist/api/modules/helpmenu.d.ts +7 -7
  23. package/dist/api/modules/language.d.ts +6 -6
  24. package/dist/api/modules/permission.d.ts +4 -4
  25. package/dist/api/modules/plugin.d.ts +7 -7
  26. package/dist/api/modules/post.d.ts +4 -4
  27. package/dist/api/modules/progressbar.d.ts +7 -7
  28. package/dist/api/modules/responder.d.ts +19 -19
  29. package/dist/api/modules/session.d.ts +4 -4
  30. package/dist/api/modules/startscreen.d.ts +4 -4
  31. package/dist/api/modules/statistic.d.ts +176 -0
  32. package/dist/api/modules/{stat.js → statistic.js} +52 -52
  33. package/dist/api/modules/verifybar.d.ts +4 -4
  34. package/package.json +1 -1
  35. package/src/api/index.ts +1 -1
  36. package/src/api/main.ts +14 -14
  37. package/src/api/modules/action.ts +4 -4
  38. package/src/api/modules/base.ts +15 -10
  39. package/src/api/modules/builder.ts +25 -25
  40. package/src/api/modules/checker.ts +7 -7
  41. package/src/api/modules/client.ts +13 -13
  42. package/src/api/modules/code.ts +5 -5
  43. package/src/api/modules/config.ts +4 -4
  44. package/src/api/modules/console.ts +6 -6
  45. package/src/api/modules/cooldown.ts +4 -4
  46. package/src/api/modules/database.ts +13 -13
  47. package/src/api/modules/event.ts +4 -4
  48. package/src/api/modules/flag.ts +4 -4
  49. package/src/api/modules/fuse.ts +9 -9
  50. package/src/api/modules/helpmenu.ts +7 -7
  51. package/src/api/modules/language.ts +6 -6
  52. package/src/api/modules/permission.ts +4 -4
  53. package/src/api/modules/plugin.ts +7 -7
  54. package/src/api/modules/post.ts +4 -4
  55. package/src/api/modules/progressbar.ts +7 -7
  56. package/src/api/modules/responder.ts +19 -19
  57. package/src/api/modules/session.ts +4 -4
  58. package/src/api/modules/startscreen.ts +4 -4
  59. package/src/api/modules/{stat.ts → statistic.ts} +117 -117
  60. package/src/api/modules/verifybar.ts +4 -4
  61. package/dist/api/modules/stat.d.ts +0 -176
@@ -182,12 +182,12 @@ export interface ODSharedFuseList {
182
182
  helpMenuCategoryLoading: boolean;
183
183
  /**Load the default Open Discord help menu components. */
184
184
  helpMenuComponentLoading: boolean;
185
- /**Load the default Open Discord stat scopes. */
186
- statScopesLoading: boolean;
187
- /**Load the default Open Discord stats. */
188
- statLoading: boolean;
189
- /**Initiate the default Open Discord stats. */
190
- statInitiating: boolean;
185
+ /**Load the default Open Discord statistic scopes. */
186
+ statisticScopesLoading: boolean;
187
+ /**Load the default Open Discord statistics. */
188
+ statisticLoading: boolean;
189
+ /**Initiate the default Open Discord statistics. */
190
+ statisticInitiating: boolean;
191
191
  /**Load the default Open Discord code/functions. */
192
192
  codeLoading: boolean;
193
193
  /**Execute the default Open Discord code/functions. */
@@ -106,9 +106,9 @@ class ODSharedFuseManager extends ODFuseManager {
106
106
  cooldownsInitiating: true,
107
107
  helpMenuCategoryLoading: true,
108
108
  helpMenuComponentLoading: true,
109
- statScopesLoading: true,
110
- statLoading: true,
111
- statInitiating: true,
109
+ statisticScopesLoading: true,
110
+ statisticLoading: true,
111
+ statisticInitiating: true,
112
112
  codeLoading: true,
113
113
  codeExecution: true,
114
114
  liveStatusLoading: true,
@@ -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
  /**## ODHelpMenuComponentRenderer `type`
4
4
  * This is the callback of the help menu component renderer. It also contains information about how & where it is rendered.
@@ -81,11 +81,11 @@ export declare class ODHelpMenuCategory<IdList extends ODHelpMenuCategoryIdConst
81
81
  constructor(id: ODValidId, priority: number, name: string, newPage?: boolean);
82
82
  /**Render this category and it's components. */
83
83
  render(page: number, category: number, mode: "slash" | "text"): Promise<string>;
84
- get<HelpMenuComponentId extends keyof IdList>(id: HelpMenuComponentId): IdList[HelpMenuComponentId];
84
+ get<HelpMenuComponentId extends keyof ODNoGeneric<IdList>>(id: HelpMenuComponentId): IdList[HelpMenuComponentId];
85
85
  get(id: ODValidId): ODHelpMenuComponent | null;
86
- remove<HelpMenuComponentId extends keyof IdList>(id: HelpMenuComponentId): IdList[HelpMenuComponentId];
86
+ remove<HelpMenuComponentId extends keyof ODNoGeneric<IdList>>(id: HelpMenuComponentId): IdList[HelpMenuComponentId];
87
87
  remove(id: ODValidId): ODHelpMenuComponent | null;
88
- exists(id: keyof IdList): boolean;
88
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
89
89
  exists(id: ODValidId): boolean;
90
90
  }
91
91
  /**## ODHelpMenuRenderResult `type`
@@ -117,10 +117,10 @@ export declare class ODHelpMenuManager<IdList extends ODHelpMenuManagerIdConstra
117
117
  add(data: ODHelpMenuCategory, overwrite?: boolean): boolean;
118
118
  /**Render this entire help menu & return a `ODHelpMenuRenderResult`. */
119
119
  render(mode: "slash" | "text"): Promise<ODHelpMenuRenderResult>;
120
- get<HelpMenuCategoryId extends keyof IdList>(id: HelpMenuCategoryId): IdList[HelpMenuCategoryId];
120
+ get<HelpMenuCategoryId extends keyof ODNoGeneric<IdList>>(id: HelpMenuCategoryId): IdList[HelpMenuCategoryId];
121
121
  get(id: ODValidId): ODHelpMenuCategory | null;
122
- remove<HelpMenuCategoryId extends keyof IdList>(id: HelpMenuCategoryId): IdList[HelpMenuCategoryId];
122
+ remove<HelpMenuCategoryId extends keyof ODNoGeneric<IdList>>(id: HelpMenuCategoryId): IdList[HelpMenuCategoryId];
123
123
  remove(id: ODValidId): ODHelpMenuCategory | null;
124
- exists(id: keyof IdList): boolean;
124
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
125
125
  exists(id: ODValidId): boolean;
126
126
  }
@@ -1,4 +1,4 @@
1
- import { ODManager, ODManagerData, ODPromiseVoid, ODValidId } from "./base";
1
+ import { ODManager, ODManagerData, ODNoGeneric, ODPromiseVoid, ODValidId } from "./base";
2
2
  import { ODDebugger } from "./console";
3
3
  /**## ODLanguageMetadata `interface`
4
4
  * This interface contains all metadata available in the language files.
@@ -35,12 +35,12 @@ export declare class ODLanguageManager<IdList extends ODLanguageManagerIdConstra
35
35
  backup: ODLanguage | null;
36
36
  constructor(debug: ODDebugger, presets: boolean);
37
37
  /**Set the current language by providing the ID of a language which is registered in this manager. */
38
- setCurrentLanguage(id: keyof IdList): void;
38
+ setCurrentLanguage(id: keyof ODNoGeneric<IdList>): void;
39
39
  setCurrentLanguage(id: ODValidId): void;
40
40
  /**Get the current language (same as `this.current`) */
41
41
  getCurrentLanguage(): ODLanguage | null;
42
42
  /**Set the backup language by providing the ID of a language which is registered in this manager. */
43
- setBackupLanguage(id: keyof IdList): void;
43
+ setBackupLanguage(id: keyof ODNoGeneric<IdList>): void;
44
44
  setBackupLanguage(id: ODValidId): void;
45
45
  /**Get the backup language (same as `this.backup`) */
46
46
  getBackupLanguage(): ODLanguage | null;
@@ -56,11 +56,11 @@ export declare class ODLanguageManager<IdList extends ODLanguageManagerIdConstra
56
56
  getTranslationWithParams(id: string, params: string[]): string | null;
57
57
  /**Init all language files. */
58
58
  init(): Promise<void>;
59
- get<LanguageId extends keyof IdList>(id: LanguageId): IdList[LanguageId];
59
+ get<LanguageId extends keyof ODNoGeneric<IdList>>(id: LanguageId): IdList[LanguageId];
60
60
  get(id: ODValidId): ODLanguage | null;
61
- remove<LanguageId extends keyof IdList>(id: LanguageId): IdList[LanguageId];
61
+ remove<LanguageId extends keyof ODNoGeneric<IdList>>(id: LanguageId): IdList[LanguageId];
62
62
  remove(id: ODValidId): ODLanguage | null;
63
- exists(id: keyof IdList): boolean;
63
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
64
64
  exists(id: ODValidId): boolean;
65
65
  }
66
66
  /**## ODLanguage `class`
@@ -1,4 +1,4 @@
1
- import { ODValidId, ODManager, ODManagerData } from "./base";
1
+ import { ODValidId, ODManager, ODManagerData, ODNoGeneric } from "./base";
2
2
  import * as discord from "discord.js";
3
3
  import { ODDebugger } from "./console";
4
4
  import { ODClientManager } from "./client";
@@ -122,10 +122,10 @@ export declare class ODPermissionManager<IdList extends ODPermissionManagerIdCon
122
122
  hasPermissions(minimum: ODPermissionType, data: ODPermissionResult): boolean;
123
123
  /**Check the permissions for a certain command of the bot. */
124
124
  checkCommandPerms(permissionMode: string, requiredLevel: ODPermissionType, user: discord.User, member?: discord.GuildMember | null, channel?: discord.Channel | null, guild?: discord.Guild | null, settings?: ODPermissionSettings): Promise<ODPermissionCommandResult>;
125
- get<PermissionId extends keyof IdList>(id: PermissionId): IdList[PermissionId];
125
+ get<PermissionId extends keyof ODNoGeneric<IdList>>(id: PermissionId): IdList[PermissionId];
126
126
  get(id: ODValidId): ODPermission | null;
127
- remove<PermissionId extends keyof IdList>(id: PermissionId): IdList[PermissionId];
127
+ remove<PermissionId extends keyof ODNoGeneric<IdList>>(id: PermissionId): IdList[PermissionId];
128
128
  remove(id: ODValidId): ODPermission | null;
129
- exists(id: keyof IdList): boolean;
129
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
130
130
  exists(id: ODValidId): boolean;
131
131
  }
@@ -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>(id: PluginId): IdList[PluginId];
33
+ get<PluginId extends keyof ODNoGeneric<IdList>>(id: PluginId): IdList[PluginId];
34
34
  get(id: ODValidId): ODPlugin | null;
35
- remove<PluginId extends keyof IdList>(id: PluginId): IdList[PluginId];
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>(id: PluginClassId): IdList[PluginClassId];
151
+ get<PluginClassId extends keyof ODNoGeneric<IdList>>(id: PluginClassId): IdList[PluginClassId];
152
152
  get(id: ODValidId): ODManagerData | null;
153
- remove<PluginClassId extends keyof IdList>(id: PluginClassId): IdList[PluginClassId];
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>(id: PostId): IdList[PostId];
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>(id: PostId): IdList[PostId];
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>(id: RendererId): IdList[RendererId];
16
+ get<RendererId extends keyof ODNoGeneric<IdList>>(id: RendererId): IdList[RendererId];
17
17
  get(id: ODValidId): ODProgressBarRenderer<{}> | null;
18
- remove<RendererId extends keyof IdList>(id: RendererId): IdList[RendererId];
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`
@@ -35,11 +35,11 @@ export declare class ODProgressBarManager<IdList extends ODProgressBarManagerIdC
35
35
  /**A collection of render types for progress bars. */
36
36
  renderers: ODProgressBarRendererManager<ODProgressBarRendererManagerIdConstraint>;
37
37
  constructor(debug: ODDebugger);
38
- get<ProgressBarId extends keyof IdList>(id: ProgressBarId): IdList[ProgressBarId];
38
+ get<ProgressBarId extends keyof ODNoGeneric<IdList>>(id: ProgressBarId): IdList[ProgressBarId];
39
39
  get(id: ODValidId): ODProgressBar | null;
40
- remove<ProgressBarId extends keyof IdList>(id: ProgressBarId): IdList[ProgressBarId];
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>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["source"], IdList[CommandResponderId]["params"], IdList[CommandResponderId]["workers"]>;
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>(id: CommandResponderId): ODCommandResponder<IdList[CommandResponderId]["source"], IdList[CommandResponderId]["params"], IdList[CommandResponderId]["workers"]>;
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>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["source"], IdList[ButtonResponderId]["params"], IdList[ButtonResponderId]["workers"]>;
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>(id: ButtonResponderId): ODButtonResponder<IdList[ButtonResponderId]["source"], IdList[ButtonResponderId]["params"], IdList[ButtonResponderId]["workers"]>;
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>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["source"], IdList[DropdownResponderId]["params"], IdList[DropdownResponderId]["workers"]>;
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>(id: DropdownResponderId): ODDropdownResponder<IdList[DropdownResponderId]["source"], IdList[DropdownResponderId]["params"], IdList[DropdownResponderId]["workers"]>;
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>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
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>(id: ModalResponderId): ODModalResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
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>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
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>(id: ModalResponderId): ODContextMenuResponder<IdList[ModalResponderId]["source"], IdList[ModalResponderId]["params"], IdList[ModalResponderId]["workers"]>;
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>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["source"], IdList[AutocompleteResponderId]["params"], IdList[AutocompleteResponderId]["workers"]>;
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>(id: AutocompleteResponderId): ODAutocompleteResponder<IdList[AutocompleteResponderId]["source"], IdList[AutocompleteResponderId]["params"], IdList[AutocompleteResponderId]["workers"]>;
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>(id: SessionId): IdList[SessionId];
17
+ get<SessionId extends keyof ODNoGeneric<IdList>>(id: SessionId): IdList[SessionId];
18
18
  get(id: ODValidId): ODSession | null;
19
- remove<SessionId extends keyof IdList>(id: SessionId): IdList[SessionId];
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>(id: StartScreenId): IdList[StartScreenId];
28
+ get<StartScreenId extends keyof ODNoGeneric<IdList>>(id: StartScreenId): IdList[StartScreenId];
29
29
  get(id: ODValidId): ODStartScreenComponent | null;
30
- remove<StartScreenId extends keyof IdList>(id: StartScreenId): IdList[StartScreenId];
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`
@@ -0,0 +1,176 @@
1
+ import { ODId, ODManager, ODManagerData, ODNoGeneric, ODValidId } from "./base";
2
+ import { ODDebugger } from "./console";
3
+ import { ODDatabase, ODDatabaseIdConstraint, ODJsonDatabaseStructure } from "./database";
4
+ import * as discord from "discord.js";
5
+ /**## ODValidStatisticValue `type`
6
+ * These are the only allowed types for a statistic value to improve compatibility with different database systems.
7
+ */
8
+ export type ODValidStatisticValue = string | number | boolean;
9
+ /**## ODStatisticManagerInitCallback `type`
10
+ * This callback can be used to execute something when the statistics have been initiated.
11
+ *
12
+ * By default this is used to clear statistics from users that left the server or tickets which don't exist anymore.
13
+ */
14
+ export type ODStatisticManagerInitCallback = (database: ODJsonDatabaseStructure, deletables: ODJsonDatabaseStructure) => void | Promise<void>;
15
+ /**## ODStatisticScopeSetMode `type`
16
+ * This type contains all valid methods for changing the value of a statistic.
17
+ */
18
+ export type ODStatisticScopeSetMode = "set" | "increase" | "decrease";
19
+ /**## ODStatisticManagerIdConstraint `type`
20
+ * The constraint/layout for id mappings/interfaces of the `ODStatisticManager` class.
21
+ */
22
+ export type ODStatisticManagerIdConstraint = Record<string, ODStatisticScope>;
23
+ /**## ODStatisticManager `class`
24
+ * This is an Open Discord statistics manager.
25
+ *
26
+ * This class is responsible for managing all statistics of the bot.
27
+ * Statistic are categorized in "scopes" which can be accessed in this manager.
28
+ *
29
+ * Statistic can be accessed in the individual scopes.
30
+ */
31
+ export declare class ODStatisticManager<IdList extends ODStatisticManagerIdConstraint = ODStatisticManagerIdConstraint> extends ODManager<ODStatisticScope> {
32
+ #private;
33
+ /**Alias to Open Discord statistics database. */
34
+ database: ODDatabase<ODDatabaseIdConstraint> | null;
35
+ constructor(debug: ODDebugger);
36
+ /**Select the database to use to read/write all statistics from/to. */
37
+ useDatabase(database: ODDatabase<ODDatabaseIdConstraint>): void;
38
+ add(data: ODStatisticScope, overwrite?: boolean): boolean;
39
+ /**Init all statistics and run `onInit()` listeners. */
40
+ init(): Promise<void>;
41
+ /**Reset all statistics. (clears the entire database) */
42
+ reset(): Promise<void>;
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
+ onInit(callback: ODStatisticManagerInitCallback): void;
45
+ get<ScopeId extends keyof ODNoGeneric<IdList>>(id: ScopeId): IdList[ScopeId];
46
+ get(id: ODValidId): ODStatisticScope | null;
47
+ remove<ScopeId extends keyof ODNoGeneric<IdList>>(id: ScopeId): IdList[ScopeId];
48
+ remove(id: ODValidId): ODStatisticScope | null;
49
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
50
+ exists(id: ODValidId): boolean;
51
+ }
52
+ /**## ODStatisticScopeIdConstraint `type`
53
+ * The constraint/layout for id mappings/interfaces of the `ODStatisticScope` class.
54
+ */
55
+ export type ODStatisticScopeIdConstraint = Record<string, ODStatistic>;
56
+ /**## ODStatisticScope `class`
57
+ * This is an Open Discord statistic scope.
58
+ *
59
+ * A scope can contain multiple statistics. Every scope is seperated from other scopes.
60
+ * Here, you can read & write the values of all statistics.
61
+ *
62
+ * The built-in Open Discord scopes are: `global`, `user`, `ticket`
63
+ */
64
+ export declare class ODStatisticScope<IdList extends ODStatisticScopeIdConstraint = ODStatisticScopeIdConstraint> extends ODManager<ODStatistic> {
65
+ /**The id of this statistics scope. */
66
+ id: ODId;
67
+ /**Is this scope already initialized? */
68
+ ready: boolean;
69
+ /**Alias to Open Discord statistics database. */
70
+ database: ODDatabase<ODDatabaseIdConstraint> | null;
71
+ /**The name of this scope (used in embed title) */
72
+ name: string;
73
+ constructor(id: ODValidId, name: string);
74
+ /**Select the database to use to read/write all statistics from/to. (Automatically assigned when used in `ODStatisticManager`) */
75
+ useDatabase(database: ODDatabase<ODDatabaseIdConstraint>): void;
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 ODNoGeneric<IdList>>(id: StatisticId, scopeId: string): Promise<ODValidStatisticValue | null>;
78
+ getStat(id: ODValidId, scopeId: string): Promise<ODValidStatisticValue | null>;
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 ODNoGeneric<IdList>>(id: StatisticId): Promise<{
81
+ id: string;
82
+ value: ODValidStatisticValue;
83
+ }[]>;
84
+ getAllStats(id: ODValidId): Promise<{
85
+ id: string;
86
+ value: ODValidStatisticValue;
87
+ }[]>;
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 ODNoGeneric<IdList>>(id: StatisticId, scopeId: string, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
90
+ setStat(id: ODValidId, scopeId: string, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
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 ODNoGeneric<IdList>>(id: ODValidId, scopeId: string): Promise<ODValidStatisticValue | null>;
93
+ resetStat(id: ODValidId, scopeId: string): Promise<ODValidStatisticValue | null>;
94
+ /**Initialize this statistic scope & return a list of all statistic ids in the following format: `<scopeid>_<statid>` */
95
+ init(): string[];
96
+ /**Render all statistics in this scope for usage in a discord message/embed. */
97
+ render(scopeId: string, guild: discord.Guild, channel: discord.TextBasedChannel, user: discord.User): Promise<string>;
98
+ get<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): IdList[StatisticId];
99
+ get(id: ODValidId): ODStatistic | null;
100
+ remove<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): IdList[StatisticId];
101
+ remove(id: ODValidId): ODStatistic | null;
102
+ exists(id: keyof ODNoGeneric<IdList>): boolean;
103
+ exists(id: ODValidId): boolean;
104
+ }
105
+ /**## ODStatisticGlobalScope `class`
106
+ * This is an Open Discord statistic global scope.
107
+ *
108
+ * A scope can contain multiple statistics. Every scope is seperated from other scopes.
109
+ * Here, you can read & write the values of all statistics.
110
+ *
111
+ * This scope is made specifically for the global statistics of Open Discord.
112
+ */
113
+ export declare class ODStatisticGlobalScope<IdList extends ODStatisticScopeIdConstraint = ODStatisticScopeIdConstraint> extends ODStatisticScope<IdList> {
114
+ getStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): Promise<ODValidStatisticValue | null>;
115
+ getStat(id: ODValidId): Promise<ODValidStatisticValue | null>;
116
+ getAllStats<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId): Promise<{
117
+ id: string;
118
+ value: ODValidStatisticValue;
119
+ }[]>;
120
+ getAllStats(id: ODValidId): Promise<{
121
+ id: string;
122
+ value: ODValidStatisticValue;
123
+ }[]>;
124
+ setStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: StatisticId, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
125
+ setStat(id: ODValidId, value: ODValidStatisticValue, mode: ODStatisticScopeSetMode): Promise<boolean>;
126
+ resetStat<StatisticId extends keyof ODNoGeneric<IdList>>(id: ODValidId): Promise<ODValidStatisticValue | null>;
127
+ resetStat(id: ODValidId): Promise<ODValidStatisticValue | null>;
128
+ render(scopeId: "GLOBAL", guild: discord.Guild, channel: discord.TextBasedChannel, user: discord.User): Promise<string>;
129
+ }
130
+ /**## ODStatisticRenderer `type`
131
+ * This callback will render a single statistic for a discord embed/message.
132
+ */
133
+ export type ODStatisticRenderer = (value: ODValidStatisticValue, scopeId: string, guild: discord.Guild, channel: discord.TextBasedChannel, user: discord.User) => string | Promise<string>;
134
+ /**## ODStatistic `class`
135
+ * This is an Open Discord statistic.
136
+ *
137
+ * This single statistic doesn't do anything except defining the rules of this statistic.
138
+ * Use it in a statistics scope to register a new statistic. A statistic can also include a priority to choose the render priority.
139
+ *
140
+ * It's recommended to use the `ODBaseStatistic` & `ODDynamicStatistic` classes instead of this one!
141
+ */
142
+ export declare class ODStatistic extends ODManagerData {
143
+ /**The priority of this statistic. */
144
+ priority: number;
145
+ /**The render function of this statistic. */
146
+ render: ODStatisticRenderer;
147
+ /**The value of this statistic. */
148
+ value: ODValidStatisticValue | null;
149
+ constructor(id: ODValidId, priority: number, render: ODStatisticRenderer, value?: ODValidStatisticValue);
150
+ }
151
+ /**## ODBaseStatistic `class`
152
+ * This is an Open Discord basic statistic.
153
+ *
154
+ * This single statistic will store a number, boolean or string in the database.
155
+ * Use it to create a simple statistic for any statistics scope.
156
+ */
157
+ export declare class ODBaseStatistic extends ODStatistic {
158
+ /**The name of this statistic. Rendered in discord embeds/messages. */
159
+ name: string;
160
+ constructor(id: ODValidId, priority: number, name: string, value: ODValidStatisticValue);
161
+ }
162
+ /**## ODDynamicStatisticRenderer `type`
163
+ * This callback will render a single dynamic statistic for a discord embed/message.
164
+ */
165
+ export type ODDynamicStatisticRenderer = (scopeId: string, guild: discord.Guild, channel: discord.TextBasedChannel, user: discord.User) => string | Promise<string>;
166
+ /**## ODDynamicStatistic `class`
167
+ * This is an Open Discord dynamic statistic.
168
+ *
169
+ * A dynamic statistic does not store anything in the database! Instead, it will execute a function to return a custom result.
170
+ * This can be used to show statistics which are not stored in the database.
171
+ *
172
+ * This is used in Open Discord for the live ticket status, participants & system status.
173
+ */
174
+ export declare class ODDynamicStatistic extends ODStatistic {
175
+ constructor(id: ODValidId, priority: number, render: ODDynamicStatisticRenderer);
176
+ }