omegga 0.1.85 → 1.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.
- package/README.md +142 -62
- package/bin/omegga +10 -4
- package/dist/brickadia/config.d.ts +3 -0
- package/dist/brickadia/config.d.ts.map +1 -0
- package/dist/brickadia/config.js +61 -0
- package/dist/brickadia/config.js.map +1 -0
- package/dist/brickadia/presets.d.ts +65 -0
- package/dist/brickadia/presets.js +3 -0
- package/dist/brickadia/presets.js.map +1 -0
- package/dist/brickadia/server.d.ts +20 -0
- package/dist/brickadia/server.d.ts.map +1 -0
- package/dist/brickadia/server.js +188 -0
- package/dist/brickadia/server.js.map +1 -0
- package/dist/brickadia/types.d.ts +45 -0
- package/dist/brickadia/types.d.ts.map +1 -0
- package/dist/brickadia/types.js +3 -0
- package/dist/brickadia/types.js.map +1 -0
- package/dist/cli/auth.d.ts +20 -0
- package/dist/cli/auth.d.ts.map +1 -0
- package/dist/cli/auth.js +115 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/config.d.ts +10 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +72 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.d.ts +20 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/installer.d.ts +1 -0
- package/dist/cli/installer.d.ts.map +1 -0
- package/dist/cli/installer.js +55 -0
- package/dist/cli/installer.js.map +1 -0
- package/dist/cli/plugin.d.ts +11 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +598 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/terminal.d.ts +34 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +395 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/config/authorizer.d.ts +2 -0
- package/dist/config/authorizer.d.ts.map +1 -0
- package/dist/config/authorizer.js +38 -0
- package/dist/config/authorizer.js.map +1 -0
- package/dist/config/formats/format_js.d.ts +3 -0
- package/dist/config/formats/format_js.d.ts.map +1 -0
- package/dist/config/formats/format_js.js +10 -0
- package/dist/config/formats/format_js.js.map +1 -0
- package/dist/config/formats/format_yml.d.ts +3 -0
- package/dist/config/formats/format_yml.d.ts.map +1 -0
- package/dist/config/formats/format_yml.js +14 -0
- package/dist/config/formats/format_yml.js.map +1 -0
- package/dist/config/index.d.ts +18 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +86 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/reader.d.ts +3 -0
- package/dist/config/reader.d.ts.map +1 -0
- package/dist/config/reader.js +30 -0
- package/dist/config/reader.js.map +1 -0
- package/dist/config/types.d.ts +37 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/validator.d.ts +6 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +26 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/config/writer.d.ts +3 -0
- package/dist/config/writer.d.ts.map +1 -0
- package/dist/config/writer.js +25 -0
- package/dist/config/writer.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/info/default_commands.json +28 -0
- package/dist/lib.d.ts +21 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +54 -0
- package/dist/lib.js.map +1 -0
- package/dist/logger.d.ts +41 -0
- package/dist/logger.js +67 -0
- package/dist/logger.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +284 -0
- package/dist/main.js.map +1 -0
- package/dist/omegga/auth.d.ts +6 -0
- package/dist/omegga/auth.d.ts.map +1 -0
- package/dist/omegga/auth.js +139 -0
- package/dist/omegga/auth.js.map +1 -0
- package/dist/omegga/commandInjector.d.ts +35 -0
- package/dist/omegga/commandInjector.d.ts.map +1 -0
- package/dist/omegga/commandInjector.js +234 -0
- package/dist/omegga/commandInjector.js.map +1 -0
- package/dist/omegga/index.d.ts +7 -0
- package/dist/omegga/index.d.ts.map +1 -0
- package/dist/omegga/index.js +43 -0
- package/dist/omegga/index.js.map +1 -0
- package/dist/omegga/logWrangler.d.ts +32 -0
- package/dist/omegga/logWrangler.d.ts.map +1 -0
- package/dist/omegga/logWrangler.js +279 -0
- package/dist/omegga/logWrangler.js.map +1 -0
- package/dist/omegga/matchers/auth.d.ts +9 -0
- package/dist/omegga/matchers/auth.d.ts.map +1 -0
- package/dist/omegga/matchers/auth.js +53 -0
- package/dist/omegga/matchers/auth.js.map +1 -0
- package/dist/omegga/matchers/chat.d.ts +9 -0
- package/dist/omegga/matchers/chat.d.ts.map +1 -0
- package/dist/omegga/matchers/chat.js +68 -0
- package/dist/omegga/matchers/chat.js.map +1 -0
- package/dist/omegga/matchers/command.d.ts +7 -0
- package/dist/omegga/matchers/command.d.ts.map +1 -0
- package/dist/omegga/matchers/command.js +39 -0
- package/dist/omegga/matchers/command.js.map +1 -0
- package/dist/omegga/matchers/exit.d.ts +3 -0
- package/dist/omegga/matchers/exit.d.ts.map +1 -0
- package/dist/omegga/matchers/exit.js +21 -0
- package/dist/omegga/matchers/exit.js.map +1 -0
- package/dist/omegga/matchers/index.d.ts +3 -0
- package/dist/omegga/matchers/index.d.ts.map +1 -0
- package/dist/omegga/matchers/index.js +39 -0
- package/dist/omegga/matchers/index.js.map +1 -0
- package/dist/omegga/matchers/init.d.ts +3 -0
- package/dist/omegga/matchers/init.d.ts.map +1 -0
- package/dist/omegga/matchers/init.js +26 -0
- package/dist/omegga/matchers/init.js.map +1 -0
- package/dist/omegga/matchers/interact.d.ts +4 -0
- package/dist/omegga/matchers/interact.js +39 -0
- package/dist/omegga/matchers/interact.js.map +1 -0
- package/dist/omegga/matchers/join.d.ts +4 -0
- package/dist/omegga/matchers/join.d.ts.map +1 -0
- package/dist/omegga/matchers/join.js +95 -0
- package/dist/omegga/matchers/join.js.map +1 -0
- package/dist/omegga/matchers/leave.d.ts +4 -0
- package/dist/omegga/matchers/leave.d.ts.map +1 -0
- package/dist/omegga/matchers/leave.js +59 -0
- package/dist/omegga/matchers/leave.js.map +1 -0
- package/dist/omegga/matchers/mapChange.d.ts +3 -0
- package/dist/omegga/matchers/mapChange.d.ts.map +1 -0
- package/dist/omegga/matchers/mapChange.js +38 -0
- package/dist/omegga/matchers/mapChange.js.map +1 -0
- package/dist/omegga/matchers/types.d.ts +5 -0
- package/dist/omegga/matchers/types.d.ts.map +1 -0
- package/dist/omegga/matchers/types.js +7 -0
- package/dist/omegga/matchers/types.js.map +1 -0
- package/dist/omegga/matchers/version.d.ts +3 -0
- package/dist/omegga/matchers/version.d.ts.map +1 -0
- package/dist/omegga/matchers/version.js +45 -0
- package/dist/omegga/matchers/version.js.map +1 -0
- package/dist/omegga/player.d.ts +71 -0
- package/dist/omegga/player.d.ts.map +1 -0
- package/dist/omegga/player.js +442 -0
- package/dist/omegga/player.js.map +1 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts +23 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js +441 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +129 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js +260 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.d.ts +1 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.js +289 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe.d.ts +24 -0
- package/dist/omegga/plugin/plugin_node_safe.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe.js +397 -0
- package/dist/omegga/plugin/plugin_node_safe.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_unsafe.d.ts +13 -0
- package/dist/omegga/plugin/plugin_node_unsafe.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_unsafe.js +178 -0
- package/dist/omegga/plugin/plugin_node_unsafe.js.map +1 -0
- package/dist/omegga/plugin.d.ts +86 -0
- package/dist/omegga/plugin.d.ts.map +1 -0
- package/dist/omegga/plugin.js +458 -0
- package/dist/omegga/plugin.js.map +1 -0
- package/dist/omegga/server.d.ts +149 -0
- package/dist/omegga/server.d.ts.map +1 -0
- package/dist/omegga/server.js +601 -0
- package/dist/omegga/server.js.map +1 -0
- package/dist/omegga/types.d.ts +48 -0
- package/dist/omegga/types.d.ts.map +1 -0
- package/dist/omegga/types.js +3 -0
- package/dist/omegga/types.js.map +1 -0
- package/dist/omegga/wrapper.d.ts +22 -0
- package/dist/omegga/wrapper.d.ts.map +1 -0
- package/dist/omegga/wrapper.js +75 -0
- package/dist/omegga/wrapper.js.map +1 -0
- package/dist/omeggaplugin.d.ts +1 -0
- package/dist/omeggaplugin.js +4 -0
- package/dist/omeggaplugin.js.map +1 -0
- package/dist/plugin.d.ts +781 -0
- package/dist/plugin.js +41 -0
- package/dist/plugin.js.map +1 -0
- package/dist/softconfig.d.ts +51 -0
- package/dist/softconfig.d.ts.map +1 -0
- package/dist/softconfig.js +82 -0
- package/dist/softconfig.js.map +1 -0
- package/dist/util/brick/checkBounds.d.ts +8 -0
- package/dist/util/brick/checkBounds.d.ts.map +1 -0
- package/dist/util/brick/checkBounds.js +22 -0
- package/dist/util/brick/checkBounds.js.map +1 -0
- package/dist/util/brick/constants.d.ts +18 -0
- package/dist/util/brick/constants.d.ts.map +1 -0
- package/dist/util/brick/constants.js +184 -0
- package/dist/util/brick/constants.js.map +1 -0
- package/dist/util/brick/getBounds.d.ts +4 -0
- package/dist/util/brick/getBounds.d.ts.map +1 -0
- package/dist/util/brick/getBounds.js +39 -0
- package/dist/util/brick/getBounds.js.map +1 -0
- package/dist/util/brick/getBrickSize.d.ts +3 -0
- package/dist/util/brick/getBrickSize.d.ts.map +1 -0
- package/dist/util/brick/getBrickSize.js +12 -0
- package/dist/util/brick/getBrickSize.js.map +1 -0
- package/dist/util/brick/getScaleAxis.d.ts +3 -0
- package/dist/util/brick/getScaleAxis.d.ts.map +1 -0
- package/dist/util/brick/getScaleAxis.js +38 -0
- package/dist/util/brick/getScaleAxis.js.map +1 -0
- package/dist/util/brick/index.d.ts +13 -0
- package/dist/util/brick/index.d.ts.map +1 -0
- package/dist/util/brick/index.js +29 -0
- package/dist/util/brick/index.js.map +1 -0
- package/dist/util/brick/rotate.d.ts +17 -0
- package/dist/util/brick/rotate.d.ts.map +1 -0
- package/dist/util/brick/rotate.js +38 -0
- package/dist/util/brick/rotate.js.map +1 -0
- package/dist/util/brick/setOwnership.d.ts +12 -0
- package/dist/util/brick/setOwnership.d.ts.map +1 -0
- package/dist/util/brick/setOwnership.js +21 -0
- package/dist/util/brick/setOwnership.js.map +1 -0
- package/dist/util/chat.d.ts +23 -0
- package/dist/util/chat.d.ts.map +1 -0
- package/dist/util/chat.js +50 -0
- package/dist/util/chat.js.map +1 -0
- package/dist/util/color.d.ts +13 -0
- package/dist/util/color.d.ts.map +1 -0
- package/dist/util/color.js +130 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/file.d.ts +5 -0
- package/dist/util/file.d.ts.map +1 -0
- package/dist/util/file.js +114 -0
- package/dist/util/file.js.map +1 -0
- package/dist/util/index.d.ts +162 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +92 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/map.d.ts +6 -0
- package/dist/util/map.d.ts.map +1 -0
- package/dist/util/map.js +26 -0
- package/dist/util/map.js.map +1 -0
- package/dist/util/pattern.d.ts +1 -0
- package/dist/util/pattern.d.ts.map +1 -0
- package/dist/util/pattern.js +11 -0
- package/dist/util/pattern.js.map +1 -0
- package/dist/util/time.d.ts +4 -0
- package/dist/util/time.d.ts.map +1 -0
- package/dist/util/time.js +41 -0
- package/dist/util/time.js.map +1 -0
- package/dist/util/uuid.d.ts +2 -0
- package/dist/util/uuid.d.ts.map +1 -0
- package/dist/util/uuid.js +8 -0
- package/dist/util/uuid.js.map +1 -0
- package/dist/util/wsl.d.ts +1 -0
- package/dist/util/wsl.d.ts.map +1 -0
- package/dist/util/wsl.js +14 -0
- package/dist/util/wsl.js.map +1 -0
- package/dist/webserver/backend/api.d.ts +3 -0
- package/dist/webserver/backend/api.d.ts.map +1 -0
- package/dist/webserver/backend/api.js +685 -0
- package/dist/webserver/backend/api.js.map +1 -0
- package/dist/webserver/backend/calendar.d.ts +5 -0
- package/dist/webserver/backend/calendar.d.ts.map +1 -0
- package/dist/webserver/backend/calendar.js +21 -0
- package/dist/webserver/backend/calendar.js.map +1 -0
- package/dist/webserver/backend/database.d.ts +149 -0
- package/dist/webserver/backend/database.d.ts.map +1 -0
- package/dist/webserver/backend/database.js +575 -0
- package/dist/webserver/backend/database.js.map +1 -0
- package/dist/webserver/backend/index.d.ts +31 -0
- package/dist/webserver/backend/index.d.ts.map +1 -0
- package/dist/webserver/backend/index.js +189 -0
- package/dist/webserver/backend/index.js.map +1 -0
- package/dist/webserver/backend/metrics.d.ts +3 -0
- package/dist/webserver/backend/metrics.d.ts.map +1 -0
- package/dist/webserver/backend/metrics.js +203 -0
- package/dist/webserver/backend/metrics.js.map +1 -0
- package/dist/webserver/backend/types.d.ts +115 -0
- package/dist/webserver/backend/types.d.ts.map +1 -0
- package/dist/webserver/backend/types.js +3 -0
- package/dist/webserver/backend/types.js.map +1 -0
- package/dist/webserver/backend/util.d.ts +2 -0
- package/dist/webserver/backend/util.d.ts.map +1 -0
- package/dist/webserver/backend/util.js +78 -0
- package/dist/webserver/backend/util.js.map +1 -0
- package/dist/webserver/index.d.ts +2 -0
- package/dist/webserver/index.d.ts.map +1 -0
- package/dist/webserver/index.js +9 -0
- package/dist/webserver/index.js.map +1 -0
- package/{src/webserver/frontend → frontend}/app.html +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceBold.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceItalic.otf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceMedium.otf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceRegular.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/RobotoBold.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/RobotoItalic.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/RobotoRegular.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/img/auth_bg.webp +0 -0
- package/{src/webserver/frontend → frontend}/assets/img/dark_bg.webp +0 -0
- package/{src/webserver/frontend → frontend}/assets/img/turkey.webp +0 -0
- package/{src/webserver/frontend → frontend}/auth.html +0 -0
- package/index.js +10 -2
- package/package.json +44 -16
- package/public/app.bundle.js +537 -73
- package/public/app.bundle.js.map +1 -1
- package/public/app.css +727 -2
- package/public/app.css.map +1 -1
- package/public/auth.bundle.js +18 -18
- package/public/auth.bundle.js.map +1 -1
- package/public/auth.css +364 -2
- package/public/auth.css.map +1 -1
- package/templates/rpc/README.md +29 -0
- package/templates/rpc/doc.json +7 -0
- package/templates/rpc/omegga_plugin +0 -0
- package/templates/rpc/plugin.json +4 -0
- package/templates/rpc/setup.sh +3 -0
- package/templates/safe/README.md +29 -0
- package/templates/safe/access.json +1 -0
- package/templates/safe/doc.json +7 -0
- package/templates/safe/omegga.plugin.js +20 -0
- package/templates/safe/plugin.json +4 -0
- package/templates/safe/setup.sh +4 -0
- package/templates/safe-ts/.gitignore.rename +3 -0
- package/templates/safe-ts/README.md +29 -0
- package/templates/safe-ts/access.json +1 -0
- package/templates/safe-ts/doc.json +7 -0
- package/templates/safe-ts/omegga.d.ts +1311 -0
- package/templates/safe-ts/omegga.plugin.ts +29 -0
- package/templates/safe-ts/plugin.json +4 -0
- package/templates/safe-ts/setup.sh +4 -0
- package/templates/safe-ts/tsconfig.json +10 -0
- package/templates/unsafe/README.md +29 -0
- package/templates/unsafe/doc.json +7 -0
- package/templates/unsafe/omegga.main.js +15 -0
- package/templates/unsafe/plugin.json +4 -0
- package/templates/unsafe/setup.sh +4 -0
- package/.babelrc.json +0 -5
- package/.github/workflows/lint.yml +0 -26
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -5
- package/src/OMEGGA_LEGACY_INSTALL +0 -44
- package/src/brickadia/config.js +0 -42
- package/src/brickadia/server.js +0 -227
- package/src/cli/auth.js +0 -104
- package/src/cli/config.js +0 -77
- package/src/cli/index.js +0 -6
- package/src/cli/installer.js +0 -65
- package/src/cli/plugin.js +0 -575
- package/src/cli/terminal.js +0 -466
- package/src/config/authorizer.js +0 -37
- package/src/config/formats/format_js.js +0 -6
- package/src/config/formats/format_yml.js +0 -8
- package/src/config/index.js +0 -81
- package/src/config/reader.js +0 -27
- package/src/config/validator.js +0 -32
- package/src/config/writer.js +0 -20
- package/src/info/default_commands.json +0 -26
- package/src/lib.js +0 -23
- package/src/main.js +0 -332
- package/src/omegga/auth.js +0 -138
- package/src/omegga/commandInjector.js +0 -228
- package/src/omegga/index.js +0 -22
- package/src/omegga/logWrangler.js +0 -323
- package/src/omegga/matchers/auth.js +0 -49
- package/src/omegga/matchers/chat.js +0 -73
- package/src/omegga/matchers/command.js +0 -39
- package/src/omegga/matchers/exit.js +0 -19
- package/src/omegga/matchers/init.js +0 -23
- package/src/omegga/matchers/join.js +0 -115
- package/src/omegga/matchers/leave.js +0 -58
- package/src/omegga/matchers/mapChange.js +0 -37
- package/src/omegga/matchers/version.js +0 -45
- package/src/omegga/player.js +0 -585
- package/src/omegga/plugin/plugin_jsonrpc_stdio.js +0 -526
- package/src/omegga/plugin/plugin_node_safe/proxyOmegga.js +0 -117
- package/src/omegga/plugin/plugin_node_safe/worker.js +0 -238
- package/src/omegga/plugin/plugin_node_safe.js +0 -473
- package/src/omegga/plugin/plugin_node_unsafe.js +0 -177
- package/src/omegga/plugin.js +0 -565
- package/src/omegga/server.js +0 -658
- package/src/omegga/wrapper.js +0 -62
- package/src/softconfig.js +0 -64
- package/src/util/brick/checkBounds.js +0 -22
- package/src/util/brick/constants.js +0 -185
- package/src/util/brick/getBounds.js +0 -36
- package/src/util/brick/getBrickSize.js +0 -9
- package/src/util/brick/getScaleAxis.js +0 -31
- package/src/util/brick/index.js +0 -9
- package/src/util/brick/rotate.js +0 -43
- package/src/util/brick/setOwnership.js +0 -20
- package/src/util/chat.js +0 -28
- package/src/util/color.js +0 -143
- package/src/util/file.js +0 -119
- package/src/util/index.js +0 -28
- package/src/util/map.js +0 -28
- package/src/util/pattern.js +0 -14
- package/src/util/time.js +0 -46
- package/src/util/uuid.js +0 -8
- package/src/util/wsl.js +0 -9
- package/src/webserver/backend/api.js +0 -795
- package/src/webserver/backend/calendar.js +0 -15
- package/src/webserver/backend/database.js +0 -725
- package/src/webserver/backend/index.js +0 -206
- package/src/webserver/backend/metrics.js +0 -148
- package/src/webserver/backend/util.js +0 -75
- package/src/webserver/frontend/.eslintrc.yml +0 -26
- package/src/webserver/frontend/app.js +0 -78
- package/src/webserver/frontend/auth.js +0 -16
- package/src/webserver/frontend/components/Background.vue +0 -83
- package/src/webserver/frontend/components/Button.vue +0 -105
- package/src/webserver/frontend/components/ChatEntry.vue +0 -107
- package/src/webserver/frontend/components/ChatTime.vue +0 -40
- package/src/webserver/frontend/components/Dimmer.vue +0 -43
- package/src/webserver/frontend/components/Dropdown.vue +0 -145
- package/src/webserver/frontend/components/Footer.vue +0 -29
- package/src/webserver/frontend/components/Header.vue +0 -27
- package/src/webserver/frontend/components/InfiniteScroll.vue +0 -51
- package/src/webserver/frontend/components/Input.vue +0 -93
- package/src/webserver/frontend/components/ListInput.vue +0 -105
- package/src/webserver/frontend/components/Loader.vue +0 -98
- package/src/webserver/frontend/components/MainMenuButton.vue +0 -83
- package/src/webserver/frontend/components/Modal.vue +0 -44
- package/src/webserver/frontend/components/NavBar.vue +0 -24
- package/src/webserver/frontend/components/PlayerDropdown.vue +0 -210
- package/src/webserver/frontend/components/PopoutContent.vue +0 -32
- package/src/webserver/frontend/components/RoleDropdown.vue +0 -157
- package/src/webserver/frontend/components/Scroll.vue +0 -33
- package/src/webserver/frontend/components/Toggle.vue +0 -91
- package/src/webserver/frontend/components/index.js +0 -33
- package/src/webserver/frontend/css/font.scss +0 -53
- package/src/webserver/frontend/css/mixins.scss +0 -49
- package/src/webserver/frontend/css/style.scss +0 -166
- package/src/webserver/frontend/css/theme.scss +0 -64
- package/src/webserver/frontend/partials/NavHeader.vue +0 -55
- package/src/webserver/frontend/partials/Page.vue +0 -40
- package/src/webserver/frontend/partials/PageContent.vue +0 -31
- package/src/webserver/frontend/partials/SideNav.vue +0 -115
- package/src/webserver/frontend/partials/index.js +0 -4
- package/src/webserver/frontend/router.js +0 -83
- package/src/webserver/frontend/views/Auth.vue +0 -190
- package/src/webserver/frontend/views/History.vue +0 -462
- package/src/webserver/frontend/views/Home.vue +0 -251
- package/src/webserver/frontend/views/Main.vue +0 -69
- package/src/webserver/frontend/views/NotFound.vue +0 -10
- package/src/webserver/frontend/views/Players.vue +0 -425
- package/src/webserver/frontend/views/PlayersInspector.vue +0 -538
- package/src/webserver/frontend/views/Plugins.vue +0 -217
- package/src/webserver/frontend/views/PluginsInspector.vue +0 -418
- package/src/webserver/frontend/views/Server.vue +0 -167
- package/src/webserver/frontend/views/Users.vue +0 -538
- package/src/webserver/frontend/widgets/Chat.vue +0 -124
- package/src/webserver/frontend/widgets/Status.vue +0 -91
- package/src/webserver/frontend/widgets/index.js +0 -2
- package/src/webserver/frontend/widgets/tooltip.js +0 -108
- package/src/webserver/index.js +0 -4
package/src/omegga/plugin.js
DELETED
|
@@ -1,565 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const Datastore = require('nedb-promises');
|
|
5
|
-
|
|
6
|
-
const soft = require('../softconfig.js');
|
|
7
|
-
|
|
8
|
-
// Check if this plugin is disabled
|
|
9
|
-
const DISABLED_FILE = 'disabled.omegga';
|
|
10
|
-
|
|
11
|
-
// TODO: move doc.json to this file (maybe)
|
|
12
|
-
// TODO: cleaner plugin error messages
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
Plugin interface
|
|
16
|
-
Allows omegga to interface with plugins of a format
|
|
17
|
-
*/
|
|
18
|
-
class Plugin {
|
|
19
|
-
// returns true if a plugin at this path can be loaded
|
|
20
|
-
// only one kind of plugin should match this type
|
|
21
|
-
static canLoad(_pluginPath) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// returns the kind of plugin this is
|
|
26
|
-
static getFormat() {
|
|
27
|
-
throw 'undefined plugin format';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// read a file as json or return null
|
|
31
|
-
static readJSON(file) {
|
|
32
|
-
try {
|
|
33
|
-
return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
34
|
-
} catch (e) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// initialize a plugin at this path
|
|
40
|
-
constructor(pluginPath, omegga) {
|
|
41
|
-
this.path = pluginPath;
|
|
42
|
-
this.omegga = omegga;
|
|
43
|
-
this.shortPath = pluginPath.replace(
|
|
44
|
-
path.join(omegga.path, soft.PLUGIN_PATH) + '/',
|
|
45
|
-
''
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// assign plugin storage
|
|
50
|
-
setStorage(storage) {
|
|
51
|
-
this.storage = storage;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// check if the plugin is enabled
|
|
55
|
-
isEnabled() {
|
|
56
|
-
return !fs.existsSync(path.join(this.path, DISABLED_FILE));
|
|
57
|
-
}
|
|
58
|
-
// set the plugin enabled/disabled
|
|
59
|
-
setEnabled(enabled) {
|
|
60
|
-
const disabledPath = path.join(this.path, DISABLED_FILE);
|
|
61
|
-
if (enabled === this.isEnabled()) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (enabled) {
|
|
65
|
-
fs.unlinkSync(disabledPath);
|
|
66
|
-
} else {
|
|
67
|
-
fs.closeSync(fs.openSync(disabledPath, 'w'));
|
|
68
|
-
}
|
|
69
|
-
this.emitStatus();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// emit a plugin status change
|
|
73
|
-
emitStatus() {
|
|
74
|
-
this.omegga.emit('plugin:status', this.shortPath, {
|
|
75
|
-
name: this.getName(),
|
|
76
|
-
isLoaded: this.isLoaded(),
|
|
77
|
-
isEnabled: this.isEnabled(),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// emit a custom event from another plugin
|
|
82
|
-
async emitPlugin(_ev, _from, _args) {}
|
|
83
|
-
|
|
84
|
-
// get the plugin name, usually based on documentation data
|
|
85
|
-
getName() {
|
|
86
|
-
const doc = this.getDocumentation();
|
|
87
|
-
return (doc ? doc.name : path.basename(this.path)) || 'unnamed plugin';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// get the documentation object for this plugin
|
|
91
|
-
getDocumentation() {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// return true if this plugin is loaded
|
|
96
|
-
isLoaded() {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// return true if the command exists
|
|
101
|
-
isCommand(_cmd) {
|
|
102
|
-
return false;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// start the plugin, returns true if plugin successfully loaded
|
|
106
|
-
async load() {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// stop + kill the plugin, returns true if plugin successfully unloaded
|
|
111
|
-
async unload() {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// extra info for this kind of plugin
|
|
116
|
-
getInfo() {
|
|
117
|
-
return {};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// key-value storage for a plugin
|
|
122
|
-
class PluginStorage {
|
|
123
|
-
constructor(store, plugin) {
|
|
124
|
-
this.store = store;
|
|
125
|
-
this.plugin = plugin;
|
|
126
|
-
this.name = plugin.getName();
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// get the initial config values
|
|
130
|
-
getDefaultConfig() {
|
|
131
|
-
const doc = this.plugin.getDocumentation();
|
|
132
|
-
// check if the documentation object exists and whether it has a config field
|
|
133
|
-
if (!doc) return {};
|
|
134
|
-
if (!doc.config) return {};
|
|
135
|
-
|
|
136
|
-
// insert values from default config values
|
|
137
|
-
const config = {};
|
|
138
|
-
for (const k in doc.config) {
|
|
139
|
-
config[k] = doc.config[k].default;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return config;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// set the config field for this plugin
|
|
146
|
-
async setConfig(value) {
|
|
147
|
-
await this.store.update(
|
|
148
|
-
{ type: 'config', plugin: this.name },
|
|
149
|
-
{
|
|
150
|
-
$set: { value },
|
|
151
|
-
},
|
|
152
|
-
{ upsert: true }
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// get the config for this plugin
|
|
157
|
-
async getConfig() {
|
|
158
|
-
const config = await this.store.findOne({
|
|
159
|
-
type: 'config',
|
|
160
|
-
plugin: this.name,
|
|
161
|
-
});
|
|
162
|
-
if (!config) return null;
|
|
163
|
-
return config.value;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// initialize the plugin store
|
|
167
|
-
async init() {
|
|
168
|
-
// get default and configured values
|
|
169
|
-
const defaultConf = this.getDefaultConfig();
|
|
170
|
-
const config = await this.getConfig();
|
|
171
|
-
|
|
172
|
-
await this.setConfig({
|
|
173
|
-
// use default config
|
|
174
|
-
...defaultConf,
|
|
175
|
-
|
|
176
|
-
// override with actual config values
|
|
177
|
-
...(config ? config : {}),
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// get a stored object
|
|
182
|
-
async get(key) {
|
|
183
|
-
if (typeof key !== 'string' || key.length === 0) return;
|
|
184
|
-
const obj = await this.store.findOne({
|
|
185
|
-
type: 'store',
|
|
186
|
-
plugin: this.name,
|
|
187
|
-
key,
|
|
188
|
-
});
|
|
189
|
-
if (!obj) return null;
|
|
190
|
-
return obj.value;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// delete a stored object
|
|
194
|
-
async delete(key) {
|
|
195
|
-
if (typeof key !== 'string' || key.length === 0) return;
|
|
196
|
-
await this.store.remove({ type: 'store', plugin: this.name, key });
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// clear all stored values
|
|
200
|
-
async wipe() {
|
|
201
|
-
await this.store.remove(
|
|
202
|
-
{ type: 'store', plugin: this.name },
|
|
203
|
-
{ multi: true }
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// count number of objects in store
|
|
208
|
-
async count() {
|
|
209
|
-
return await this.store.count({ type: 'store', plugin: this.name });
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// get keys of all objects in store
|
|
213
|
-
async keys() {
|
|
214
|
-
const objects = await this.store.find({ type: 'store', plugin: this.name });
|
|
215
|
-
return objects.map(o => o.key);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// set a stored value
|
|
219
|
-
async set(key, value) {
|
|
220
|
-
if (typeof key !== 'string' || key.length === 0) return;
|
|
221
|
-
await this.store.update(
|
|
222
|
-
{ type: 'store', plugin: this.name, key },
|
|
223
|
-
{ $set: { value } },
|
|
224
|
-
{ upsert: true }
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/*
|
|
230
|
-
Plugin Loader and Scanner
|
|
231
|
-
Allows omegga to scan in plugins and load them
|
|
232
|
-
*/
|
|
233
|
-
class PluginLoader {
|
|
234
|
-
constructor(pluginsPath, omegga) {
|
|
235
|
-
this.path = pluginsPath;
|
|
236
|
-
this.omegga = omegga;
|
|
237
|
-
this.store = Datastore.create({
|
|
238
|
-
filename: path.join(omegga.dataPath, soft.PLUGIN_STORE),
|
|
239
|
-
autoload: true,
|
|
240
|
-
});
|
|
241
|
-
this.store.persistence.setAutocompactionInterval(1000 * 60 * 5);
|
|
242
|
-
this.formats = [];
|
|
243
|
-
this.plugins = [];
|
|
244
|
-
|
|
245
|
-
// soon to be deprecated !help
|
|
246
|
-
omegga.on('chatcmd:help', this.showHelp.bind(this));
|
|
247
|
-
|
|
248
|
-
// use /plugins to get help
|
|
249
|
-
omegga.on('cmd:plugins', this.showHelp.bind(this));
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
// let the plugin loader scan another kind of plugin in
|
|
253
|
-
addFormat(format) {
|
|
254
|
-
if (!(format instanceof Plugin))
|
|
255
|
-
throw 'provided plugin format is not a plugin';
|
|
256
|
-
|
|
257
|
-
this.formats.push(format);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// determine if this command is a command on the plugin
|
|
261
|
-
isCommand(cmd) {
|
|
262
|
-
return cmd === 'plugins' || this.plugins.some(p => p.isCommand(cmd));
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// scan a folder and load in formats
|
|
266
|
-
loadFormats(dir) {
|
|
267
|
-
// add all the discovered formats into the formats list
|
|
268
|
-
this.formats.push(
|
|
269
|
-
// find all plugin_EXT.js files in the given dir
|
|
270
|
-
...fs
|
|
271
|
-
.readdirSync(dir)
|
|
272
|
-
// all files match the plugin_nameType.js pattern
|
|
273
|
-
.filter(file => file.match(/plugin_[a-zA-Z_]+\.js/))
|
|
274
|
-
// require all the formats
|
|
275
|
-
.map(file => require('./plugin/' + file))
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// unload and load all installed plugins
|
|
280
|
-
async reload() {
|
|
281
|
-
let ok = true;
|
|
282
|
-
Omegga.verbose('Reloading plugins');
|
|
283
|
-
for (const p of this.plugins) {
|
|
284
|
-
try {
|
|
285
|
-
// unload the plugin if it's loaded
|
|
286
|
-
if (p.isLoaded()) await p.unload();
|
|
287
|
-
|
|
288
|
-
// load the plugin if it successfully unloaded
|
|
289
|
-
if (!p.isLoaded()) {
|
|
290
|
-
// only load it if it is enabled
|
|
291
|
-
if (p.isEnabled()) {
|
|
292
|
-
Omegga.verbose(
|
|
293
|
-
'Loading plugin',
|
|
294
|
-
p.constructor.getFormat(),
|
|
295
|
-
p.getName().underline
|
|
296
|
-
);
|
|
297
|
-
ok = (await p.load()) || ok;
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
Omegga.error(
|
|
301
|
-
'!>'.red,
|
|
302
|
-
'Did not successfully unload plugin',
|
|
303
|
-
p.getName().brightRed.underline
|
|
304
|
-
);
|
|
305
|
-
ok = false;
|
|
306
|
-
}
|
|
307
|
-
} catch (err) {
|
|
308
|
-
Omegga.error(
|
|
309
|
-
'!>'.red,
|
|
310
|
-
'Error loading plugin',
|
|
311
|
-
p.getName().brightRed.underline,
|
|
312
|
-
err
|
|
313
|
-
);
|
|
314
|
-
ok = false;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
Omegga.verbose('Finished reloading plugins');
|
|
318
|
-
return ok;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// stop all plugins from running
|
|
322
|
-
async unload() {
|
|
323
|
-
Omegga.verbose('Unloading plugins');
|
|
324
|
-
let ok = true;
|
|
325
|
-
// potentually use Promise.all
|
|
326
|
-
for (const p of this.plugins) {
|
|
327
|
-
try {
|
|
328
|
-
// unload the plugin if it's loaded
|
|
329
|
-
if (p.isLoaded()) {
|
|
330
|
-
if (!(await p.unload())) {
|
|
331
|
-
Omegga.error(
|
|
332
|
-
'!>'.red,
|
|
333
|
-
'Could not unloading plugin',
|
|
334
|
-
p.getName().brightRed.underline
|
|
335
|
-
);
|
|
336
|
-
ok = false;
|
|
337
|
-
continue;
|
|
338
|
-
} else {
|
|
339
|
-
Omegga.verbose('Unloaded', p.getName().underline);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
} catch (e) {
|
|
343
|
-
Omegga.error(
|
|
344
|
-
'!>'.red,
|
|
345
|
-
'Error unloading plugin',
|
|
346
|
-
p.getName().brightRed.underline
|
|
347
|
-
);
|
|
348
|
-
ok = false;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
return ok;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// find every loadable plugin
|
|
355
|
-
async scan() {
|
|
356
|
-
Omegga.verbose('Scanning plugin directory');
|
|
357
|
-
// plugin directory doesn't exist
|
|
358
|
-
if (!fs.existsSync(this.path)) {
|
|
359
|
-
Omegga.verbose('Plugin directory is missing');
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// make sure there are no plugins running
|
|
364
|
-
if (this.plugins.some(p => p.isLoaded())) {
|
|
365
|
-
Omegga.error('!>'.red, 'Cannot re-scan plugins while a plugin is loaded');
|
|
366
|
-
return false;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// find all directories in the plugin path
|
|
370
|
-
this.plugins = (
|
|
371
|
-
await Promise.all(
|
|
372
|
-
fs
|
|
373
|
-
.readdirSync(this.path)
|
|
374
|
-
.map(dir => path.join(this.path, dir)) // convert from local paths
|
|
375
|
-
// every plugin must be in a directory
|
|
376
|
-
.filter(dir => fs.existsSync(dir) && fs.lstatSync(dir).isDirectory())
|
|
377
|
-
// every plugin must be loadable through some format
|
|
378
|
-
.map(async dir => {
|
|
379
|
-
// find a plugin format that can load in this plugin
|
|
380
|
-
const PluginFormat = this.formats.find(f => f.canLoad(dir));
|
|
381
|
-
|
|
382
|
-
// let users know if there's a missing plugin format
|
|
383
|
-
if (!PluginFormat) {
|
|
384
|
-
Omegga.error('!>'.red, 'Missing plugin format for', dir);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
try {
|
|
388
|
-
// create the plugin format
|
|
389
|
-
const plugin = PluginFormat && new PluginFormat(dir, this.omegga);
|
|
390
|
-
if (!plugin.getDocumentation()) {
|
|
391
|
-
Omegga.error(
|
|
392
|
-
'!>'.red,
|
|
393
|
-
'Missing/invalid plugin documentation for',
|
|
394
|
-
dir
|
|
395
|
-
);
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
// create its storage
|
|
400
|
-
const storage = new PluginStorage(this.store, plugin);
|
|
401
|
-
await storage.init();
|
|
402
|
-
|
|
403
|
-
// load the storage in
|
|
404
|
-
plugin.setStorage(storage);
|
|
405
|
-
|
|
406
|
-
// if there is a plugin format, create the plugin instance (but don't load yet)
|
|
407
|
-
return plugin;
|
|
408
|
-
} catch (e) {
|
|
409
|
-
// if a plugin format fails to load, prevent omegga from dying
|
|
410
|
-
Omegga.error(
|
|
411
|
-
'!>'.red,
|
|
412
|
-
'Error loading plugin',
|
|
413
|
-
e.getName().brightRed.underline,
|
|
414
|
-
PluginFormat,
|
|
415
|
-
e
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
)
|
|
420
|
-
)
|
|
421
|
-
// remove plugins without formats
|
|
422
|
-
.filter(p => p);
|
|
423
|
-
|
|
424
|
-
this.buildDocumentation();
|
|
425
|
-
|
|
426
|
-
return true;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// show helptext
|
|
430
|
-
showHelp(player, ...args) {
|
|
431
|
-
// send the message to the player
|
|
432
|
-
const send = msg => this.omegga.whisper(player, msg);
|
|
433
|
-
|
|
434
|
-
// available commands and documentation from the plugin system
|
|
435
|
-
const commands = this.commands;
|
|
436
|
-
const docs = this.documentation;
|
|
437
|
-
|
|
438
|
-
const splitHelper = objs => {
|
|
439
|
-
const lines = [];
|
|
440
|
-
while (objs.length > 0) {
|
|
441
|
-
const [item] = objs.splice(0, 1);
|
|
442
|
-
if (!lines.length || lines[lines.length - 1].length + item.length > 150)
|
|
443
|
-
lines.push(item);
|
|
444
|
-
else lines[lines.length - 1] += ', ' + item;
|
|
445
|
-
}
|
|
446
|
-
return lines;
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
// no arguments
|
|
450
|
-
if (!args.length) {
|
|
451
|
-
send(
|
|
452
|
-
'"Use <code>/plugins plugin</>, <code>/plugins !command</>, <code>/plugins /command</> for more information"'
|
|
453
|
-
);
|
|
454
|
-
const plugins = Object.keys(docs).map(
|
|
455
|
-
d =>
|
|
456
|
-
`<color=\\"${
|
|
457
|
-
docs[d]._plugin.isLoaded() ? 'aaffaa' : 'aaaaaa'
|
|
458
|
-
}\\">${d}</>`
|
|
459
|
-
);
|
|
460
|
-
if (!plugins.length) {
|
|
461
|
-
send('"<b>No Installed Plugins</>"');
|
|
462
|
-
} else {
|
|
463
|
-
const lines = splitHelper(plugins);
|
|
464
|
-
send(`"<b>Installed Plugins</>: ${lines[0]}"`);
|
|
465
|
-
for (let i = 1; i < lines.length; i++) send(`"${lines[i]}"`);
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
// plugin or command argument
|
|
469
|
-
} else if (args.length > 0) {
|
|
470
|
-
const target = args.join(' ');
|
|
471
|
-
// argument is a plugin; render description, author, and commands
|
|
472
|
-
if (docs[target]) {
|
|
473
|
-
const doc = docs[target];
|
|
474
|
-
const desc = doc.description || 'no description';
|
|
475
|
-
const color = doc._plugin.isLoaded() ? 'aaffaa' : 'aaaaaa';
|
|
476
|
-
send(
|
|
477
|
-
`"<b>Plugin</> <code><color=\\"${color}\\">${target}</></>: ${desc}"`
|
|
478
|
-
);
|
|
479
|
-
|
|
480
|
-
if (doc.author)
|
|
481
|
-
send(`"<b>Author</>: <color=\\"c4d7f5\\"><b>${doc.author}</></>"`);
|
|
482
|
-
|
|
483
|
-
if (doc.commands && doc.commands.length > 0) {
|
|
484
|
-
const lines = splitHelper(
|
|
485
|
-
doc.commands.map(c => `<code>${c.name}</>`)
|
|
486
|
-
);
|
|
487
|
-
send(`"<b>Commands</>: ${lines[0]}"`);
|
|
488
|
-
for (let i = 1; i < lines.length; i++) send(`"${lines[i]}"`);
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
// argument is a command
|
|
492
|
-
} else if (commands[target]) {
|
|
493
|
-
const doc = commands[target];
|
|
494
|
-
const desc = doc.description || 'no description';
|
|
495
|
-
const example = doc.example || 'no example';
|
|
496
|
-
const color = doc._plugin.isLoaded() ? 'aaffaa' : 'aaaaaa';
|
|
497
|
-
send(
|
|
498
|
-
`"<b>Command</> <code><color=\\"${color}\\">${doc.name}</></>: ${desc}"`
|
|
499
|
-
);
|
|
500
|
-
send(`"<b>Example</>: <code>${example}</>"`);
|
|
501
|
-
if (doc.args && doc.args.length > 0) {
|
|
502
|
-
send('"<b>Arguments</>:"');
|
|
503
|
-
for (const arg of doc.args) {
|
|
504
|
-
const desc = arg.description || 'no description';
|
|
505
|
-
send(
|
|
506
|
-
`"- <code>${arg.name}</>${
|
|
507
|
-
arg.required ? ' (required)' : ''
|
|
508
|
-
}: ${desc}"`
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
} else {
|
|
512
|
-
send('"<b>Arguments</>: None"');
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// user takes the helptext literally
|
|
516
|
-
} else if (
|
|
517
|
-
args[0] === '!command' ||
|
|
518
|
-
args[0] === '/command' ||
|
|
519
|
-
args[0] === 'plugin'
|
|
520
|
-
) {
|
|
521
|
-
send(
|
|
522
|
-
'"Use <code>/plugins [name of plugin]</> or <code>/plugins [name of !command or /command]</> for more help for the respective plugin or command"'
|
|
523
|
-
);
|
|
524
|
-
|
|
525
|
-
// argument is not found
|
|
526
|
-
} else {
|
|
527
|
-
send('"Could not find that command or plugin"');
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
// too many arguments
|
|
531
|
-
} else {
|
|
532
|
-
send(
|
|
533
|
-
'"Use <code>/plugins</> to list plugins and <code>/plugins plugin</> or <code>!help !command or /command</> for more information"'
|
|
534
|
-
);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// generate documentation from loaded plugins
|
|
539
|
-
buildDocumentation() {
|
|
540
|
-
this.documentation = {};
|
|
541
|
-
this.commands = {};
|
|
542
|
-
for (const plugin of this.plugins) {
|
|
543
|
-
// make sure this plugin has docs
|
|
544
|
-
const doc = JSON.parse(JSON.stringify(plugin.getDocumentation()));
|
|
545
|
-
if (!doc) continue;
|
|
546
|
-
const name = plugin.getName();
|
|
547
|
-
if (!name) continue;
|
|
548
|
-
|
|
549
|
-
doc._plugin = plugin;
|
|
550
|
-
|
|
551
|
-
// add the documentation into a dictionary
|
|
552
|
-
this.documentation[name] = doc;
|
|
553
|
-
|
|
554
|
-
// add all the commands into a dictionary
|
|
555
|
-
if (doc.commands) {
|
|
556
|
-
for (const cmd of doc.commands) {
|
|
557
|
-
this.commands[cmd.name] = cmd;
|
|
558
|
-
cmd._plugin = plugin;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
module.exports = { Plugin, PluginLoader };
|