@futdevpro/nts-dynamo 1.14.7 → 1.14.9
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/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +1 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +18 -2
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.d.ts.map +1 -1
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.js +0 -1
- package/build/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.d.ts +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.js +29 -25
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.d.ts +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.js +63 -23
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.js +50 -33
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.js.map +1 -1
- package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts +3 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts.map +1 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.js +15 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.js.map +1 -0
- package/build/_modules/assistant/_collections/ass.util.d.ts +16 -0
- package/build/_modules/assistant/_collections/ass.util.d.ts.map +1 -0
- package/build/_modules/assistant/_collections/ass.util.js +43 -0
- package/build/_modules/assistant/_collections/ass.util.js.map +1 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts +14 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.js +3 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.js.map +1 -0
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts +23 -0
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass-io.control-service.js +59 -0
- package/build/_modules/assistant/_services/ass-io.control-service.js.map +1 -0
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts +15 -0
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass-main.control-service.js +12 -0
- package/build/_modules/assistant/_services/ass-main.control-service.js.map +1 -0
- package/build/_modules/assistant/_services/ass.service-base.d.ts +31 -0
- package/build/_modules/assistant/_services/ass.service-base.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass.service-base.js +56 -0
- package/build/_modules/assistant/_services/ass.service-base.js.map +1 -0
- package/build/_modules/assistant/index.d.ts +7 -0
- package/build/_modules/assistant/index.d.ts.map +1 -0
- package/build/_modules/assistant/index.js +19 -0
- package/build/_modules/assistant/index.js.map +1 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.d.ts +3 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.js +14 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.js.map +1 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.d.ts +3 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.js +32 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.js.map +1 -0
- package/build/_modules/bot/_collections/bot-operations.util.d.ts +21 -0
- package/build/_modules/bot/_collections/bot-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-operations.util.js +74 -0
- package/build/_modules/bot/_collections/bot-operations.util.js.map +1 -0
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts +7 -0
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts.map +1 -0
- package/build/_modules/bot/_enums/bot-provider.enum.js +11 -0
- package/build/_modules/bot/_enums/bot-provider.enum.js.map +1 -0
- package/build/_modules/bot/_models/bot-channel.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-channel.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-channel.interface.js +3 -0
- package/build/_modules/bot/_models/bot-channel.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.js +3 -0
- package/build/_modules/bot/_models/bot-command.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +79 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.js +3 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts +7 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.js +3 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts +6 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.js +3 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-message.interface.d.ts +15 -0
- package/build/_modules/bot/_models/bot-message.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-message.interface.js +3 -0
- package/build/_modules/bot/_models/bot-message.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-provider.interface.d.ts +60 -0
- package/build/_modules/bot/_models/bot-provider.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-provider.interface.js +3 -0
- package/build/_modules/bot/_models/bot-provider.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-user.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-user.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-user.interface.js +3 -0
- package/build/_modules/bot/_models/bot-user.interface.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js +13 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts +5 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js +19 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts +8 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js +3 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts +53 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js +369 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts +5 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.js +16 -0
- package/build/_modules/bot/_modules/discord-bot/index.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js +13 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts +7 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js +3 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts +40 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js +116 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts +4 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.js +15 -0
- package/build/_modules/bot/_modules/slack-bot/index.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js +13 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts +7 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js +3 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts +40 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js +116 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts +4 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.js +15 -0
- package/build/_modules/bot/_modules/teams-bot/index.js.map +1 -0
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts +15 -0
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-commands.control-service.js +72 -0
- package/build/_modules/bot/_services/bot-commands.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-io.control-service.d.ts +24 -0
- package/build/_modules/bot/_services/bot-io.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-io.control-service.js +207 -0
- package/build/_modules/bot/_services/bot-io.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-main.control-service.d.ts +42 -0
- package/build/_modules/bot/_services/bot-main.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-main.control-service.js +223 -0
- package/build/_modules/bot/_services/bot-main.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts +5 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.js +28 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.js.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts +17 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.js +40 -0
- package/build/_modules/bot/_services/bot-routines.control-service.js.map +1 -0
- package/build/_modules/bot/index.d.ts +21 -0
- package/build/_modules/bot/index.d.ts.map +1 -0
- package/build/_modules/bot/index.js +35 -0
- package/build/_modules/bot/index.js.map +1 -0
- package/build/_modules/defaults/_models/default-user.data-model.d.ts +20 -0
- package/build/_modules/defaults/_models/default-user.data-model.d.ts.map +1 -0
- package/build/_modules/defaults/_models/default-user.data-model.js +73 -0
- package/build/_modules/defaults/_models/default-user.data-model.js.map +1 -0
- package/build/_modules/defaults/_services/default-auth.service.d.ts +51 -0
- package/build/_modules/defaults/_services/default-auth.service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-auth.service.js +159 -0
- package/build/_modules/defaults/_services/default-auth.service.js.map +1 -0
- package/build/_modules/defaults/_services/default-socket-events.service.d.ts +24 -0
- package/build/_modules/defaults/_services/default-socket-events.service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-socket-events.service.js +61 -0
- package/build/_modules/defaults/_services/default-socket-events.service.js.map +1 -0
- package/build/_modules/defaults/_services/default-user.data-service.d.ts +25 -0
- package/build/_modules/defaults/_services/default-user.data-service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-user.data-service.js +88 -0
- package/build/_modules/defaults/_services/default-user.data-service.js.map +1 -0
- package/build/_modules/defaults/index.d.ts +5 -0
- package/build/_modules/defaults/index.d.ts.map +1 -0
- package/build/_modules/defaults/index.js +16 -0
- package/build/_modules/defaults/index.js.map +1 -0
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js +1 -1
- package/build/_modules/discord-bot/_services/dibo-io.control-service.js.map +1 -1
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts +6 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts.map +1 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.js +27 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.js.map +1 -0
- package/build/_modules/messaging/_collections/msg.util.d.ts +25 -0
- package/build/_modules/messaging/_collections/msg.util.d.ts.map +1 -0
- package/build/_modules/messaging/_collections/msg.util.js +63 -0
- package/build/_modules/messaging/_collections/msg.util.js.map +1 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts +23 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts.map +1 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.js +32 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.js.map +1 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts +38 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.js +3 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.js.map +1 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts +29 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.js +110 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-events.service.d.ts +62 -0
- package/build/_modules/messaging/_services/msg-events.service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-events.service.js +204 -0
- package/build/_modules/messaging/_services/msg-events.service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts +26 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.js +126 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-main.control-service.d.ts +62 -0
- package/build/_modules/messaging/_services/msg-main.control-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-main.control-service.js +408 -0
- package/build/_modules/messaging/_services/msg-main.control-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-message.data-service.d.ts +29 -0
- package/build/_modules/messaging/_services/msg-message.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-message.data-service.js +104 -0
- package/build/_modules/messaging/_services/msg-message.data-service.js.map +1 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.d.ts +8 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.d.ts.map +1 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.js +21 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.js.map +1 -0
- package/build/_modules/messaging/index.d.ts +13 -0
- package/build/_modules/messaging/index.d.ts.map +1 -0
- package/build/_modules/messaging/index.js +30 -0
- package/build/_modules/messaging/index.js.map +1 -0
- package/build/_modules/messaging/messaging.controller.d.ts +13 -0
- package/build/_modules/messaging/messaging.controller.d.ts.map +1 -0
- package/build/_modules/messaging/messaging.controller.js +257 -0
- package/build/_modules/messaging/messaging.controller.js.map +1 -0
- package/package.json +71 -3
- package/src/_collections/global-settings.const.ts +2 -0
- package/src/_models/interfaces/global-settings.interface.ts +20 -2
- package/src/_modules/ai/_modules/document-ai/_models/data-models/dai-doc-chunk.data-model.ts +0 -1
- package/src/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.ts +34 -27
- package/src/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.ts +77 -23
- package/src/_modules/ai/_modules/open-ai/_services/oai-document.data-service.ts +59 -33
- package/src/_modules/assistant/_collections/ass-global-settings.const.ts +13 -0
- package/src/_modules/assistant/_collections/ass.util.ts +50 -0
- package/src/_modules/assistant/_models/ass-global-settings.interface.ts +15 -0
- package/src/_modules/assistant/_services/ass-io.control-service.ts +100 -0
- package/src/_modules/assistant/_services/ass-main.control-service.ts +38 -0
- package/src/_modules/assistant/_services/ass.service-base.ts +92 -0
- package/src/_modules/assistant/index.ts +19 -0
- package/src/_modules/bot/_collections/bot-default-commands.const.ts +12 -0
- package/src/_modules/bot/_collections/bot-global-settings.const.ts +39 -0
- package/src/_modules/bot/_collections/bot-operations.util.ts +149 -0
- package/src/_modules/bot/_enums/bot-provider.enum.ts +6 -0
- package/src/_modules/bot/_models/bot-channel.interface.ts +7 -0
- package/src/_modules/bot/_models/bot-command.interface.ts +8 -0
- package/src/_modules/bot/_models/bot-global-settings.interface.ts +87 -0
- package/src/_modules/bot/_models/bot-last-mention-date.interface.ts +6 -0
- package/src/_modules/bot/_models/bot-last-message-date.interface.ts +5 -0
- package/src/_modules/bot/_models/bot-message.interface.ts +14 -0
- package/src/_modules/bot/_models/bot-provider.interface.ts +80 -0
- package/src/_modules/bot/_models/bot-user.interface.ts +7 -0
- package/src/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/discord-bot/_collections/dib.util.ts +20 -0
- package/src/_modules/bot/_modules/discord-bot/_models/dib-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/discord-bot/_services/dib-provider.service.ts +462 -0
- package/src/_modules/bot/_modules/discord-bot/index.ts +15 -0
- package/src/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/slack-bot/_models/slb-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/slack-bot/_services/slb-provider.service.ts +152 -0
- package/src/_modules/bot/_modules/slack-bot/index.ts +14 -0
- package/src/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/teams-bot/_models/teb-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/teams-bot/_services/teb-provider.service.ts +152 -0
- package/src/_modules/bot/_modules/teams-bot/index.ts +14 -0
- package/src/_modules/bot/_services/bot-commands.control-service.ts +126 -0
- package/src/_modules/bot/_services/bot-io.control-service.ts +325 -0
- package/src/_modules/bot/_services/bot-main.control-service.ts +344 -0
- package/src/_modules/bot/_services/bot-provider-factory.service.ts +30 -0
- package/src/_modules/bot/_services/bot-routines.control-service.ts +83 -0
- package/src/_modules/bot/index.ts +36 -0
- package/src/_modules/defaults/_models/default-user.data-model.ts +72 -0
- package/src/_modules/defaults/_services/default-auth.service.ts +177 -0
- package/src/_modules/defaults/_services/default-socket-events.service.ts +61 -0
- package/src/_modules/defaults/_services/default-user.data-service.ts +98 -0
- package/src/_modules/defaults/index.ts +14 -0
- package/src/_modules/discord-bot/_services/dibo-io.control-service.ts +1 -1
- package/src/_modules/messaging/_collections/msg-global-settings.const.ts +27 -0
- package/src/_modules/messaging/_collections/msg.util.ts +83 -0
- package/src/_modules/messaging/_enums/msg-event-key.enum.ts +31 -0
- package/src/_modules/messaging/_models/msg-global-settings.interface.ts +49 -0
- package/src/_modules/messaging/_services/msg-conversation.data-service.ts +146 -0
- package/src/_modules/messaging/_services/msg-events.service.ts +267 -0
- package/src/_modules/messaging/_services/msg-integration.control-service.ts +179 -0
- package/src/_modules/messaging/_services/msg-main.control-service.ts +548 -0
- package/src/_modules/messaging/_services/msg-message.data-service.ts +129 -0
- package/src/_modules/messaging/get-messaging-routing-module.util.ts +26 -0
- package/src/_modules/messaging/index.ts +33 -0
- package/src/_modules/messaging/messaging.controller.ts +370 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DyNTS_Bot_Message } from '../../../_models/bot-message.interface';
|
|
2
|
+
import { DyNTS_Bot_Channel } from '../../../_models/bot-channel.interface';
|
|
3
|
+
import { DyNTS_Bot_User } from '../../../_models/bot-user.interface';
|
|
4
|
+
|
|
5
|
+
// Teams Bot Platform-Specific Types
|
|
6
|
+
// TODO: Replace 'any' with actual Teams SDK types when implementing
|
|
7
|
+
export type DyNTS_TeB_Message = DyNTS_Bot_Message<any>;
|
|
8
|
+
export type DyNTS_TeB_Channel = DyNTS_Bot_Channel<any>;
|
|
9
|
+
export type DyNTS_TeB_User = DyNTS_Bot_User<any>;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { DyNTS_Bot_Provider, DyNTS_Bot_Provider_Config } from '../../../_models/bot-provider.interface';
|
|
2
|
+
import { DyNTS_Bot_LastMessageDate } from '../../../_models/bot-last-message-date.interface';
|
|
3
|
+
import { DyNTS_Bot_LastMentionDate } from '../../../_models/bot-last-mention-date.interface';
|
|
4
|
+
import { DyNTS_Bot_Provider_Type } from '../../../_enums/bot-provider.enum';
|
|
5
|
+
import { DyNTS_TeB_Message, DyNTS_TeB_Channel, DyNTS_TeB_User } from '../_models/teb-platform.types';
|
|
6
|
+
|
|
7
|
+
export class DyNTS_TeB_Provider implements DyNTS_Bot_Provider<
|
|
8
|
+
DyNTS_TeB_Channel,
|
|
9
|
+
DyNTS_TeB_Message,
|
|
10
|
+
DyNTS_TeB_User
|
|
11
|
+
> {
|
|
12
|
+
private isInitialized: boolean = false;
|
|
13
|
+
private config: DyNTS_Bot_Provider_Config;
|
|
14
|
+
|
|
15
|
+
// Event handlers
|
|
16
|
+
private messageHandlers: Array<(message: DyNTS_TeB_Message, issuer: string) => void> = [];
|
|
17
|
+
private readyHandlers: Array<() => void> = [];
|
|
18
|
+
private errorHandlers: Array<(error: Error) => void> = [];
|
|
19
|
+
|
|
20
|
+
async initialize(config: DyNTS_Bot_Provider_Config): Promise<void> {
|
|
21
|
+
this.config = config;
|
|
22
|
+
|
|
23
|
+
if (config.provider !== DyNTS_Bot_Provider_Type.teams) {
|
|
24
|
+
throw new Error(`Invalid provider type: ${config.provider}. Expected 'teams'`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!config.teams) {
|
|
28
|
+
throw new Error('Teams configuration is required');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
this.isInitialized = true;
|
|
32
|
+
// TODO: Initialize Teams client
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async login(token: string): Promise<void> {
|
|
36
|
+
if (!this.isInitialized) {
|
|
37
|
+
throw new Error('Provider not initialized. Call initialize() first.');
|
|
38
|
+
}
|
|
39
|
+
// TODO: Implement Teams login
|
|
40
|
+
throw new Error('Teams provider not yet implemented');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Channel operations
|
|
44
|
+
async getChannelByName(name: string): Promise<DyNTS_TeB_Channel> {
|
|
45
|
+
throw new Error('Teams provider not yet implemented');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async sendMessageToChannelByName(channelName: string, message: string): Promise<DyNTS_TeB_Message> {
|
|
49
|
+
throw new Error('Teams provider not yet implemented');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async getMessagesFromChannelByChannelName(channelName: string, limit?: number): Promise<DyNTS_TeB_Message[]> {
|
|
53
|
+
throw new Error('Teams provider not yet implemented');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async getLastMessageInChannel(channelName: string): Promise<DyNTS_TeB_Message> {
|
|
57
|
+
throw new Error('Teams provider not yet implemented');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async clearChannel(channelId: string): Promise<void> {
|
|
61
|
+
throw new Error('Teams provider not yet implemented');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Message operations
|
|
65
|
+
async sendMessage(channelId: string, content: string): Promise<DyNTS_TeB_Message> {
|
|
66
|
+
throw new Error('Teams provider not yet implemented');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async replyToMessage(messageId: string, channelId: string, content: string): Promise<DyNTS_TeB_Message> {
|
|
70
|
+
throw new Error('Teams provider not yet implemented');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async sendTyping(channelId: string): Promise<void> {
|
|
74
|
+
throw new Error('Teams provider not yet implemented');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async fetchMessages(channelId: string, limit: number): Promise<DyNTS_TeB_Message[]> {
|
|
78
|
+
throw new Error('Teams provider not yet implemented');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async fetchAllMessagesWithPaging(channelId: string, maxFetch?: number): Promise<DyNTS_TeB_Message[]> {
|
|
82
|
+
throw new Error('Teams provider not yet implemented');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async deleteMessage(messageId: string, channelId: string): Promise<void> {
|
|
86
|
+
throw new Error('Teams provider not yet implemented');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// User operations
|
|
90
|
+
async getUserByName(username: string): Promise<DyNTS_TeB_User> {
|
|
91
|
+
throw new Error('Teams provider not yet implemented');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
getUserMention(userId: string): string {
|
|
95
|
+
return `<@${userId}>`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async readMembersInChannel(channelName: string): Promise<DyNTS_TeB_User[]> {
|
|
99
|
+
throw new Error('Teams provider not yet implemented');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async readMemberNamesInChannel(channelName: string): Promise<string[]> {
|
|
103
|
+
throw new Error('Teams provider not yet implemented');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Advanced message queries
|
|
107
|
+
async getLastMessageSentBy(channelName: string, username: string): Promise<DyNTS_TeB_Message> {
|
|
108
|
+
throw new Error('Teams provider not yet implemented');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async getLastMentionOf(channelName: string, username: string): Promise<DyNTS_TeB_Message> {
|
|
112
|
+
throw new Error('Teams provider not yet implemented');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async readLastMessageDatesByMembers(channelName: string, memberNames: string[]): Promise<DyNTS_Bot_LastMessageDate[]> {
|
|
116
|
+
throw new Error('Teams provider not yet implemented');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async readLastMessageWithMemberNamePingInIt(channelName: string, users: DyNTS_TeB_User[]): Promise<DyNTS_Bot_LastMentionDate[]> {
|
|
120
|
+
throw new Error('Teams provider not yet implemented');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Event binding
|
|
124
|
+
onMessage(handler: (message: DyNTS_TeB_Message, issuer: string) => void): void {
|
|
125
|
+
this.messageHandlers.push(handler);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
onReady(handler: () => void): void {
|
|
129
|
+
this.readyHandlers.push(handler);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
onError(handler: (error: Error) => void): void {
|
|
133
|
+
this.errorHandlers.push(handler);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Metadata
|
|
137
|
+
getBotId(): string {
|
|
138
|
+
return 'teams-bot-stub';
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
getBotDisplayName(): string {
|
|
142
|
+
return 'Teams Bot (Stub)';
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
getProviderName(): string {
|
|
146
|
+
return 'teams';
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
isReady(): boolean {
|
|
150
|
+
return this.isInitialized;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Teams Bot Provider
|
|
3
|
+
//
|
|
4
|
+
// This module provides Teams-specific implementation of the Bot provider interface
|
|
5
|
+
//
|
|
6
|
+
|
|
7
|
+
// TYPES
|
|
8
|
+
export * from './_models/teb-platform.types';
|
|
9
|
+
|
|
10
|
+
// SERVICES
|
|
11
|
+
export * from './_services/teb-provider.service';
|
|
12
|
+
|
|
13
|
+
// COLLECTIONS
|
|
14
|
+
export * from './_collections/teb-operations.util';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
|
|
3
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
|
|
4
|
+
import { DyNTS_Bot_Main_ControlService } from './bot-main.control-service';
|
|
5
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
6
|
+
import { DyNTS_Bot_Message } from '../_models/bot-message.interface';
|
|
7
|
+
import { DyNTS_Bot_Global_Settings } from '../_models/bot-global-settings.interface';
|
|
8
|
+
import { DyNTS_Bot_User } from '../_models/bot-user.interface';
|
|
9
|
+
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface';
|
|
10
|
+
import { DyNTS_Bot_Provider, DyNTS_Bot_Provider_Config } from '../_models/bot-provider.interface';
|
|
11
|
+
|
|
12
|
+
export abstract class DyNTS_Bot_Commands_ControlService<
|
|
13
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
14
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
15
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
16
|
+
T_PlatformProvider extends DyNTS_Bot_Provider<
|
|
17
|
+
T_PlatformChannel,
|
|
18
|
+
T_PlatformMessage,
|
|
19
|
+
T_PlatformUser
|
|
20
|
+
> = DyNTS_Bot_Provider<T_PlatformChannel, T_PlatformMessage, T_PlatformUser>
|
|
21
|
+
> extends DyNTS_SingletonService {
|
|
22
|
+
|
|
23
|
+
static getInstance<T_PlatformMessage extends DyNTS_Bot_Message<any>>(): DyNTS_Bot_Commands_ControlService<T_PlatformMessage> {
|
|
24
|
+
return DyNTS_Bot_Commands_ControlService.getSingletonInstance();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected abstract getMainBotControlService(): DyNTS_Bot_Main_ControlService<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_PlatformProvider>;
|
|
28
|
+
protected readonly mainBot_CS: DyNTS_Bot_Main_ControlService<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_PlatformProvider> =
|
|
29
|
+
this.getMainBotControlService();
|
|
30
|
+
|
|
31
|
+
get provider(): T_PlatformProvider {
|
|
32
|
+
return this.mainBot_CS?.provider;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected constructor() {
|
|
36
|
+
super();
|
|
37
|
+
|
|
38
|
+
if (!this.provider) {
|
|
39
|
+
throw new DyFM_Error({
|
|
40
|
+
...this.getDefaultErrorSettings(
|
|
41
|
+
'constructor',
|
|
42
|
+
new Error(
|
|
43
|
+
'Bot provider not yet initialized, ' +
|
|
44
|
+
'should only be called after DyNTS_Bot_Main_ControlService.start'
|
|
45
|
+
),
|
|
46
|
+
'system-init'
|
|
47
|
+
),
|
|
48
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-CCS-C00`,
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async handleCommand(message: T_PlatformMessage, issuer: string): Promise<void> {
|
|
54
|
+
try {
|
|
55
|
+
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Provider_Config;
|
|
56
|
+
let haveCommandOperator = false;
|
|
57
|
+
let msg = message.content.replace(
|
|
58
|
+
`<@${this.mainBot_CS.botClientId}>`, ''
|
|
59
|
+
).trim();
|
|
60
|
+
|
|
61
|
+
if (!botSettings?.commandSettings?.commandOperator) {
|
|
62
|
+
haveCommandOperator = true;
|
|
63
|
+
} else if (
|
|
64
|
+
msg.startsWith(botSettings.commandSettings.commandOperator)
|
|
65
|
+
) {
|
|
66
|
+
haveCommandOperator = true;
|
|
67
|
+
msg = msg.replace(botSettings.commandSettings.commandOperator, '');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!haveCommandOperator) {
|
|
71
|
+
throw new DyFM_Error({
|
|
72
|
+
...this.getDefaultErrorSettings(
|
|
73
|
+
'handleCommand',
|
|
74
|
+
new Error('No command operator found in the message'),
|
|
75
|
+
issuer
|
|
76
|
+
),
|
|
77
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-CCS-HC1`,
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const commandExists = botSettings?.commandSettings?.commands?.find(
|
|
82
|
+
(command) => msg.startsWith(command.command)
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (!commandExists) {
|
|
86
|
+
throw new DyFM_Error({
|
|
87
|
+
...this.getDefaultErrorSettings(
|
|
88
|
+
'handleCommand',
|
|
89
|
+
new Error(`Command not found: "${msg.split(' ')[0]}"`),
|
|
90
|
+
issuer
|
|
91
|
+
),
|
|
92
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-CCS-HC2`,
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (commandExists.permissionNeeded) {
|
|
97
|
+
const permissionNeeded = await commandExists.permissionNeeded(message);
|
|
98
|
+
|
|
99
|
+
if (!permissionNeeded) {
|
|
100
|
+
throw new DyFM_Error({
|
|
101
|
+
...this.getDefaultErrorSettings(
|
|
102
|
+
'handleCommand',
|
|
103
|
+
new Error('Permission needed'),
|
|
104
|
+
issuer
|
|
105
|
+
),
|
|
106
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-CCS-HC3`,
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
await commandExists.commandHandler(message);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
this.provider.replyToMessage(
|
|
114
|
+
message.id,
|
|
115
|
+
message.channelId,
|
|
116
|
+
`Error occurred while handling the command:\n` +
|
|
117
|
+
DyFM_Error.getAnyMessage(error)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
throw new DyFM_Error({
|
|
121
|
+
...this.getDefaultErrorSettings('handleCommand', error, issuer),
|
|
122
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-CCS-HC0`,
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import { DyFM_Error, DyFM_Log, hour, week } from '@futdevpro/fsm-dynamo'
|
|
2
|
+
import { DyNTS_Bot_Routines_ControlService } from './bot-routines.control-service'
|
|
3
|
+
import { DyNTS_Bot_Commands_ControlService } from './bot-commands.control-service'
|
|
4
|
+
import { DyNTS_SingletonService } from '../../../_services/base/singleton.service'
|
|
5
|
+
import { DyNTS_Bot_Main_ControlService } from './bot-main.control-service'
|
|
6
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const'
|
|
7
|
+
import { DyNTS_Bot_Message } from '../_models/bot-message.interface'
|
|
8
|
+
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface'
|
|
9
|
+
import { DyNTS_Bot_User } from '../_models/bot-user.interface'
|
|
10
|
+
import { DyNTS_Bot_Provider } from '../_models/bot-provider.interface'
|
|
11
|
+
import { DyNTS_Bot_Global_Settings } from '../_models/bot-global-settings.interface'
|
|
12
|
+
import { DyNTS_Msg_Integration_ControlService } from '../../messaging/_services/msg-integration.control-service'
|
|
13
|
+
|
|
14
|
+
export abstract class DyNTS_Bot_IO_ControlService<
|
|
15
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
16
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
17
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
18
|
+
T_PlatformProvider extends DyNTS_Bot_Provider<T_PlatformChannel, T_PlatformMessage, T_PlatformUser> = DyNTS_Bot_Provider<T_PlatformChannel, T_PlatformMessage, T_PlatformUser>
|
|
19
|
+
> extends DyNTS_SingletonService {
|
|
20
|
+
|
|
21
|
+
protected abstract getMainBotControlService(): DyNTS_Bot_Main_ControlService<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_PlatformProvider>;
|
|
22
|
+
protected abstract mainBot_CS: DyNTS_Bot_Main_ControlService<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_PlatformProvider>;
|
|
23
|
+
|
|
24
|
+
get provider(): T_PlatformProvider {
|
|
25
|
+
return this.mainBot_CS?.provider;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get botClientId(): string {
|
|
29
|
+
return this.mainBot_CS.botClientId;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get botDisplayName(): string {
|
|
33
|
+
return this.mainBot_CS.botDisplayName;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected abstract getCommandsControlService(): DyNTS_Bot_Commands_ControlService<T_PlatformMessage>;
|
|
37
|
+
protected commands_CS: DyNTS_Bot_Commands_ControlService<T_PlatformMessage>;
|
|
38
|
+
|
|
39
|
+
dontSendErrorReply?: boolean;
|
|
40
|
+
|
|
41
|
+
async start(issuer: string): Promise<void> {
|
|
42
|
+
try {
|
|
43
|
+
this.mainBot_CS = this.getMainBotControlService();
|
|
44
|
+
this.commands_CS = this.getCommandsControlService();
|
|
45
|
+
|
|
46
|
+
if (!this.provider) {
|
|
47
|
+
throw new DyFM_Error({
|
|
48
|
+
...this.getDefaultErrorSettings(
|
|
49
|
+
'constructor',
|
|
50
|
+
new Error(
|
|
51
|
+
'Bot provider not yet initialized, ' +
|
|
52
|
+
'should only be called after DyNTS_Bot_Main_ControlService.start'
|
|
53
|
+
),
|
|
54
|
+
'system-init'
|
|
55
|
+
),
|
|
56
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-IO-C000`,
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
throw new DyFM_Error({
|
|
61
|
+
...this.getDefaultErrorSettings('start', error, issuer),
|
|
62
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-IO-S000`,
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async handleNewMessage(message: T_PlatformMessage, issuer: string): Promise<void> {
|
|
68
|
+
try {
|
|
69
|
+
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
70
|
+
|
|
71
|
+
if (botSettings?.debugLevel >= 1) {
|
|
72
|
+
DyFM_Log.H_log(`incoming message (${message.authorDisplayName}):\n${message.content}`)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const isForYou = await this.getMessageIsForBotToHandle(message, issuer);
|
|
76
|
+
|
|
77
|
+
if (!isForYou) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const isHandledAsCommand = await this.handleIfCommand(message, issuer);
|
|
82
|
+
|
|
83
|
+
if (isHandledAsCommand) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
await this.handleMessage(message, issuer);
|
|
88
|
+
|
|
89
|
+
// Sync message to messaging system if enabled
|
|
90
|
+
try {
|
|
91
|
+
if (DyNTS_global_settings.messaging_settings?.integration?.syncBotMessages) {
|
|
92
|
+
const messagingIntegration = DyNTS_Msg_Integration_ControlService.getInstance();
|
|
93
|
+
|
|
94
|
+
// Find or create conversation for this channel
|
|
95
|
+
const conversation = await messagingIntegration.findOrCreateBotConversation(
|
|
96
|
+
message.channelId,
|
|
97
|
+
this.provider.getProviderName(),
|
|
98
|
+
issuer
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// Sync the message
|
|
102
|
+
await messagingIntegration.syncBotMessage(
|
|
103
|
+
message,
|
|
104
|
+
conversation._id!,
|
|
105
|
+
issuer
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
} catch (syncError) {
|
|
109
|
+
// Log sync error but don't break bot functionality
|
|
110
|
+
DyFM_Log.error('Failed to sync bot message to messaging system', syncError);
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
DyFM_Error.logSimple('❌❌ Error handleNewMessage:', error);
|
|
114
|
+
|
|
115
|
+
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
116
|
+
|
|
117
|
+
if (!this.dontSendErrorReply && botSettings?.debugLevel >= 1) {
|
|
118
|
+
await this.provider.replyToMessage(
|
|
119
|
+
message.id,
|
|
120
|
+
message.channelId,
|
|
121
|
+
`[SYSTEM|ERROR|${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-IO-H0] Error occurred while handling the message:\n` +
|
|
122
|
+
DyFM_Error.getAnyMessage(error)
|
|
123
|
+
).catch(error => {
|
|
124
|
+
DyFM_Error.logSimple('❌❌ Error sending message to report channel:', error);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
throw new DyFM_Error({
|
|
129
|
+
...this.getDefaultErrorSettings('handleNewMessage', error, issuer),
|
|
130
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-H0`,
|
|
131
|
+
})
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
abstract handleMessage(message: T_PlatformMessage, issuer: string): Promise<T_PlatformMessage>;
|
|
136
|
+
|
|
137
|
+
async getMessageIsForBotToHandle(
|
|
138
|
+
message: T_PlatformMessage,
|
|
139
|
+
issuer: string,
|
|
140
|
+
dontRemovePing?: boolean
|
|
141
|
+
): Promise<boolean> {
|
|
142
|
+
try {
|
|
143
|
+
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
144
|
+
|
|
145
|
+
if (!this.provider || !this.mainBot_CS || !this.botClientId) {
|
|
146
|
+
DyFM_Log.H_error(
|
|
147
|
+
'🚫❌ Bot not initialized yet. END wont respond to message:', message.content,
|
|
148
|
+
new Error('Bot not initialized yet').stack
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
await this.start(issuer);
|
|
152
|
+
|
|
153
|
+
if (!this.provider || !this.mainBot_CS || !this.botClientId) {
|
|
154
|
+
DyFM_Log.H_error(
|
|
155
|
+
'🚫❌❌ can not start bot. END wont respond to message:', message.content,
|
|
156
|
+
new Error('can not start bot').stack
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const isReplyForYou = message.replyToMessageId && message.replyToMessageId; // Simplified check
|
|
164
|
+
const isPinged = message.content.includes(this.botClientId) ||
|
|
165
|
+
message.content.includes(`@${this.botDisplayName}`) ||
|
|
166
|
+
isReplyForYou;
|
|
167
|
+
const isOwnMessage = message.authorId === this.botClientId ||
|
|
168
|
+
message.authorDisplayName === this.botDisplayName;
|
|
169
|
+
const haveSkipFlags = botSettings?.messageSettings?.skipFlags?.some(
|
|
170
|
+
flag => message.content.includes(flag)
|
|
171
|
+
) || false;
|
|
172
|
+
const channelName = message.channelName;
|
|
173
|
+
const isDMChannel = message.channelName?.startsWith('DM-'); // Simplified DM detection
|
|
174
|
+
const isInDefaultChannel = botSettings?.channelSettings?.defaultChannels?.includes(
|
|
175
|
+
channelName
|
|
176
|
+
) || (isDMChannel && botSettings?.channelSettings?.dmIsAllowed);
|
|
177
|
+
const isAllowedChannel = botSettings?.channelSettings?.allowedChannels?.includes(
|
|
178
|
+
channelName
|
|
179
|
+
) || (isDMChannel && botSettings?.channelSettings?.dmIsAllowed);
|
|
180
|
+
|
|
181
|
+
if (!isAllowedChannel) {
|
|
182
|
+
if (botSettings?.debugLevel >= 2) {
|
|
183
|
+
DyFM_Log.warn('🚫❌ not allowed channel. END')
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (!isOwnMessage && isPinged) {
|
|
187
|
+
this.provider.replyToMessage(
|
|
188
|
+
message.id,
|
|
189
|
+
message.channelId,
|
|
190
|
+
`[SYSTEM|REFUSE|CHANNEL] I'm sorry, but I'm not allowed to answer you in this channel!`
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (isOwnMessage) {
|
|
198
|
+
if (botSettings?.debugLevel >= 2) {
|
|
199
|
+
DyFM_Log.warn('🚫🤖 will not answer; own message')
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (haveSkipFlags) {
|
|
206
|
+
if (botSettings?.debugLevel >= 2) {
|
|
207
|
+
DyFM_Log.warn('🚫🏳️ not for me; this message have some skip flags:',
|
|
208
|
+
botSettings?.messageSettings?.skipFlags?.filter(
|
|
209
|
+
flag => message.content.includes(flag)
|
|
210
|
+
),
|
|
211
|
+
message.content
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (
|
|
219
|
+
message.isBot &&
|
|
220
|
+
!botSettings?.allowBotsInteractEachOther
|
|
221
|
+
) {
|
|
222
|
+
if (isPinged && botSettings?.debugLevel >= 2) {
|
|
223
|
+
DyFM_Log.warn('🚫🤖❌ not for me; this message is from a bot')
|
|
224
|
+
this.provider.replyToMessage(
|
|
225
|
+
message.id,
|
|
226
|
+
message.channelId,
|
|
227
|
+
'[SYSTEM|REFUSE|BOT] You should not ping me!'
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (!isPinged && !isInDefaultChannel) {
|
|
235
|
+
if (botSettings?.debugLevel >= 2) {
|
|
236
|
+
DyFM_Log.warn('🚫 not for me; not pinged, and not my message, and not in default channel')
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const isAllowedUser = botSettings?.allowedUsers === 'all' ||
|
|
243
|
+
botSettings?.allowedUsers?.includes(message.authorId) ||
|
|
244
|
+
botSettings?.allowedUsers?.includes(message.authorName) ||
|
|
245
|
+
botSettings?.allowedUsers?.includes(message.authorDisplayName);
|
|
246
|
+
|
|
247
|
+
if (!isAllowedUser) {
|
|
248
|
+
if (botSettings?.debugLevel >= 2) {
|
|
249
|
+
DyFM_Log.warn('🚫❌ not allowed user. END', message.authorName, message.authorDisplayName)
|
|
250
|
+
this.provider.replyToMessage(
|
|
251
|
+
message.id,
|
|
252
|
+
message.channelId,
|
|
253
|
+
`[SYSTEM|REFUSE|USER] I'm sorry, but I'm not allowed to answer you!`
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (!message.channelName) {
|
|
261
|
+
if (botSettings?.debugLevel >= 2) {
|
|
262
|
+
DyFM_Log.warn('🚫❌ not text based channel. END')
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return true;
|
|
269
|
+
} catch (error) {
|
|
270
|
+
throw new DyFM_Error({
|
|
271
|
+
...this.getDefaultErrorSettings('getMessageIsForBotToHandle', error, issuer),
|
|
272
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-G0`,
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async handleIfCommand(message: T_PlatformMessage, issuer: string): Promise<boolean> {
|
|
278
|
+
try {
|
|
279
|
+
const isCommand = await this.isCommand(message, issuer);
|
|
280
|
+
|
|
281
|
+
if (isCommand) {
|
|
282
|
+
await this.commands_CS.handleCommand(message, issuer);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return Boolean(isCommand);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
throw new DyFM_Error({
|
|
288
|
+
...this.getDefaultErrorSettings('handleIfCommand', error, issuer),
|
|
289
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-IO-HIC0`,
|
|
290
|
+
})
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async isCommand(message: T_PlatformMessage, issuer: string): Promise<boolean> {
|
|
295
|
+
try {
|
|
296
|
+
const botSettings = DyNTS_global_settings.bot_settings as DyNTS_Bot_Global_Settings;
|
|
297
|
+
let haveCommandOperator = false;
|
|
298
|
+
|
|
299
|
+
if (!botSettings?.commandSettings?.commandOperator) {
|
|
300
|
+
haveCommandOperator = true;
|
|
301
|
+
} else if (
|
|
302
|
+
message.content.trim().startsWith(botSettings.commandSettings.commandOperator)
|
|
303
|
+
) {
|
|
304
|
+
haveCommandOperator = true;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (!haveCommandOperator) {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const commandExists = botSettings?.commandSettings?.commands?.find(
|
|
312
|
+
(command) => message.content.trim().startsWith(
|
|
313
|
+
`${botSettings.commandSettings.commandOperator}${command.command}`
|
|
314
|
+
)
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
return Boolean(commandExists);
|
|
318
|
+
} catch (error) {
|
|
319
|
+
throw new DyFM_Error({
|
|
320
|
+
...this.getDefaultErrorSettings('isCommand', error, issuer),
|
|
321
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-IO-IC0`,
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|