@open-discord-bots/framework 0.0.1 → 0.0.2

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 (103) hide show
  1. package/LICENSE.md +713 -0
  2. package/README.md +104 -0
  3. package/dist/api/api.d.ts +26 -0
  4. package/dist/api/api.js +44 -0
  5. package/dist/api/main.d.ts +133 -0
  6. package/dist/api/main.js +87 -0
  7. package/dist/api/modules/action.d.ts +34 -0
  8. package/dist/api/modules/action.js +58 -0
  9. package/dist/api/modules/base.d.ts +329 -0
  10. package/dist/api/modules/base.js +804 -0
  11. package/dist/api/modules/builder.d.ts +647 -0
  12. package/dist/api/modules/builder.js +1441 -0
  13. package/dist/api/modules/checker.d.ts +648 -0
  14. package/dist/api/modules/checker.js +1324 -0
  15. package/dist/api/modules/client.d.ts +768 -0
  16. package/dist/api/modules/client.js +1859 -0
  17. package/dist/api/modules/code.d.ts +33 -0
  18. package/dist/api/modules/code.js +57 -0
  19. package/dist/api/modules/config.d.ts +70 -0
  20. package/dist/api/modules/config.js +206 -0
  21. package/dist/api/modules/console.d.ts +305 -0
  22. package/dist/api/modules/console.js +598 -0
  23. package/dist/api/modules/cooldown.d.ts +138 -0
  24. package/dist/api/modules/cooldown.js +359 -0
  25. package/dist/api/modules/database.d.ts +135 -0
  26. package/dist/api/modules/database.js +271 -0
  27. package/dist/api/modules/event.d.ts +43 -0
  28. package/dist/api/modules/event.js +100 -0
  29. package/dist/api/modules/flag.d.ts +40 -0
  30. package/dist/api/modules/flag.js +72 -0
  31. package/dist/api/modules/fuse.d.ts +218 -0
  32. package/dist/api/modules/fuse.js +123 -0
  33. package/dist/api/modules/helpmenu.d.ts +106 -0
  34. package/dist/api/modules/helpmenu.js +167 -0
  35. package/dist/api/modules/language.d.ts +85 -0
  36. package/dist/api/modules/language.js +195 -0
  37. package/dist/api/modules/permission.d.ts +121 -0
  38. package/dist/api/modules/permission.js +314 -0
  39. package/dist/api/modules/plugin.d.ts +128 -0
  40. package/dist/api/modules/plugin.js +168 -0
  41. package/dist/api/modules/post.d.ts +44 -0
  42. package/dist/api/modules/post.js +92 -0
  43. package/dist/api/modules/progressbar.d.ts +108 -0
  44. package/dist/api/modules/progressbar.js +233 -0
  45. package/dist/api/modules/responder.d.ts +506 -0
  46. package/dist/api/modules/responder.js +1468 -0
  47. package/dist/api/modules/session.d.ts +58 -0
  48. package/dist/api/modules/session.js +171 -0
  49. package/dist/api/modules/startscreen.d.ts +165 -0
  50. package/dist/api/modules/startscreen.js +293 -0
  51. package/dist/api/modules/stat.d.ts +142 -0
  52. package/dist/api/modules/stat.js +293 -0
  53. package/dist/api/modules/verifybar.d.ts +54 -0
  54. package/dist/api/modules/verifybar.js +60 -0
  55. package/dist/api/modules/worker.d.ts +41 -0
  56. package/dist/api/modules/worker.js +93 -0
  57. package/dist/api/utils.d.ts +61 -0
  58. package/dist/api/utils.js +254 -0
  59. package/dist/index.d.ts +4 -1
  60. package/dist/index.js +40 -0
  61. package/dist/startup/dump.d.ts +14 -0
  62. package/dist/startup/dump.js +79 -0
  63. package/dist/startup/errorHandling.d.ts +2 -0
  64. package/dist/startup/errorHandling.js +43 -0
  65. package/dist/startup/pluginLauncher.d.ts +2 -0
  66. package/dist/startup/pluginLauncher.js +202 -0
  67. package/package.json +9 -3
  68. package/src/api/api.ts +29 -0
  69. package/src/api/main.ts +189 -0
  70. package/src/api/modules/action.ts +58 -0
  71. package/src/api/modules/base.ts +811 -0
  72. package/src/api/modules/builder.ts +1554 -0
  73. package/src/api/modules/checker.ts +1549 -0
  74. package/src/api/modules/client.ts +2247 -0
  75. package/src/api/modules/code.ts +58 -0
  76. package/src/api/modules/config.ts +159 -0
  77. package/src/api/modules/console.ts +665 -0
  78. package/src/api/modules/cooldown.ts +348 -0
  79. package/src/api/modules/database.ts +278 -0
  80. package/src/api/modules/event.ts +99 -0
  81. package/src/api/modules/flag.ts +73 -0
  82. package/src/api/modules/fuse.ts +348 -0
  83. package/src/api/modules/helpmenu.ts +216 -0
  84. package/src/api/modules/language.ts +201 -0
  85. package/src/api/modules/permission.ts +340 -0
  86. package/src/api/modules/plugin.ts +242 -0
  87. package/src/api/modules/post.ts +90 -0
  88. package/src/api/modules/progressbar.ts +232 -0
  89. package/src/api/modules/responder.ts +1420 -0
  90. package/src/api/modules/session.ts +155 -0
  91. package/src/api/modules/startscreen.ts +320 -0
  92. package/src/api/modules/stat.ts +313 -0
  93. package/src/api/modules/verifybar.ts +61 -0
  94. package/src/api/modules/worker.ts +93 -0
  95. package/src/api/utils.ts +206 -0
  96. package/src/cli/cli.ts +151 -0
  97. package/src/cli/editConfig.ts +943 -0
  98. package/src/index.ts +6 -1
  99. package/src/startup/compilation.ts +186 -0
  100. package/src/startup/dump.ts +45 -0
  101. package/src/startup/errorHandling.ts +38 -0
  102. package/src/startup/pluginLauncher.ts +261 -0
  103. package/LICENSE +0 -21
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ <p align="center">
2
+ <img src="https://apis.dj-dj.be/cdn/opendiscord/logo.png" alt="Open Ticket" width="650px"><br>
3
+ <span align="center"><b>A modular framework for the next-generation of Discord bots</b></span><br><br>
4
+ <a href="https://otgithub.dj-dj.be"><img src="https://apis.dj-dj.be/cdn/openticket/logo.png" alt="Open Ticket" height="55px"></a>
5
+ <a href="https://otgithub.dj-dj.be"><img src="https://apis.dj-dj.be/cdn/openmoderation/logo.png" alt="Open Moderation" height="60px"></a><br><br>
6
+ <a href="https://discord.com/invite/26vT9wt3n3"><img alt="Discord Invite Link" src="https://img.shields.io/badge/discord-support%20server-5865F2.svg?style=flat-square&logo=discord"></img></a>
7
+ <a href="https://github.com/open-discord-bots/plugins/blob/main/LICENSE"><img alt="Open Discord Plugins License" src="https://img.shields.io/badge/license-MIT-important.svg?style=flat-square"></img></a>
8
+ <a href="https://discord.dj-dj.be"><img alt="Open Discord Plugins Stars" src="https://img.shields.io/github/stars/open-discord-bots/framework?color=yellow&label=stars&logo=github&style=flat-square"></img></a>
9
+ <a href="https://github.com/sponsors/DJj123dj"><img alt="Sponsor DJj123dj" src="https://img.shields.io/badge/sponsor-DJj123dj-ea4aaa?style=flat-square&logo=githubsponsors"></img></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ Open Discord is a modular plugin-driven framework built on top of discord.js that provides a structured foundation for building advanced Discord bots.
14
+ It powers <a href="https://otgithub.dj-dj.be"><b>Open Ticket</b></a> and <a href="https://omgithub.dj-dj.be/"><b>Open Moderation</b></a>, offering shared utilities, plugin support, translations, config/database and a scalable architecture for the most advanced open-source discord bots.<br><br>
15
+ <b>⚠️ Warning!</b><br>
16
+ We do currently <b>NOT</b> provide support <b>3rd party implementations</b> of the framework!<br>More information can be found in our <a href="https://discord.dj-dj.be">discord server</a>.
17
+ </p>
18
+
19
+ ### 📌 Primary Features
20
+ - **Shared Utilities** - Text/emoji formatting, client functions, modules, timing & promise handling.
21
+
22
+ - **Logs & Errors** - Advanced multi-color logging, debug file & error handling system.
23
+
24
+ - **Plugins** - Includes an advanced and modular plugin system for almost any scenario.
25
+
26
+ - **Debugging Tools** - Powerful debugging tools, dump commands, debug logs, tests & flags.
27
+
28
+ - **Client Layer** - A powerful layer between `discord.js` and the bot to simplify permissions, activity/status & privilleges.
29
+
30
+ - **Registration** - Register slash & text-based commands in one go! Registration is handled automatically.
31
+
32
+ - **Builders** - Advanced template-based message, embed, modal & component builders for extensible layouts.
33
+
34
+ - **Responders** - Respond to slash & text-based commands in one go with the same code!
35
+
36
+ - **Config** - Register JSON config files, use an advanced checker for validation or save/reload files in real-time.
37
+
38
+ - **Database** - Register JSON databases and use simple methods to access and write data.
39
+
40
+ - **Version Migration** - Migrate data between versions and apply changes before the main process starts.
41
+
42
+ - **Fuses** - Toggle fuses using plugins to disable built-in systems and replace them with 3rd party alternatives.
43
+
44
+ - **Languages** - A powerful system for translating sentences, managing language files & handling backup languages.
45
+
46
+ - **Permissions** - An easy to use system for managing bot permissions for users, roles & channels at the same time.
47
+
48
+ - **Stats** - Save, modify and keep track of statistics for users, channels, roles or custom entities.
49
+
50
+ - **Workers** - Many features use a worker-based system to allow extensible/overwritable code by plugins.
51
+
52
+ - **Console** - Interact with the console using a startscreen, progress bars & interactive menu's.
53
+
54
+ - **Large Ecosystem** - The same plugin is able to work in all projects using Open discord (e.g. Open Ticket / Moderation)
55
+
56
+ ## 🛠️ Contributors
57
+ ### 🖥️ Team & Contributors
58
+ A list of people that contributed or provided support for Open Ticket, Open Moderation & Open Discord.
59
+ <table>
60
+ <tr>
61
+ <td align="center"><img src="https://github.com/DJj123dj.png" alt="Profile Picture" width="80px"></td>
62
+ <td align="center"><img src="https://github.com/guillee3.png" alt="Profile Picture" width="80px"></td>
63
+ <td align="center"><img src="https://github.com/smetsliam.png" alt="Profile Picture" width="80px"></td>
64
+ <td align="center"><img src="https://github.com/FrankVissers.png" alt="Profile Picture" width="80px"></td>
65
+ <td align="center"><img src="https://github.com/Sank34.png" alt="Profile Picture" width="80px"></td>
66
+ </tr>
67
+ <tr>
68
+ <th><a href="https://github.com/DJj123dj">💻🧩💬 DJj123dj</a></th>
69
+ <th><a href="https://github.com/guillee3">🧩💬 Guillee3</a></th>
70
+ <th><a href="https://github.com/smetsliam">💬 smetsliam</a></th>
71
+ <th><a href="https://github.com/FrankVissers">💬 Frank Vissers</a></th>
72
+ <th><a href="https://github.com/Sank34">💬 Sanke</a></th>
73
+ </tr>
74
+ </table>
75
+
76
+ ### ❤️ Sponsors
77
+ A big thanks to all our sponsors! Without them, it wouldn't be possible to create this project!
78
+
79
+ <table>
80
+ <tr>
81
+ <td><img src="https://github.com/guillee3.png" alt="Profile Picture" width="100px"></td>
82
+ <td><img src="https://github.com/yeeetSK.png" alt="Profile Picture" width="100px"></td>
83
+ </tr>
84
+ <tr>
85
+ <td align="center"><a href="https://github.com/guillee3"><b>guillee3</b></a></td>
86
+ <td align="center"><a href="https://github.com/yeeetSK"><b>yeeetSK</b></a></td>
87
+ </tr>
88
+ </table>
89
+
90
+ **Past Sponsors:**<br>
91
+ <a href="https://github.com/sponsors/DJj123dj">
92
+ <img src="https://github.com/SpyEye2.png" alt="SpyEye" width="40px">
93
+ <img src="https://github.com/mods-hd.png" alt="Mods HD" width="40px">
94
+ <img src="https://github.com/DOSEV5.png" alt="DOSEV5" width="40px">
95
+ <img src="https://github.com/BENZORICH.png" alt="BENZORICH" width="40px">
96
+ </a>
97
+
98
+ ---
99
+ <img src="https://apis.dj-dj.be/cdn/opendiscord/logo.png" alt="Open Ticket Logo" width="170px">
100
+
101
+ **README.md**<br>
102
+ [Open Ticket](https://otgithub.dj-dj.be) - [Open Moderation](https://omgithub.dj-dj.be) - [Plugin Directory](https://odplugins.dj-dj.be) - [Support Server](https://discord.dj-dj.be) - [License](./LICENSE.md)<br>
103
+
104
+ © 2021 - 2026 - [DJdj Development](https://www.dj-dj.be) - [Terms](https://www.dj-dj.be/terms) - [Privacy Policy](https://www.dj-dj.be/privacy) - [Support Us](https://github.com/sponsors/DJj123dj)
@@ -0,0 +1,26 @@
1
+ export * from "./main";
2
+ export * from "./modules/base";
3
+ export * from "./modules/event";
4
+ export * from "./modules/config";
5
+ export * from "./modules/database";
6
+ export * from "./modules/language";
7
+ export * from "./modules/flag";
8
+ export * from "./modules/console";
9
+ export * from "./modules/fuse";
10
+ export * from "./modules/plugin";
11
+ export * from "./modules/checker";
12
+ export * from "./modules/client";
13
+ export * from "./modules/worker";
14
+ export * from "./modules/builder";
15
+ export * from "./modules/responder";
16
+ export * from "./modules/action";
17
+ export * from "./modules/permission";
18
+ export * from "./modules/helpmenu";
19
+ export * from "./modules/session";
20
+ export * from "./modules/stat";
21
+ export * from "./modules/code";
22
+ export * from "./modules/cooldown";
23
+ export * from "./modules/post";
24
+ export * from "./modules/verifybar";
25
+ export * from "./modules/progressbar";
26
+ export * from "./modules/startscreen";
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ //MAIN MODULE
18
+ __exportStar(require("./main"), exports);
19
+ //BASE MODULES
20
+ __exportStar(require("./modules/base"), exports);
21
+ __exportStar(require("./modules/event"), exports);
22
+ __exportStar(require("./modules/config"), exports);
23
+ __exportStar(require("./modules/database"), exports);
24
+ __exportStar(require("./modules/language"), exports);
25
+ __exportStar(require("./modules/flag"), exports);
26
+ __exportStar(require("./modules/console"), exports);
27
+ __exportStar(require("./modules/fuse"), exports);
28
+ __exportStar(require("./modules/plugin"), exports);
29
+ __exportStar(require("./modules/checker"), exports);
30
+ __exportStar(require("./modules/client"), exports);
31
+ __exportStar(require("./modules/worker"), exports);
32
+ __exportStar(require("./modules/builder"), exports);
33
+ __exportStar(require("./modules/responder"), exports);
34
+ __exportStar(require("./modules/action"), exports);
35
+ __exportStar(require("./modules/permission"), exports);
36
+ __exportStar(require("./modules/helpmenu"), exports);
37
+ __exportStar(require("./modules/session"), exports);
38
+ __exportStar(require("./modules/stat"), exports);
39
+ __exportStar(require("./modules/code"), exports);
40
+ __exportStar(require("./modules/cooldown"), exports);
41
+ __exportStar(require("./modules/post"), exports);
42
+ __exportStar(require("./modules/verifybar"), exports);
43
+ __exportStar(require("./modules/progressbar"), exports);
44
+ __exportStar(require("./modules/startscreen"), exports);
@@ -0,0 +1,133 @@
1
+ import { ODEnvHelper, ODProjectType, ODVersionManager } from "./modules/base";
2
+ import { ODConsoleManager, ODConsoleMessage, ODConsoleMessageParam, ODConsoleMessageTypes, ODDebugFileManager, ODDebugger, ODError, ODLiveStatusManager } from "./modules/console";
3
+ import { ODCheckerManager } from "./modules/checker";
4
+ import { ODEventManager } from "./modules/event";
5
+ import { ODPluginManager } from "./modules/plugin";
6
+ import { ODFlagManager } from "./modules/flag";
7
+ import { ODProgressBarManager } from "./modules/progressbar";
8
+ import { ODConfigManager } from "./modules/config";
9
+ import { ODDatabaseManager } from "./modules/database";
10
+ import { ODSessionManager } from "./modules/session";
11
+ import { ODLanguageManager } from "./modules/language";
12
+ import { ODBuilderManager } from "./modules/builder";
13
+ import { ODResponderManager } from "./modules/responder";
14
+ import { ODActionManager } from "./modules/action";
15
+ import { ODVerifyBarManager } from "./modules/verifybar";
16
+ import { ODPermissionManager } from "./modules/permission";
17
+ import { ODCooldownManager } from "./modules/cooldown";
18
+ import { ODHelpMenuManager } from "./modules/helpmenu";
19
+ import { ODStatsManager } from "./modules/stat";
20
+ import { ODCodeManager } from "./modules/code";
21
+ import { ODPostManager } from "./modules/post";
22
+ import { ODClientManager } from "./modules/client";
23
+ import { ODSharedFuseManager } from "./modules/fuse";
24
+ import { ODStartScreenManager } from "./modules/startscreen";
25
+ /**## ODMainManagers `interface`
26
+ * The global properties for the main class of the bot.
27
+ */
28
+ export interface ODMainManagers {
29
+ /**The manager that handles all versions in the bot. */
30
+ versions: ODVersionManager;
31
+ /**The timestamp that the (node.js) process of the bot started. */
32
+ processStartupDate: Date;
33
+ /**The timestamp that the bot finished loading and is ready for usage. */
34
+ readyStartupDate: Date | null;
35
+ /**The manager responsible for the debug file. (`...debug.txt`) */
36
+ debugfile: ODDebugFileManager;
37
+ /**The manager responsible for the console system. (logs, errors, etc) */
38
+ console: ODConsoleManager;
39
+ /**The manager responsible for sending debug logs to the debug file. (`...debug.txt`) */
40
+ debug: ODDebugger;
41
+ /**The manager containing all Open Discord events. */
42
+ events: ODEventManager;
43
+ /**The manager that handles & executes all plugins in the bot. */
44
+ plugins: ODPluginManager;
45
+ /**The manager that manages & checks all the console flags of the bot. (like `--debug`) */
46
+ flags: ODFlagManager;
47
+ /**The manager responsible for progress bars in the console. */
48
+ progressbars: ODProgressBarManager;
49
+ /**The manager that manages & contains all the config files of the bot. (like `config/general.json`) */
50
+ configs: ODConfigManager;
51
+ /**The manager that manages & contains all the databases of the bot. (like `database/global.json`) */
52
+ databases: ODDatabaseManager;
53
+ /**The manager that manages all the data sessions of the bot. (it's a temporary database) */
54
+ sessions: ODSessionManager;
55
+ /**The manager that manages all languages & translations of the bot. (but not for plugins) */
56
+ languages: ODLanguageManager;
57
+ /**The manager that handles & executes all config checkers in the bot. (the code that checks if you have something wrong in your config) */
58
+ checkers: ODCheckerManager;
59
+ /**The manager that manages all builders in the bot. (e.g. buttons, dropdowns, messages, modals, etc) */
60
+ builders: ODBuilderManager;
61
+ /**The manager that manages all responders in the bot. (e.g. commands, buttons, dropdowns, modals) */
62
+ responders: ODResponderManager;
63
+ /**The manager that manages all actions or procedures in the bot. (e.g. ticket-creation, ticket-deletion, ticket-claiming, etc) */
64
+ actions: ODActionManager;
65
+ /**The manager that manages all verify bars in the bot. (the ✅ ❌ buttons) */
66
+ verifybars: ODVerifyBarManager;
67
+ /**The manager that contains all permissions for commands & actions in the bot. (use it to check if someone has admin perms or not) */
68
+ permissions: ODPermissionManager;
69
+ /**The manager that contains all cooldowns of the bot. (e.g. ticket-cooldowns) */
70
+ cooldowns: ODCooldownManager;
71
+ /**The manager that manages & renders the Open Discord help menu. (not the embed, but the text) */
72
+ helpmenu: ODHelpMenuManager;
73
+ /**The manager that manages, saves & renders the Open Discord statistics. (not the embed, but the text & database) */
74
+ stats: ODStatsManager;
75
+ /**This manager is a place where you can put code that executes when the bot almost finishes the setup. (can be used for less important stuff that doesn't require an exact time-order) */
76
+ code: ODCodeManager;
77
+ /**The manager that manages all posts (static discord channels) in the bot. (e.g. transcripts, logs, etc) */
78
+ posts: ODPostManager;
79
+ /**The manager responsible for everything related to the client. (e.g. status, login, slash & text commands, etc) */
80
+ client: ODClientManager;
81
+ /**Shared fuses between Open Discord bots. With these fuses/switches, you can turn off "default behaviours" from the bot. Useful for replacing default behaviour with a custom implementation. */
82
+ sharedFuses: ODSharedFuseManager;
83
+ /**This manager manages all the variables in the ENV. It reads from both the `.env` file & the `process.env`. (these 2 will be combined) */
84
+ env: ODEnvHelper;
85
+ /**The manager responsible for the livestatus system. (remote console logs) */
86
+ livestatus: ODLiveStatusManager;
87
+ /**The manager responsible for the livestatus system. (remote console logs) */
88
+ startscreen: ODStartScreenManager;
89
+ }
90
+ /**## ODMain `class`
91
+ * This is the main Open Discord class.
92
+ * It contains all managers from the entire bot & has shortcuts to the event & logging system.
93
+ *
94
+ * This class can't be overwritten or extended & is available as the global variable `opendiscord`!
95
+ */
96
+ export declare class ODMain implements ODMainManagers {
97
+ readonly project: ODProjectType;
98
+ readonly versions: ODVersionManager;
99
+ readonly processStartupDate: Date;
100
+ readyStartupDate: Date | null;
101
+ readonly debugfile: ODDebugFileManager;
102
+ readonly console: ODConsoleManager;
103
+ readonly debug: ODDebugger;
104
+ readonly events: ODEventManager;
105
+ readonly plugins: ODPluginManager;
106
+ readonly flags: ODFlagManager;
107
+ readonly progressbars: ODProgressBarManager;
108
+ readonly configs: ODConfigManager;
109
+ readonly databases: ODDatabaseManager;
110
+ readonly sessions: ODSessionManager;
111
+ readonly languages: ODLanguageManager;
112
+ readonly checkers: ODCheckerManager;
113
+ readonly builders: ODBuilderManager;
114
+ readonly responders: ODResponderManager;
115
+ readonly actions: ODActionManager;
116
+ readonly verifybars: ODVerifyBarManager;
117
+ readonly permissions: ODPermissionManager;
118
+ readonly cooldowns: ODCooldownManager;
119
+ readonly helpmenu: ODHelpMenuManager;
120
+ readonly stats: ODStatsManager;
121
+ readonly code: ODCodeManager;
122
+ readonly posts: ODPostManager;
123
+ readonly client: ODClientManager;
124
+ readonly sharedFuses: ODSharedFuseManager;
125
+ readonly env: ODEnvHelper;
126
+ readonly livestatus: ODLiveStatusManager;
127
+ readonly startscreen: ODStartScreenManager;
128
+ constructor(managers: ODMainManagers, project: ODProjectType);
129
+ /**Log a message to the console. But in the Open Discord style :) */
130
+ log(message: ODConsoleMessage): void;
131
+ log(message: ODError): void;
132
+ log(message: string, type?: ODConsoleMessageTypes, params?: ODConsoleMessageParam[]): void;
133
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ODMain = void 0;
4
+ //BASE MODULES
5
+ const base_1 = require("./modules/base");
6
+ const console_1 = require("./modules/console");
7
+ /**## ODMain `class`
8
+ * This is the main Open Discord class.
9
+ * It contains all managers from the entire bot & has shortcuts to the event & logging system.
10
+ *
11
+ * This class can't be overwritten or extended & is available as the global variable `opendiscord`!
12
+ */
13
+ class ODMain {
14
+ project;
15
+ versions;
16
+ processStartupDate = new Date();
17
+ readyStartupDate = null;
18
+ debugfile;
19
+ console;
20
+ debug;
21
+ events;
22
+ plugins;
23
+ flags;
24
+ progressbars;
25
+ configs;
26
+ databases;
27
+ sessions;
28
+ languages;
29
+ checkers;
30
+ builders;
31
+ responders;
32
+ actions;
33
+ verifybars;
34
+ permissions;
35
+ cooldowns;
36
+ helpmenu;
37
+ stats;
38
+ code;
39
+ posts;
40
+ client;
41
+ sharedFuses;
42
+ env;
43
+ livestatus;
44
+ startscreen;
45
+ constructor(managers, project) {
46
+ this.project = project;
47
+ this.versions = managers.versions;
48
+ this.versions.add(base_1.ODVersion.fromString("opendiscord:api", "v1.0.0"));
49
+ this.versions.add(base_1.ODVersion.fromString("opendiscord:livestatus", "v2.0.0"));
50
+ this.debugfile = managers.debugfile;
51
+ this.console = managers.console;
52
+ this.debug = managers.debug;
53
+ this.events = managers.events;
54
+ this.plugins = managers.plugins;
55
+ this.flags = managers.flags;
56
+ this.progressbars = managers.progressbars;
57
+ this.configs = managers.configs;
58
+ this.databases = managers.databases;
59
+ this.sessions = managers.sessions;
60
+ this.languages = managers.languages;
61
+ this.checkers = managers.checkers;
62
+ this.builders = managers.builders;
63
+ this.client = managers.client;
64
+ this.responders = managers.responders;
65
+ this.actions = managers.actions;
66
+ this.verifybars = managers.verifybars;
67
+ this.permissions = managers.permissions;
68
+ this.cooldowns = managers.cooldowns;
69
+ this.helpmenu = managers.helpmenu;
70
+ this.stats = managers.stats;
71
+ this.code = managers.code;
72
+ this.posts = managers.posts;
73
+ this.sharedFuses = managers.sharedFuses;
74
+ this.env = managers.env;
75
+ this.livestatus = managers.livestatus;
76
+ this.startscreen = managers.startscreen;
77
+ }
78
+ log(message, type, params) {
79
+ if (message instanceof console_1.ODConsoleMessage)
80
+ this.console.log(message);
81
+ else if (message instanceof console_1.ODError)
82
+ this.console.log(message);
83
+ else if (["string", "number", "boolean", "object"].includes(typeof message))
84
+ this.console.log(message, type, params);
85
+ }
86
+ }
87
+ exports.ODMain = ODMain;
@@ -0,0 +1,34 @@
1
+ import { ODManager, ODValidId, ODManagerData } from "./base";
2
+ import { ODWorkerManager, ODWorkerCallback } from "./worker";
3
+ import { ODDebugger } from "./console";
4
+ /**## ODActionImplementation `class`
5
+ * This is an Open Discord action implementation.
6
+ *
7
+ * It is a basic implementation of the `ODWorkerManager` used by all `ODAction` classes.
8
+ *
9
+ * This class can't be used stand-alone & needs to be extended from!
10
+ */
11
+ export declare class ODActionImplementation<Source extends string, Params extends object, Result extends object> extends ODManagerData {
12
+ /**The manager that has all workers of this implementation */
13
+ workers: ODWorkerManager<object, Source, Params>;
14
+ constructor(id: ODValidId, callback?: ODWorkerCallback<object, Source, Params>, priority?: number, callbackId?: ODValidId);
15
+ /**Execute all workers & return the result. */
16
+ run(source: Source, params: Params): Promise<Partial<Result>>;
17
+ }
18
+ /**## ODActionManager `class`
19
+ * This is an Open Discord action manager.
20
+ *
21
+ * It contains all Open Discord actions. You can compare actions with some sort of "procedure".
22
+ * It's a complicated task that is divided into multiple functions.
23
+ *
24
+ * Some examples are `ticket-creation`, `ticket-closing`, `ticket-claiming`, ...
25
+ *
26
+ * It's recommended to use this system in combination with Open Discord responders!
27
+ */
28
+ export declare class ODActionManager extends ODManager<ODAction<string, {}, {}>> {
29
+ constructor(debug: ODDebugger);
30
+ }
31
+ export declare class ODAction<Source extends string, Params extends object, Result extends object> extends ODActionImplementation<Source, Params, Result> {
32
+ /**Run this action */
33
+ run(source: Source, params: Params): Promise<Partial<Result>>;
34
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ODAction = exports.ODActionManager = exports.ODActionImplementation = void 0;
4
+ ///////////////////////////////////////
5
+ //ACTION MODULE
6
+ ///////////////////////////////////////
7
+ const base_1 = require("./base");
8
+ const worker_1 = require("./worker");
9
+ /**## ODActionImplementation `class`
10
+ * This is an Open Discord action implementation.
11
+ *
12
+ * It is a basic implementation of the `ODWorkerManager` used by all `ODAction` classes.
13
+ *
14
+ * This class can't be used stand-alone & needs to be extended from!
15
+ */
16
+ class ODActionImplementation extends base_1.ODManagerData {
17
+ /**The manager that has all workers of this implementation */
18
+ workers;
19
+ constructor(id, callback, priority, callbackId) {
20
+ super(id);
21
+ this.workers = new worker_1.ODWorkerManager("descending");
22
+ if (callback)
23
+ this.workers.add(new worker_1.ODWorker(callbackId ? callbackId : id, priority ?? 0, callback));
24
+ }
25
+ /**Execute all workers & return the result. */
26
+ async run(source, params) {
27
+ throw new base_1.ODSystemError("Tried to build an unimplemented ODResponderImplementation");
28
+ }
29
+ }
30
+ exports.ODActionImplementation = ODActionImplementation;
31
+ /**## ODActionManager `class`
32
+ * This is an Open Discord action manager.
33
+ *
34
+ * It contains all Open Discord actions. You can compare actions with some sort of "procedure".
35
+ * It's a complicated task that is divided into multiple functions.
36
+ *
37
+ * Some examples are `ticket-creation`, `ticket-closing`, `ticket-claiming`, ...
38
+ *
39
+ * It's recommended to use this system in combination with Open Discord responders!
40
+ */
41
+ class ODActionManager extends base_1.ODManager {
42
+ constructor(debug) {
43
+ super(debug, "action");
44
+ }
45
+ }
46
+ exports.ODActionManager = ODActionManager;
47
+ class ODAction extends ODActionImplementation {
48
+ /**Run this action */
49
+ async run(source, params) {
50
+ //create instance
51
+ const instance = {};
52
+ //wait for workers to finish
53
+ await this.workers.executeWorkers(instance, source, params);
54
+ //return data generated by workers
55
+ return instance;
56
+ }
57
+ }
58
+ exports.ODAction = ODAction;