@futdevpro/nts-dynamo 1.10.77 → 1.11.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/build/_collections/atlas-default-db-options.const.d.ts +28 -0
- package/build/_collections/atlas-default-db-options.const.d.ts.map +1 -0
- package/build/_collections/atlas-default-db-options.const.js +10 -0
- package/build/_collections/atlas-default-db-options.const.js.map +1 -0
- package/build/_collections/get-environment-settings.util.d.ts +3 -0
- package/build/_collections/get-environment-settings.util.d.ts.map +1 -0
- package/build/_collections/get-environment-settings.util.js +45 -0
- package/build/_collections/get-environment-settings.util.js.map +1 -0
- package/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +9 -4
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/control-models/app-params.control-model.d.ts +6 -0
- package/build/_models/control-models/app-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/app-params.control-model.js +29 -2
- package/build/_models/control-models/app-params.control-model.js.map +1 -1
- package/build/_models/control-models/app-params.control-model.spec.js +5 -4
- package/build/_models/control-models/app-params.control-model.spec.js.map +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js +1 -1
- package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
- package/build/_models/interfaces/environment-settings.interface.d.ts +35 -0
- package/build/_models/interfaces/environment-settings.interface.d.ts.map +1 -0
- package/build/_models/interfaces/environment-settings.interface.js +3 -0
- package/build/_models/interfaces/environment-settings.interface.js.map +1 -0
- package/build/_models/interfaces/global-settings.interface.d.ts +34 -2
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/custom-data/index.d.ts.map +1 -1
- package/build/_modules/custom-data/index.js +1 -0
- package/build/_modules/custom-data/index.js.map +1 -1
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.d.ts +3 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js +17 -0
- package/build/_modules/discord-assistant/_collections/dias-global-settings.const.js.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts +6 -0
- package/build/_modules/discord-assistant/_collections/dias.util.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_collections/dias.util.js +36 -0
- package/build/_modules/discord-assistant/_collections/dias.util.js.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.d.ts +18 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.js +3 -0
- package/build/_modules/discord-assistant/_models/dias-global-settings.interface.js.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.d.ts +10 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.js +41 -0
- package/build/_modules/discord-assistant/_models/dias-knowledge.data-model.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +14 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js +88 -0
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts +10 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.js +40 -0
- package/build/_modules/discord-assistant/_services/dias-io.control-service.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.d.ts +8 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.js +23 -0
- package/build/_modules/discord-assistant/_services/dias-main.control-service.js.map +1 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts +11 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.d.ts.map +1 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.js +33 -0
- package/build/_modules/discord-assistant/_services/dias.service-base.js.map +1 -0
- package/build/_modules/discord-assistant/index.d.ts +10 -0
- package/build/_modules/discord-assistant/index.d.ts.map +1 -0
- package/build/_modules/discord-assistant/index.js +23 -0
- package/build/_modules/discord-assistant/index.js.map +1 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.d.ts +4 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.d.ts.map +1 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.js +8 -0
- package/build/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.js.map +1 -0
- package/build/_modules/discord-assistant-voiced/index.d.ts +3 -0
- package/build/_modules/discord-assistant-voiced/index.d.ts.map +1 -0
- package/build/_modules/discord-assistant-voiced/index.js +26 -0
- package/build/_modules/discord-assistant-voiced/index.js.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.d.ts +3 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.d.ts.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.js +13 -0
- package/build/_modules/discord-bot/_collections/dibo-default-commands.const.js.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts +3 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.d.ts.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.js +44 -0
- package/build/_modules/discord-bot/_collections/dibo-global-settings.conts.js.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.d.ts +22 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.d.ts.map +1 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.js +261 -0
- package/build/_modules/discord-bot/_collections/dibo-operations.util.js.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.d.ts +8 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.js +3 -0
- package/build/_modules/discord-bot/_models/dibo-command.interface.js.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.d.ts +7 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.js +3 -0
- package/build/_modules/discord-bot/_models/dibo-last-mention-date.inteface.js.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.d.ts +6 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.js +3 -0
- package/build/_modules/discord-bot/_models/dibo-last-message-date.interface.js.map +1 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.d.ts +88 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.d.ts.map +1 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.js +3 -0
- package/build/_modules/discord-bot/_models/global-bot-log-settings.interface.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.d.ts +12 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.js +72 -0
- package/build/_modules/discord-bot/_services/dibo-commands.control-service.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.d.ts +19 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js +176 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.d.ts +85 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js +228 -0
- package/build/_modules/discord-bot/_services/dibo-main.control-service.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts +13 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.d.ts.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.js +38 -0
- package/build/_modules/discord-bot/_services/dibo-routines.control-service.js.map +1 -0
- package/build/_modules/discord-bot/index.d.ts +12 -0
- package/build/_modules/discord-bot/index.d.ts.map +1 -0
- package/build/_modules/discord-bot/index.js +30 -0
- package/build/_modules/discord-bot/index.js.map +1 -0
- package/build/_modules/oauth2/index.d.ts.map +1 -1
- package/build/_modules/oauth2/index.js +7 -0
- package/build/_modules/oauth2/index.js.map +1 -1
- package/build/_modules/open-ai/_collections/oai-chunking.util.d.ts +74 -0
- package/build/_modules/open-ai/_collections/oai-chunking.util.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-chunking.util.js +385 -0
- package/build/_modules/open-ai/_collections/oai-chunking.util.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-document.util.d.ts +4 -0
- package/build/_modules/open-ai/_collections/oai-document.util.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-document.util.js +12 -0
- package/build/_modules/open-ai/_collections/oai-document.util.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.d.ts +3 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.js +9 -0
- package/build/_modules/open-ai/_collections/oai-global-settings.const.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts +3 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js +75 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.js.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts +3 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.d.ts.map +1 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js +68 -0
- package/build/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.js.map +1 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.d.ts +6 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.d.ts.map +1 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.js +10 -0
- package/build/_modules/open-ai/_enums/oai-compare-result-type.enum.js.map +1 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts +18 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.d.ts.map +1 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.js +40 -0
- package/build/_modules/open-ai/_enums/oai-gpt-message-role.enum.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.d.ts +7 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts +15 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-document-page.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts +6 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-global-settings.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts +6 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts +52 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.d.ts +13 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.js +3 -0
- package/build/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.js.map +1 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.d.ts +18 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.d.ts.map +1 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.js +80 -0
- package/build/_modules/open-ai/_models/oai-doc-chunk.data-model.js.map +1 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.d.ts +13 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.js +170 -0
- package/build/_modules/open-ai/_services/oai-chunk.service-base.js.map +1 -0
- package/build/_modules/open-ai/_services/{embedding.control-service.d.ts → oai-embedding.control-service.d.ts} +3 -3
- package/build/_modules/open-ai/_services/oai-embedding.control-service.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/{embedding.control-service.js → oai-embedding.control-service.js} +5 -5
- package/build/_modules/open-ai/_services/oai-embedding.control-service.js.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +181 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js +344 -0
- package/build/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts +234 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.js +441 -0
- package/build/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -0
- package/build/_modules/open-ai/_services/{vector-data.service.d.ts → oai-vector-data.service.d.ts} +4 -4
- package/build/_modules/open-ai/_services/oai-vector-data.service.d.ts.map +1 -0
- package/build/_modules/open-ai/_services/{vector-data.service.js → oai-vector-data.service.js} +27 -7
- package/build/_modules/open-ai/_services/oai-vector-data.service.js.map +1 -0
- package/build/_modules/open-ai/index.d.ts +19 -4
- package/build/_modules/open-ai/index.d.ts.map +1 -1
- package/build/_modules/open-ai/index.js +36 -4
- package/build/_modules/open-ai/index.js.map +1 -1
- package/build/_modules/server/index.d.ts +1 -1
- package/build/_modules/server/index.d.ts.map +1 -1
- package/build/_modules/server/index.js +16 -2
- package/build/_modules/server/index.js.map +1 -1
- package/build/_modules/server/server-status/server-status.controller.d.ts.map +1 -1
- package/build/_modules/server/server-status/server-status.controller.js +10 -0
- package/build/_modules/server/server-status/server-status.controller.js.map +1 -1
- package/build/_modules/socket/index.d.ts.map +1 -1
- package/build/_modules/socket/index.js +18 -0
- package/build/_modules/socket/index.js.map +1 -1
- package/build/_modules/test/index.d.ts.map +1 -1
- package/build/_modules/test/index.js +5 -0
- package/build/_modules/test/index.js.map +1 -1
- package/build/_modules/usage/index.d.ts.map +1 -1
- package/build/_modules/usage/index.js +5 -0
- package/build/_modules/usage/index.js.map +1 -1
- package/build/_services/base/data.service.d.ts +6 -0
- package/build/_services/base/data.service.d.ts.map +1 -1
- package/build/_services/base/data.service.js +6 -0
- package/build/_services/base/data.service.js.map +1 -1
- package/build/_services/base/db.service.d.ts +10 -0
- package/build/_services/base/db.service.d.ts.map +1 -1
- package/build/_services/base/db.service.js +10 -0
- package/build/_services/base/db.service.js.map +1 -1
- package/build/_services/server/app.server.js +1 -2
- package/build/_services/server/app.server.js.map +1 -1
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +26 -1
- package/build/index.js.map +1 -1
- package/package.json +40 -10
- package/src/_collections/atlas-default-db-options.const.ts +10 -0
- package/src/_collections/get-environment-settings.util.ts +49 -0
- package/src/_collections/global-settings.const.ts +15 -4
- package/src/_collections/sample.env +21 -0
- package/src/_models/control-models/app-params.control-model.spec.ts +5 -4
- package/src/_models/control-models/app-params.control-model.ts +31 -2
- package/src/_models/control-models/endpoint-params.control-model.ts +1 -1
- package/src/_models/interfaces/environment-settings.interface.ts +59 -0
- package/src/_models/interfaces/global-settings.interface.ts +41 -1
- package/src/_modules/custom-data/index.ts +3 -0
- package/src/_modules/discord-assistant/_collections/dias-global-settings.const.ts +19 -0
- package/src/_modules/discord-assistant/_collections/dias.util.ts +43 -0
- package/src/_modules/discord-assistant/_models/dias-global-settings.interface.ts +20 -0
- package/src/_modules/discord-assistant/_models/dias-knowledge.data-model.ts +46 -0
- package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +152 -0
- package/src/_modules/discord-assistant/_services/dias-io.control-service.ts +64 -0
- package/src/_modules/discord-assistant/_services/dias-main.control-service.ts +28 -0
- package/src/_modules/discord-assistant/_services/dias.service-base.ts +49 -0
- package/src/_modules/discord-assistant/index.ts +36 -0
- package/src/_modules/discord-assistant-voiced/_services/dias-discord-bot.control-service.ts +11 -0
- package/src/_modules/discord-assistant-voiced/index.ts +36 -0
- package/src/_modules/discord-bot/_collections/dibo-default-commands.const.ts +17 -0
- package/src/_modules/discord-bot/_collections/dibo-global-settings.conts.ts +56 -0
- package/src/_modules/discord-bot/_collections/dibo-operations.util.ts +372 -0
- package/src/_modules/discord-bot/_models/dibo-command.interface.ts +12 -0
- package/src/_modules/discord-bot/_models/dibo-last-mention-date.inteface.ts +8 -0
- package/src/_modules/discord-bot/_models/dibo-last-message-date.interface.ts +6 -0
- package/src/_modules/discord-bot/_models/global-bot-log-settings.interface.ts +98 -0
- package/src/_modules/discord-bot/_services/dibo-commands.control-service.ts +120 -0
- package/src/_modules/discord-bot/_services/dibo-io.control-service.ts +245 -0
- package/src/_modules/discord-bot/_services/dibo-main.control-service.ts +304 -0
- package/src/_modules/discord-bot/_services/dibo-routines.control-service.ts +60 -0
- package/src/_modules/discord-bot/index.ts +36 -0
- package/src/_modules/oauth2/index.ts +8 -0
- package/src/_modules/open-ai/_collections/oai-chunking.util.ts +496 -0
- package/src/_modules/open-ai/_collections/oai-document.util.ts +10 -0
- package/src/_modules/open-ai/_collections/oai-global-settings.const.ts +9 -0
- package/src/_modules/open-ai/_collections/oai-llm-predefined-requests-hu.conts.ts +83 -0
- package/src/_modules/open-ai/_collections/oai-llm-predefined-requests.conts.ts +76 -0
- package/src/_modules/open-ai/_enums/oai-compare-result-type.enum.ts +7 -0
- package/src/_modules/open-ai/_enums/oai-gpt-message-role.enum.ts +45 -0
- package/src/_modules/open-ai/_models/interfaces/oai-chunk-compare-result.interface.ts +10 -0
- package/src/_modules/open-ai/_models/interfaces/oai-document-page.interface.ts +21 -0
- package/src/_modules/open-ai/_models/interfaces/oai-global-settings.interface.ts +8 -0
- package/src/_modules/open-ai/_models/interfaces/oai-gpt-message.interface.ts +7 -0
- package/src/_modules/open-ai/_models/interfaces/oai-llm-predefined-requests.interface.ts +57 -0
- package/src/_modules/open-ai/_models/interfaces/oai-page-compare-result.interface.ts +18 -0
- package/src/_modules/open-ai/_models/oai-doc-chunk.data-model.ts +92 -0
- package/src/_modules/open-ai/_services/oai-chunk.service-base.ts +214 -0
- package/src/_modules/open-ai/_services/{embedding.control-service.ts → oai-embedding.control-service.ts} +2 -2
- package/src/_modules/open-ai/_services/oai-llm-chat.service-base.ts +621 -0
- package/src/_modules/open-ai/_services/oai-llm.service-base.ts +651 -0
- package/src/_modules/open-ai/_services/{vector-data.service.ts → oai-vector-data.service.ts} +32 -5
- package/src/_modules/open-ai/index.ts +43 -4
- package/src/_modules/server/index.ts +18 -2
- package/src/_modules/server/server-status/server-status.controller.ts +13 -0
- package/src/_modules/socket/index.ts +23 -0
- package/src/_modules/test/index.ts +8 -0
- package/src/_modules/usage/index.ts +8 -0
- package/src/_services/base/data.service.ts +6 -0
- package/src/_services/base/db.service.ts +10 -0
- package/src/_services/server/app.server.ts +1 -1
- package/src/index.ts +28 -1
- package/build/_modules/open-ai/_services/embedding.control-service.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/embedding.control-service.js.map +0 -1
- package/build/_modules/open-ai/_services/gpt.service-base.d.ts +0 -98
- package/build/_modules/open-ai/_services/gpt.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/gpt.service-base.js +0 -284
- package/build/_modules/open-ai/_services/gpt.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/open-ai.service-base.d.ts +0 -21
- package/build/_modules/open-ai/_services/open-ai.service-base.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/open-ai.service-base.js +0 -50
- package/build/_modules/open-ai/_services/open-ai.service-base.js.map +0 -1
- package/build/_modules/open-ai/_services/vector-data.service.d.ts.map +0 -1
- package/build/_modules/open-ai/_services/vector-data.service.js.map +0 -1
- package/build/_services/server/env-set.d.ts +0 -2
- package/build/_services/server/env-set.d.ts.map +0 -1
- package/build/_services/server/env-set.js +0 -20
- package/build/_services/server/env-set.js.map +0 -1
- package/src/_modules/open-ai/_services/gpt.service-base.ts +0 -438
- package/src/_modules/open-ai/_services/open-ai.service-base.ts +0 -69
- package/src/_services/server/env-set.ts +0 -21
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { GatewayIntentBits, Partials } from 'discord.js';
|
|
2
|
+
import { DyNTS_DiBo_Command } from './dibo-command.interface';
|
|
3
|
+
|
|
4
|
+
export interface DyNTS_DiBo_Global_Settings {
|
|
5
|
+
/**
|
|
6
|
+
* this setting will set the debug level for the bot
|
|
7
|
+
*
|
|
8
|
+
* 0 - no logs
|
|
9
|
+
* 1 - errors sending to report channel
|
|
10
|
+
* 2 - errors sending as response, will log events in console
|
|
11
|
+
* 3 - errors sending as response, creating reports to report channel, debug events are in console (default)
|
|
12
|
+
* 4 - errors and debug events are sending as response
|
|
13
|
+
* 5 - all events are sending as response (that are set to send)
|
|
14
|
+
* 6 - all debug logs are enabled
|
|
15
|
+
*
|
|
16
|
+
* _
|
|
17
|
+
*/
|
|
18
|
+
debugLevel: number;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* this setting will set the intents for the bot
|
|
22
|
+
*/
|
|
23
|
+
intents: GatewayIntentBits[];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* this setting will set the partials for the bot
|
|
27
|
+
*/
|
|
28
|
+
partials: Partials[];
|
|
29
|
+
|
|
30
|
+
allowedUsers: 'all' | string[];
|
|
31
|
+
|
|
32
|
+
messageSettings: {
|
|
33
|
+
/**
|
|
34
|
+
* this setting will set the time limit for message fetching
|
|
35
|
+
* so we will stop fetching messages sent later than this time
|
|
36
|
+
*/
|
|
37
|
+
messageFetchTimeLimit: number;
|
|
38
|
+
/**
|
|
39
|
+
* this setting will set the count limit for message fetching
|
|
40
|
+
* so we will stop fetching messages after this count
|
|
41
|
+
*/
|
|
42
|
+
messageFetchCountLimit: number;
|
|
43
|
+
/**
|
|
44
|
+
* this setting will set the delay for message sending,
|
|
45
|
+
* so we won't flood the channel too fast
|
|
46
|
+
*/
|
|
47
|
+
messageSendDelay: number;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* this setting will be used to skip answering to messages
|
|
51
|
+
* if the message contains any of these flags, the bot will not answer
|
|
52
|
+
*
|
|
53
|
+
* @default [ '[BOT-SKIP]' ]
|
|
54
|
+
*/
|
|
55
|
+
skipFlags: string[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* this setting will set the channel settings for the bot
|
|
60
|
+
*/
|
|
61
|
+
channelSettings: {
|
|
62
|
+
/**
|
|
63
|
+
* this setting will set the name of the channel where the bot will send the reports
|
|
64
|
+
*
|
|
65
|
+
* @default 'bot-report'
|
|
66
|
+
*/
|
|
67
|
+
reportChannelName: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* this setting will set the channels where the bot will answer automatically
|
|
71
|
+
* whenever a message is sent in one of these channels, that is not from the bot
|
|
72
|
+
*
|
|
73
|
+
* it will be populated automatically from the default channels
|
|
74
|
+
*/
|
|
75
|
+
allowedChannels: string[];
|
|
76
|
+
/**
|
|
77
|
+
* this setting will set if the bot can answer in Direct Messages Channels
|
|
78
|
+
*
|
|
79
|
+
* @default false
|
|
80
|
+
*/
|
|
81
|
+
dmIsAllowed: boolean;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* this setting will set the default channels where the bot will answer automatically
|
|
85
|
+
* whenever a message is sent in one of these channels, that is not from the bot
|
|
86
|
+
*
|
|
87
|
+
* @default [ 'bot-report' ]
|
|
88
|
+
*/
|
|
89
|
+
defaultChannels: string[];
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
commandSettings: {
|
|
93
|
+
commandOperator: string;
|
|
94
|
+
commands: DyNTS_DiBo_Command[];
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
allowBotsInteractEachOther: boolean;
|
|
98
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
|
|
2
|
+
import { Guild, Message } from 'discord.js';
|
|
3
|
+
|
|
4
|
+
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
5
|
+
|
|
6
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
7
|
+
import { DyNTS_DiBo_Main_ControlService } from './dibo-main.control-service';
|
|
8
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
9
|
+
import { DyNTS_DiBo_global_settings } from '../_collections/dibo-global-settings.conts';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export abstract class Commands_ControlService extends DyNTS_SingletonService {
|
|
13
|
+
|
|
14
|
+
static getInstance(): Commands_ControlService {
|
|
15
|
+
return Commands_ControlService.getSingletonInstance();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
protected abstract getMainDiscordBotControlService(): DyNTS_DiBo_Main_ControlService;
|
|
19
|
+
protected readonly mainDiscordBot_CS: DyNTS_DiBo_Main_ControlService =
|
|
20
|
+
this.getMainDiscordBotControlService();
|
|
21
|
+
|
|
22
|
+
get discordServer(): Guild {
|
|
23
|
+
return this.mainDiscordBot_CS.discordServer;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected constructor() {
|
|
27
|
+
super();
|
|
28
|
+
|
|
29
|
+
if (!this.discordServer) {
|
|
30
|
+
throw new DyFM_Error({
|
|
31
|
+
...this.getDefaultErrorSettings(
|
|
32
|
+
'constructor',
|
|
33
|
+
new Error(
|
|
34
|
+
'Discord server not yet initialized, ' +
|
|
35
|
+
'should only be called after DyNTS_DiBo_Main_ControlService.start'
|
|
36
|
+
),
|
|
37
|
+
'system-init'
|
|
38
|
+
),
|
|
39
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-CCS-C00`,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async handleCommand(message: Message, issuer: string): Promise<void> {
|
|
45
|
+
try {
|
|
46
|
+
let haveCommandOperator = false;
|
|
47
|
+
let msg = message.content.replace(
|
|
48
|
+
`<@${this.mainDiscordBot_CS.client.user.id}>`, ''
|
|
49
|
+
).trim();
|
|
50
|
+
|
|
51
|
+
if (!DyNTS_DiBo_global_settings.commandSettings.commandOperator) {
|
|
52
|
+
haveCommandOperator = true;
|
|
53
|
+
} else if (
|
|
54
|
+
msg.startsWith(DyNTS_DiBo_global_settings.commandSettings.commandOperator)
|
|
55
|
+
) {
|
|
56
|
+
haveCommandOperator = true;
|
|
57
|
+
msg = msg.replace(DyNTS_DiBo_global_settings.commandSettings.commandOperator, '');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!haveCommandOperator) {
|
|
61
|
+
throw new DyFM_Error({
|
|
62
|
+
...this.getDefaultErrorSettings(
|
|
63
|
+
'handleCommand',
|
|
64
|
+
new Error('No command operator found in the message'),
|
|
65
|
+
issuer
|
|
66
|
+
),
|
|
67
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-CCS-HC1`,
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const commandExists = DyNTS_DiBo_global_settings.commandSettings.commands.find(
|
|
72
|
+
(command) => msg.startsWith(command.command)
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
if (!commandExists) {
|
|
76
|
+
throw new DyFM_Error({
|
|
77
|
+
...this.getDefaultErrorSettings(
|
|
78
|
+
'handleCommand',
|
|
79
|
+
new Error(`Command not found: "${msg.split(' ')[0]}"`),
|
|
80
|
+
issuer
|
|
81
|
+
),
|
|
82
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-CCS-HC2`,
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (commandExists.permissionNeeded) {
|
|
87
|
+
const permissionNeeded = await commandExists.permissionNeeded(message);
|
|
88
|
+
|
|
89
|
+
if (!permissionNeeded) {
|
|
90
|
+
throw new DyFM_Error({
|
|
91
|
+
...this.getDefaultErrorSettings(
|
|
92
|
+
'handleCommand',
|
|
93
|
+
new Error('Permission needed'),
|
|
94
|
+
issuer
|
|
95
|
+
),
|
|
96
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-CCS-HC3`,
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await commandExists.commandHandler(message);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
message.reply(
|
|
104
|
+
`Error occurred while handling the command:\n` +
|
|
105
|
+
DyFM_Error.getAnyMessage(error)
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
throw new DyFM_Error({
|
|
109
|
+
...this.getDefaultErrorSettings('handleCommand', error, issuer),
|
|
110
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-CCS-HC0`,
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Client, GatewayIntentBits, Guild, Collection, GuildMember, Message, TextChannel } from 'discord.js'
|
|
2
|
+
import * as dotenv from 'dotenv'
|
|
3
|
+
import { DyFM_Error, DyFM_Log, hour, week } from '@futdevpro/fsm-dynamo'
|
|
4
|
+
import { DyNTS_DiBo_Routines_ControlService } from './dibo-routines.control-service'
|
|
5
|
+
import { Commands_ControlService } from './dibo-commands.control-service'
|
|
6
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service'
|
|
7
|
+
import { DyNTS_DiBo_Main_ControlService } from './dibo-main.control-service'
|
|
8
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const'
|
|
9
|
+
import { DyNTS_DiBo_global_settings } from '../_collections/dibo-global-settings.conts'
|
|
10
|
+
|
|
11
|
+
/* type T_Main_CS = DyNTS_DiBo_Main_ControlService; */
|
|
12
|
+
|
|
13
|
+
export abstract class DyNTS_DiBo_IO_ControlService extends DyNTS_SingletonService {
|
|
14
|
+
|
|
15
|
+
/* static getInstance(): DyNTS_DiBo_IO_ControlService {
|
|
16
|
+
return DyNTS_DiBo_IO_ControlService.getSingletonInstance();
|
|
17
|
+
} */
|
|
18
|
+
|
|
19
|
+
protected readonly mainDiscordBot_CS: DyNTS_DiBo_Main_ControlService;
|
|
20
|
+
|
|
21
|
+
get discordServer(): Guild {
|
|
22
|
+
return this.mainDiscordBot_CS.discordServer;
|
|
23
|
+
}
|
|
24
|
+
get botClientId(): string {
|
|
25
|
+
return this.mainDiscordBot_CS.botClientId;
|
|
26
|
+
}
|
|
27
|
+
get botDisplayName(): string {
|
|
28
|
+
return this.mainDiscordBot_CS.botDisplayName;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
protected abstract getCommandsControlService(): Commands_ControlService;
|
|
32
|
+
protected readonly commands_CS: Commands_ControlService = this.getCommandsControlService();
|
|
33
|
+
|
|
34
|
+
protected constructor() {
|
|
35
|
+
super();
|
|
36
|
+
|
|
37
|
+
if (!this.discordServer) {
|
|
38
|
+
throw new DyFM_Error({
|
|
39
|
+
...this.getDefaultErrorSettings(
|
|
40
|
+
'constructor',
|
|
41
|
+
new Error(
|
|
42
|
+
'Discord server not yet initialized, ' +
|
|
43
|
+
'should only be called after DyNTS_DiBo_Main_ControlService.start'
|
|
44
|
+
),
|
|
45
|
+
'system-init'
|
|
46
|
+
),
|
|
47
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-IO-C000`,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async handleNewMessage(message: Message, issuer: string): Promise<void> {
|
|
53
|
+
try {
|
|
54
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 1) {
|
|
55
|
+
DyFM_Log.log(`incoming message: (${message.author.displayName}) ${message.content}`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const isForYou = await this.getMessageIsForBotToHandle(message, issuer);
|
|
59
|
+
|
|
60
|
+
if (!isForYou) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const isHandledAsCommand = await this.handleIfCommand(message, issuer);
|
|
65
|
+
|
|
66
|
+
if (isHandledAsCommand) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
await this.handleMessage(message, issuer);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
DyFM_Error.logSimple('❌❌ Error handleNewMessage:', error);
|
|
73
|
+
|
|
74
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 1) {
|
|
75
|
+
await message.reply(
|
|
76
|
+
`[SYSTEM|ERROR] Error occurred while handling the message:\n` +
|
|
77
|
+
DyFM_Error.getAnyMessage(error)
|
|
78
|
+
).catch(error => {
|
|
79
|
+
DyFM_Error.logSimple('❌❌ Error sending message to report channel:', error);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
throw new DyFM_Error({
|
|
84
|
+
...this.getDefaultErrorSettings('handleNewMessage', error, issuer),
|
|
85
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-MCS-H0`,
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
abstract handleMessage(message: Message, issuer: string): Promise<void>;
|
|
91
|
+
|
|
92
|
+
async getMessageIsForBotToHandle(message: Message, issuer: string): Promise<boolean> {
|
|
93
|
+
try {
|
|
94
|
+
const messageIsReplyTo: Message = message.channel.messages.cache.get(
|
|
95
|
+
message?.reference?.messageId
|
|
96
|
+
);
|
|
97
|
+
const isReplyForYou = messageIsReplyTo && messageIsReplyTo.author.id === this.botClientId;
|
|
98
|
+
const isPinged = message.content.includes(this.botClientId) ||
|
|
99
|
+
message.cleanContent.includes(`@${this.botDisplayName}`) ||
|
|
100
|
+
isReplyForYou;
|
|
101
|
+
const isOwnMessage = message.author.id === this.botClientId ||
|
|
102
|
+
message.author.displayName === this.botDisplayName;
|
|
103
|
+
const haveSkipFlags = DyNTS_DiBo_global_settings.messageSettings.skipFlags.some(
|
|
104
|
+
flag => message.content.includes(flag)
|
|
105
|
+
);
|
|
106
|
+
const channelName = (message.channel as TextChannel)?.name;
|
|
107
|
+
const isInDefaultChannel = DyNTS_DiBo_global_settings.channelSettings.defaultChannels.includes(
|
|
108
|
+
channelName
|
|
109
|
+
);
|
|
110
|
+
const isDMChannel = message.channel.isDMBased();
|
|
111
|
+
const isAllowedChannel = DyNTS_DiBo_global_settings.channelSettings.allowedChannels.includes(
|
|
112
|
+
channelName
|
|
113
|
+
) || (isDMChannel && DyNTS_DiBo_global_settings.channelSettings.dmIsAllowed);
|
|
114
|
+
const isAllowedUser = DyNTS_DiBo_global_settings.allowedUsers === 'all' ||
|
|
115
|
+
DyNTS_DiBo_global_settings.allowedUsers.includes(message.author.id) ||
|
|
116
|
+
DyNTS_DiBo_global_settings.allowedUsers.includes(message.author.username) ||
|
|
117
|
+
DyNTS_DiBo_global_settings.allowedUsers.includes(message.author.displayName);
|
|
118
|
+
|
|
119
|
+
if (!isAllowedChannel) {
|
|
120
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
121
|
+
DyFM_Log.warn('🚫❌ not allowed channel. END')
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (isOwnMessage) {
|
|
128
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
129
|
+
DyFM_Log.warn('🚫🤖 will not answer; own message')
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (haveSkipFlags) {
|
|
136
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
137
|
+
DyFM_Log.warn('🚫🏳️ not for me; this message have some skip flags:',
|
|
138
|
+
DyNTS_DiBo_global_settings.messageSettings.skipFlags.filter(
|
|
139
|
+
flag => message.content.includes(flag)
|
|
140
|
+
),
|
|
141
|
+
message.content
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (
|
|
149
|
+
isPinged &&
|
|
150
|
+
!isOwnMessage &&
|
|
151
|
+
message.author.bot &&
|
|
152
|
+
!DyNTS_DiBo_global_settings.allowBotsInteractEachOther
|
|
153
|
+
) {
|
|
154
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
155
|
+
DyFM_Log.warn('🚫🤖❌ not for me; this message is from a bot')
|
|
156
|
+
message.reply('[SYSTEM|REFUSE|BOT] You should not ping me!')
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
if (!isPinged && !isOwnMessage && !isInDefaultChannel) {
|
|
163
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
164
|
+
DyFM_Log.warn('🚫 not for me; not pinged, and not my message, and not in default channel')
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!isAllowedUser) {
|
|
171
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
172
|
+
DyFM_Log.warn('🚫❌ not allowed user. END', message.author.username, message.author.displayName)
|
|
173
|
+
message.reply(
|
|
174
|
+
`[SYSTEM|REFUSE|USER] I'm sorry, but I'm not allowed to answer you!`
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!message.channel.isTextBased()) {
|
|
182
|
+
if (DyNTS_DiBo_global_settings.debugLevel >= 2) {
|
|
183
|
+
DyFM_Log.warn('🚫❌ not text based channel. END')
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return true;
|
|
190
|
+
} catch (error) {
|
|
191
|
+
throw new DyFM_Error({
|
|
192
|
+
...this.getDefaultErrorSettings('getMessageIsForBotToHandle', error, issuer),
|
|
193
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-MCS-G0`,
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async handleIfCommand(message: Message, issuer: string): Promise<boolean> {
|
|
199
|
+
try {
|
|
200
|
+
const isCommand = await this.isCommand(message, issuer);
|
|
201
|
+
|
|
202
|
+
if (isCommand) {
|
|
203
|
+
await this.commands_CS.handleCommand(message, issuer);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return Boolean(isCommand);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
throw new DyFM_Error({
|
|
209
|
+
...this.getDefaultErrorSettings('handleIfCommand', error, issuer),
|
|
210
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-IO-HIC0`,
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
async isCommand(message: Message, issuer: string): Promise<boolean> {
|
|
216
|
+
try {
|
|
217
|
+
let haveCommandOperator = false;
|
|
218
|
+
|
|
219
|
+
if (!DyNTS_DiBo_global_settings.commandSettings.commandOperator) {
|
|
220
|
+
haveCommandOperator = true;
|
|
221
|
+
} else if (
|
|
222
|
+
message.content.trim().startsWith(DyNTS_DiBo_global_settings.commandSettings.commandOperator)
|
|
223
|
+
) {
|
|
224
|
+
haveCommandOperator = true;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (!haveCommandOperator) {
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
const commandExists = DyNTS_DiBo_global_settings.commandSettings.commands.find(
|
|
232
|
+
(command) => message.content.trim().startsWith(
|
|
233
|
+
`${DyNTS_DiBo_global_settings.commandSettings.commandOperator}${command.command}`
|
|
234
|
+
)
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
return Boolean(commandExists);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
throw new DyFM_Error({
|
|
240
|
+
...this.getDefaultErrorSettings('isCommand', error, issuer),
|
|
241
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiBo-IO-IC0`,
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|