@futdevpro/nts-dynamo 1.14.28 → 1.14.31
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/_modules/ai/_modules/open-ai/_services/{oai-doc-chunk-data.service.d.ts → data-services/oai-doc-chunk-data.service.d.ts} +4 -4
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-chunk-data.service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-doc-chunk-data.service.js → data-services/oai-doc-chunk-data.service.js} +4 -4
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-chunk-data.service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-doc-page.data-service.d.ts → data-services/oai-doc-page.data-service.d.ts} +5 -5
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-page.data-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-doc-page.data-service.js → data-services/oai-doc-page.data-service.js} +3 -3
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-doc-page.data-service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-document.data-service.d.ts → data-services/oai-document.data-service.d.ts} +5 -5
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-document.data-service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-document.data-service.js → data-services/oai-document.data-service.js} +3 -3
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-document.data-service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-vector-data.service.d.ts → data-services/oai-vector-data.service.d.ts} +2 -2
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/{oai-vector-data.service.js → data-services/oai-vector-data.service.js} +3 -3
- package/build/_modules/ai/_modules/open-ai/_services/data-services/oai-vector-data.service.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.d.ts +9 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.js +14 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts +49 -3
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.js +72 -2
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts +61 -6
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js +207 -16
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.d.ts +4 -4
- package/build/_modules/ai/_modules/open-ai/index.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/index.js +6 -5
- package/build/_modules/ai/_modules/open-ai/index.js.map +1 -1
- package/build/_modules/ai/_services/ai-llm.service-base.d.ts +0 -2
- package/build/_modules/ai/_services/ai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_services/ai-provider.service-base.d.ts +2 -1
- package/build/_modules/ai/_services/ai-provider.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_services/ai-provider.service-base.js +2 -1
- package/build/_modules/ai/_services/ai-provider.service-base.js.map +1 -1
- package/build/_modules/assistant/_collections/ass.util.d.ts +2 -2
- package/build/_modules/assistant/_collections/ass.util.d.ts.map +1 -1
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts +5 -9
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts.map +1 -1
- package/build/_modules/assistant/_services/ass-io.control-service.js +9 -10
- package/build/_modules/assistant/_services/ass-io.control-service.js.map +1 -1
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts +26 -10
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts.map +1 -1
- package/build/_modules/assistant/_services/ass-main.control-service.js +49 -4
- package/build/_modules/assistant/_services/ass-main.control-service.js.map +1 -1
- package/build/_modules/assistant/index.d.ts +1 -1
- package/build/_modules/assistant/index.d.ts.map +1 -1
- package/build/_modules/assistant/index.js +1 -1
- package/build/_modules/assistant/index.js.map +1 -1
- package/build/_modules/bot/_models/bot-channel-wrapper.interface.d.ts +17 -0
- package/build/_modules/bot/_models/bot-channel-wrapper.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/{bot-message.interface.js → bot-channel-wrapper.interface.js} +1 -1
- package/build/_modules/bot/_models/bot-channel-wrapper.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts +2 -2
- package/build/_modules/bot/_models/bot-command.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +1 -1
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-message-wrapper.interface.d.ts +16 -13
- package/build/_modules/bot/_models/bot-message-wrapper.interface.d.ts.map +1 -1
- package/build/_modules/bot/_models/bot-user-wrapper.interface.d.ts +17 -0
- package/build/_modules/bot/_models/bot-user-wrapper.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/{bot-channel.interface.js → bot-user-wrapper.interface.js} +1 -1
- package/build/_modules/bot/_models/bot-user-wrapper.interface.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts +0 -7
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js +10 -2
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.d.ts +67 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.js +391 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts +1 -4
- package/build/_modules/bot/_modules/discord-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/discord-bot/index.js +2 -5
- package/build/_modules/bot/_modules/discord-bot/index.js.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.d.ts +3 -3
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.d.ts.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.js +2 -2
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.js.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_models/dyb-platform.types.d.ts +6 -6
- package/build/_modules/bot/_modules/dynamo-bot/_models/dyb-platform.types.d.ts.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.d.ts +59 -0
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/dynamo-bot/_services/{dyb-messaging-provider.service.js → dyb-messaging-provider.control-service.js} +130 -108
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.js.map +1 -0
- package/build/_modules/bot/_modules/dynamo-bot/index.d.ts +1 -2
- package/build/_modules/bot/_modules/dynamo-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/dynamo-bot/index.js +1 -2
- package/build/_modules/bot/_modules/dynamo-bot/index.js.map +1 -1
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts +6 -6
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts.map +1 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.d.ts +55 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.js +132 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts +1 -2
- package/build/_modules/bot/_modules/slack-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/slack-bot/index.js +1 -3
- package/build/_modules/bot/_modules/slack-bot/index.js.map +1 -1
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts +6 -6
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts.map +1 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.d.ts +55 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.js +132 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts +1 -2
- package/build/_modules/bot/_modules/teams-bot/index.d.ts.map +1 -1
- package/build/_modules/bot/_modules/teams-bot/index.js +1 -3
- package/build/_modules/bot/_modules/teams-bot/index.js.map +1 -1
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts +8 -11
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-commands.control-service.js +60 -15
- package/build/_modules/bot/_services/bot-commands.control-service.js.map +1 -1
- package/build/_modules/bot/_services/bot-io.control-service.d.ts +16 -17
- package/build/_modules/bot/_services/bot-io.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-io.control-service.js +60 -51
- package/build/_modules/bot/_services/bot-io.control-service.js.map +1 -1
- package/build/_modules/bot/_services/bot-main.control-service.d.ts +17 -37
- package/build/_modules/bot/_services/bot-main.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-main.control-service.js +107 -263
- package/build/_modules/bot/_services/bot-main.control-service.js.map +1 -1
- package/build/_modules/bot/_services/bot-messaging-provider.service-base.d.ts +70 -0
- package/build/_modules/bot/_services/bot-messaging-provider.service-base.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-messaging-provider.service-base.js +16 -0
- package/build/_modules/bot/_services/bot-messaging-provider.service-base.js.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts +6 -9
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts.map +1 -1
- package/build/_modules/bot/_services/bot-routines.control-service.js +29 -9
- package/build/_modules/bot/_services/bot-routines.control-service.js.map +1 -1
- package/build/_modules/bot/index.d.ts +3 -7
- package/build/_modules/bot/index.d.ts.map +1 -1
- package/build/_modules/bot/index.js +9 -7
- package/build/_modules/bot/index.js.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.d.ts.map +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js +1 -1
- package/build/_modules/discord-assistant/_services/dias-chunk.data-service.js.map +1 -1
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts.map +1 -1
- package/build/_modules/messaging/_collections/msg-global-settings.const.js +0 -5
- package/build/_modules/messaging/_collections/msg-global-settings.const.js.map +1 -1
- package/build/_modules/messaging/_collections/msg.util.d.ts +2 -2
- package/build/_modules/messaging/_collections/msg.util.d.ts.map +1 -1
- package/build/_modules/messaging/_collections/msg.util.js.map +1 -1
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts +0 -9
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts.map +1 -1
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts +0 -25
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts.map +1 -1
- package/build/_modules/messaging/_services/msg-integration.control-service.js +180 -125
- package/build/_modules/messaging/_services/msg-integration.control-service.js.map +1 -1
- package/build/_modules/messaging/index.d.ts +0 -1
- package/build/_modules/messaging/index.d.ts.map +1 -1
- package/build/_modules/messaging/index.js +1 -1
- package/build/_modules/messaging/index.js.map +1 -1
- package/package.json +1 -1
- package/src/_modules/ai/_modules/open-ai/_services/{oai-doc-chunk-data.service.ts → data-services/oai-doc-chunk-data.service.ts} +8 -8
- package/src/_modules/ai/_modules/open-ai/_services/{oai-doc-page.data-service.ts → data-services/oai-doc-page.data-service.ts} +8 -8
- package/src/_modules/ai/_modules/open-ai/_services/{oai-document.data-service.ts → data-services/oai-document.data-service.ts} +7 -7
- package/src/_modules/ai/_modules/open-ai/_services/{oai-vector-data.service.ts → data-services/oai-vector-data.service.ts} +4 -4
- package/src/_modules/ai/_modules/open-ai/_services/oai-embedding.control-service.ts +18 -2
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm-chat.service-base.ts +84 -3
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.ts +243 -8
- package/src/_modules/ai/_modules/open-ai/index.ts +6 -5
- package/src/_modules/ai/_services/ai-llm.service-base.ts +2 -2
- package/src/_modules/ai/_services/ai-provider.service-base.ts +2 -1
- package/src/_modules/assistant/_collections/ass.util.ts +2 -2
- package/src/_modules/assistant/_services/ass-io.control-service.ts +17 -48
- package/src/_modules/assistant/_services/ass-main.control-service.ts +83 -32
- package/src/_modules/assistant/index.ts +1 -1
- package/src/_modules/bot/_models/bot-channel-wrapper.interface.ts +24 -0
- package/src/_modules/bot/_models/bot-command.interface.ts +2 -2
- package/src/_modules/bot/_models/bot-global-settings.interface.ts +1 -1
- package/src/_modules/bot/_models/bot-message-wrapper.interface.ts +18 -18
- package/src/_modules/bot/_models/bot-user-wrapper.interface.ts +35 -0
- package/src/_modules/bot/_modules/discord-bot/_models/dib-platform.types.ts +8 -7
- package/src/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.ts +521 -0
- package/src/_modules/bot/_modules/discord-bot/index.ts +2 -5
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb-operations.util.ts +8 -5
- package/src/_modules/bot/_modules/dynamo-bot/_models/dyb-platform.types.ts +6 -6
- package/src/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.control-service.ts +431 -0
- package/src/_modules/bot/_modules/dynamo-bot/index.ts +1 -2
- package/src/_modules/bot/_modules/slack-bot/_models/slb-platform.types.ts +6 -6
- package/src/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.control-service.ts +186 -0
- package/src/_modules/bot/_modules/slack-bot/index.ts +1 -3
- package/src/_modules/bot/_modules/teams-bot/_models/teb-platform.types.ts +6 -6
- package/src/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.control-service.ts +186 -0
- package/src/_modules/bot/_modules/teams-bot/index.ts +1 -4
- package/src/_modules/bot/_services/bot-commands.control-service.ts +64 -34
- package/src/_modules/bot/_services/bot-io.control-service.ts +86 -95
- package/src/_modules/bot/_services/bot-main.control-service.ts +249 -240
- package/src/_modules/bot/_services/bot-messaging-provider.service-base.ts +152 -0
- package/src/_modules/bot/_services/bot-routines.control-service.ts +39 -44
- package/src/_modules/bot/index.ts +9 -7
- package/src/_modules/discord-assistant/_services/dias-chunk.data-service.ts +1 -1
- package/src/_modules/messaging/README.md +2 -7
- package/src/_modules/messaging/_collections/msg-global-settings.const.ts +0 -6
- package/src/_modules/messaging/_collections/msg.util.ts +2 -2
- package/src/_modules/messaging/_models/msg-global-settings.interface.ts +0 -12
- package/src/_modules/messaging/_services/msg-integration.control-service.ts +180 -179
- package/src/_modules/messaging/index.ts +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.d.ts.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-chunk-data.service.js.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.d.ts.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-doc-page.data-service.js.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.d.ts.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-document.data-service.js.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-vector-data.service.d.ts.map +0 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-vector-data.service.js.map +0 -1
- package/build/_modules/assistant/_services/ass.service-base.d.ts +0 -33
- package/build/_modules/assistant/_services/ass.service-base.d.ts.map +0 -1
- package/build/_modules/assistant/_services/ass.service-base.js +0 -58
- package/build/_modules/assistant/_services/ass.service-base.js.map +0 -1
- package/build/_modules/bot/_collections/bot-operations.util.d.ts +0 -21
- package/build/_modules/bot/_collections/bot-operations.util.d.ts.map +0 -1
- package/build/_modules/bot/_collections/bot-operations.util.js +0 -74
- package/build/_modules/bot/_collections/bot-operations.util.js.map +0 -1
- package/build/_modules/bot/_models/bot-channel.interface.d.ts +0 -8
- package/build/_modules/bot/_models/bot-channel.interface.d.ts.map +0 -1
- package/build/_modules/bot/_models/bot-channel.interface.js.map +0 -1
- package/build/_modules/bot/_models/bot-message.interface.d.ts +0 -15
- package/build/_modules/bot/_models/bot-message.interface.d.ts.map +0 -1
- package/build/_modules/bot/_models/bot-message.interface.js.map +0 -1
- package/build/_modules/bot/_models/bot-messaging-provider.interface.d.ts +0 -68
- package/build/_modules/bot/_models/bot-messaging-provider.interface.d.ts.map +0 -1
- package/build/_modules/bot/_models/bot-messaging-provider.interface.js +0 -3
- package/build/_modules/bot/_models/bot-messaging-provider.interface.js.map +0 -1
- package/build/_modules/bot/_models/bot-user.interface.d.ts +0 -8
- package/build/_modules/bot/_models/bot-user.interface.d.ts.map +0 -1
- package/build/_modules/bot/_models/bot-user.interface.js +0 -3
- package/build/_modules/bot/_models/bot-user.interface.js.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts +0 -11
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js +0 -13
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts +0 -5
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js +0 -19
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.d.ts +0 -56
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.js +0 -379
- package/build/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.d.ts +0 -5
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.d.ts.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.js +0 -26
- package/build/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.js.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.service.d.ts +0 -55
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts +0 -11
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js +0 -13
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.d.ts +0 -41
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.js +0 -119
- package/build/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.js.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts +0 -11
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js +0 -13
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.d.ts +0 -41
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.d.ts.map +0 -1
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.js +0 -119
- package/build/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.js.map +0 -1
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.d.ts +0 -6
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.d.ts.map +0 -1
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.js +0 -47
- package/build/_modules/bot/_services/bot-messaging-provider-factory.service.js.map +0 -1
- package/src/_modules/assistant/_services/ass.service-base.ts +0 -100
- package/src/_modules/bot/_collections/bot-operations.util.ts +0 -149
- package/src/_modules/bot/_models/bot-channel.interface.ts +0 -7
- package/src/_modules/bot/_models/bot-message.interface.ts +0 -14
- package/src/_modules/bot/_models/bot-messaging-provider.interface.ts +0 -88
- package/src/_modules/bot/_models/bot-user.interface.ts +0 -7
- package/src/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.ts +0 -18
- package/src/_modules/bot/_modules/discord-bot/_collections/dib.util.ts +0 -20
- package/src/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.service.ts +0 -475
- package/src/_modules/bot/_modules/dynamo-bot/_collections/dyb.util.ts +0 -26
- package/src/_modules/bot/_modules/dynamo-bot/_services/dyb-messaging-provider.service.ts +0 -403
- package/src/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.ts +0 -18
- package/src/_modules/bot/_modules/slack-bot/_services/slb-messaging-provider.service.ts +0 -156
- package/src/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.ts +0 -18
- package/src/_modules/bot/_modules/teams-bot/_services/teb-messaging-provider.service.ts +0 -156
- package/src/_modules/bot/_services/bot-messaging-provider-factory.service.ts +0 -56
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface DyNTS_Bot_Message<T_MessagingPlatformMessage = any> {
|
|
2
|
-
id: string;
|
|
3
|
-
content: string;
|
|
4
|
-
authorId: string;
|
|
5
|
-
authorName: string;
|
|
6
|
-
authorDisplayName: string;
|
|
7
|
-
channelId: string;
|
|
8
|
-
channelName: string;
|
|
9
|
-
timestamp: number;
|
|
10
|
-
isBot: boolean;
|
|
11
|
-
replyToMessageId?: string;
|
|
12
|
-
mentions: string[]; // user IDs
|
|
13
|
-
rawPlatformMessage: T_MessagingPlatformMessage; // Original platform message for platform-specific operations
|
|
14
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { DyNTS_Bot_Message } from './bot-message.interface';
|
|
2
|
-
import { DyNTS_Bot_Channel } from './bot-channel.interface';
|
|
3
|
-
import { DyNTS_Bot_User } from './bot-user.interface';
|
|
4
|
-
import { DyNTS_Bot_LastMessageDate } from './bot-last-message-date.interface';
|
|
5
|
-
import { DyNTS_Bot_LastMentionDate } from './bot-last-mention-date.interface';
|
|
6
|
-
import { DyNTS_Bot_MessagingProvider_Type } from '../_enums/bot-message-provider.enum';
|
|
7
|
-
import { DyNTS_Bot_Global_Settings } from './bot-global-settings.interface';
|
|
8
|
-
|
|
9
|
-
export interface DyNTS_Bot_MessagingProvider_Config extends DyNTS_Bot_Global_Settings {
|
|
10
|
-
/** Unique identifier for this provider instance (required when using multiple providers) */
|
|
11
|
-
providerId?: string;
|
|
12
|
-
messageProvider: DyNTS_Bot_MessagingProvider_Type;
|
|
13
|
-
messageProviderInstance?: DyNTS_Bot_MessagingProvider;
|
|
14
|
-
discord?: {
|
|
15
|
-
token: string;
|
|
16
|
-
guildId: string;
|
|
17
|
-
clientId: string;
|
|
18
|
-
oauth2Url: string;
|
|
19
|
-
};
|
|
20
|
-
slack?: {
|
|
21
|
-
token: string;
|
|
22
|
-
workspace: string;
|
|
23
|
-
};
|
|
24
|
-
teams?: {
|
|
25
|
-
appId: string;
|
|
26
|
-
appPassword: string;
|
|
27
|
-
tenantId: string;
|
|
28
|
-
};
|
|
29
|
-
dynamo?: {
|
|
30
|
-
defaultConversationId?: string; // Optional default conversation
|
|
31
|
-
botUserId?: string; // Bot user ID in messaging system
|
|
32
|
-
botDisplayName?: string; // Bot display name
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface DyNTS_Bot_MessagingProvider<
|
|
37
|
-
T_MessagingPlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
38
|
-
T_MessagingPlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
39
|
-
T_MessagingPlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>
|
|
40
|
-
> {
|
|
41
|
-
// Initialization
|
|
42
|
-
initialize(config: DyNTS_Bot_MessagingProvider_Config): Promise<void>;
|
|
43
|
-
login(token: string): Promise<void>;
|
|
44
|
-
|
|
45
|
-
// Channel operations
|
|
46
|
-
getChannelByName(name: string): Promise<T_MessagingPlatformChannel>;
|
|
47
|
-
sendMessageToChannelByName(channelName: string, message: string): Promise<T_MessagingPlatformMessage>;
|
|
48
|
-
getMessagesFromChannelByChannelName(channelName: string, limit?: number): Promise<T_MessagingPlatformMessage[]>;
|
|
49
|
-
getLastMessageInChannel(channelName: string): Promise<T_MessagingPlatformMessage>;
|
|
50
|
-
clearChannel(channelId: string): Promise<void>;
|
|
51
|
-
|
|
52
|
-
// Message operations
|
|
53
|
-
sendMessage(channelId: string, content: string): Promise<T_MessagingPlatformMessage>;
|
|
54
|
-
replyToMessage(messageId: string, channelId: string, content: string): Promise<T_MessagingPlatformMessage>;
|
|
55
|
-
sendTyping(channelId: string): Promise<void>;
|
|
56
|
-
fetchMessages(channelId: string, limit: number): Promise<T_MessagingPlatformMessage[]>;
|
|
57
|
-
fetchAllMessagesWithPaging(channelId: string, maxFetch?: number): Promise<T_MessagingPlatformMessage[]>;
|
|
58
|
-
deleteMessage(messageId: string, channelId: string): Promise<void>;
|
|
59
|
-
|
|
60
|
-
// User operations
|
|
61
|
-
getUserByName(username: string): Promise<T_MessagingPlatformUser>;
|
|
62
|
-
getUserMention(userId: string): string;
|
|
63
|
-
readMembersInChannel(channelName: string): Promise<T_MessagingPlatformUser[]>;
|
|
64
|
-
readMemberNamesInChannel(channelName: string): Promise<string[]>;
|
|
65
|
-
|
|
66
|
-
// Advanced message queries
|
|
67
|
-
getLastMessageSentBy(channelName: string, username: string): Promise<T_MessagingPlatformMessage>;
|
|
68
|
-
getLastMentionOf(channelName: string, username: string): Promise<T_MessagingPlatformMessage>;
|
|
69
|
-
readLastMessageDatesByMembers(channelName: string, memberNames: string[]): Promise<DyNTS_Bot_LastMessageDate[]>;
|
|
70
|
-
readLastMessageWithMemberNamePingInIt(channelName: string, users: T_MessagingPlatformUser[]): Promise<DyNTS_Bot_LastMentionDate[]>;
|
|
71
|
-
|
|
72
|
-
// Platform-specific features (optional, may return null/undefined for unsupported platforms)
|
|
73
|
-
getRoleByName?(roleName: string): any;
|
|
74
|
-
getRolePingByName?(roleName: string): Promise<string>;
|
|
75
|
-
getRolePingsByName?(roleNames: string[]): Promise<string>;
|
|
76
|
-
|
|
77
|
-
// Event binding
|
|
78
|
-
onMessage(handler: (message: T_MessagingPlatformMessage, issuer: string, providerId?: string) => void): void;
|
|
79
|
-
onReady(handler: () => void): void;
|
|
80
|
-
onError(handler: (error: Error) => void): void;
|
|
81
|
-
|
|
82
|
-
// Metadata
|
|
83
|
-
getBotId(): string;
|
|
84
|
-
getBotDisplayName(): string;
|
|
85
|
-
getProviderName(): string;
|
|
86
|
-
getProviderId(): string;
|
|
87
|
-
isReady(): boolean;
|
|
88
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DyNTS_Bot_Operations_Util } from '../../../_collections/bot-operations.util';
|
|
2
|
-
import { DyNTS_DiB_Message, DyNTS_DiB_Channel, DyNTS_DiB_User } from '../_models/dib-platform.types';
|
|
3
|
-
import { DyNTS_DiB_MessagingProvider } from '../_services/dib-messaging-provider.service';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Discord Bot Operations Utility
|
|
7
|
-
*
|
|
8
|
-
* Platform-specific implementation of bot operations for Discord
|
|
9
|
-
*/
|
|
10
|
-
export class DyNTS_DiB_Operations_Util extends DyNTS_Bot_Operations_Util<
|
|
11
|
-
DyNTS_DiB_Channel,
|
|
12
|
-
DyNTS_DiB_Message,
|
|
13
|
-
DyNTS_DiB_User,
|
|
14
|
-
DyNTS_DiB_MessagingProvider
|
|
15
|
-
> {
|
|
16
|
-
// Discord-specific operations can be added here
|
|
17
|
-
// All base operations are inherited from the generic class
|
|
18
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
|
-
import { DyNTS_DiB_MessagingProvider } from '../_services/dib-messaging-provider.service';
|
|
3
|
-
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
4
|
-
|
|
5
|
-
export class DyNTS_DiB_Util {
|
|
6
|
-
|
|
7
|
-
static async reportIn(provider: DyNTS_DiB_MessagingProvider): Promise<void> {
|
|
8
|
-
try {
|
|
9
|
-
const reportMessage = `${provider.getBotDisplayName()} report for duty! ` +
|
|
10
|
-
`(v${DyNTS_global_settings.systemVersion} ${DyNTS_global_settings.env_settings?.environment})`;
|
|
11
|
-
|
|
12
|
-
await provider.sendMessageToChannelByName(
|
|
13
|
-
DyNTS_global_settings.bot_settings?.channelSettings?.reportChannelName || 'bot-reports',
|
|
14
|
-
reportMessage
|
|
15
|
-
);
|
|
16
|
-
} catch (error) {
|
|
17
|
-
DyFM_Error.logSimple('Failed to report in', error);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import { Client, GatewayIntentBits, Guild, Collection, GuildMember, Message, Partials, Role, TextChannel } from 'discord.js';
|
|
2
|
-
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
3
|
-
import { DyNTS_Bot_MessagingProvider, DyNTS_Bot_MessagingProvider_Config } from '../../../_models/bot-messaging-provider.interface';
|
|
4
|
-
import { DyNTS_Bot_LastMessageDate } from '../../../_models/bot-last-message-date.interface';
|
|
5
|
-
import { DyNTS_Bot_LastMentionDate } from '../../../_models/bot-last-mention-date.interface';
|
|
6
|
-
import { DyNTS_Bot_MessagingProvider_Type } from '../../../_enums/bot-message-provider.enum';
|
|
7
|
-
import { DyNTS_DiB_Message, DyNTS_DiB_Channel, DyNTS_DiB_User } from '../_models/dib-platform.types';
|
|
8
|
-
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
9
|
-
|
|
10
|
-
export class DyNTS_DiB_MessagingProvider implements DyNTS_Bot_MessagingProvider<
|
|
11
|
-
DyNTS_DiB_Channel,
|
|
12
|
-
DyNTS_DiB_Message,
|
|
13
|
-
DyNTS_DiB_User
|
|
14
|
-
> {
|
|
15
|
-
private client: Client;
|
|
16
|
-
private guild: Guild;
|
|
17
|
-
private channelCache: Map<string, TextChannel>;
|
|
18
|
-
private roleCache: Map<string, Role>;
|
|
19
|
-
private isInitialized: boolean = false;
|
|
20
|
-
private config: DyNTS_Bot_MessagingProvider_Config;
|
|
21
|
-
|
|
22
|
-
// Event handlers
|
|
23
|
-
private messageHandlers: Array<(message: DyNTS_DiB_Message, issuer: string) => void> = [];
|
|
24
|
-
private readyHandlers: Array<() => void> = [];
|
|
25
|
-
private errorHandlers: Array<(error: Error) => void> = [];
|
|
26
|
-
|
|
27
|
-
constructor() {
|
|
28
|
-
this.channelCache = new Map();
|
|
29
|
-
this.roleCache = new Map();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Public accessors for Discord-specific objects (for backward compatibility with CCAP)
|
|
33
|
-
get discordClient(): Client {
|
|
34
|
-
return this.client;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get discordGuild(): Guild {
|
|
38
|
-
return this.guild;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async initialize(config: DyNTS_Bot_MessagingProvider_Config): Promise<void> {
|
|
42
|
-
this.config = config;
|
|
43
|
-
|
|
44
|
-
if (config.messageProvider !== DyNTS_Bot_MessagingProvider_Type.discord) {
|
|
45
|
-
throw new Error(`Invalid provider type: ${config.messageProvider}. Expected 'discord'`);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!config.discord) {
|
|
49
|
-
throw new Error('Discord configuration is required');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
this.client = new Client({
|
|
53
|
-
intents: [
|
|
54
|
-
GatewayIntentBits.Guilds,
|
|
55
|
-
GatewayIntentBits.GuildMembers,
|
|
56
|
-
GatewayIntentBits.GuildMessages,
|
|
57
|
-
GatewayIntentBits.MessageContent,
|
|
58
|
-
GatewayIntentBits.DirectMessages,
|
|
59
|
-
GatewayIntentBits.GuildVoiceStates,
|
|
60
|
-
],
|
|
61
|
-
partials: [
|
|
62
|
-
Partials.Channel,
|
|
63
|
-
],
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
this.isInitialized = true;
|
|
67
|
-
DyFM_Log.success('Discord provider initialized');
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async login(token: string): Promise<void> {
|
|
71
|
-
if (!this.isInitialized) {
|
|
72
|
-
throw new Error('Provider not initialized. Call initialize() first.');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return new Promise((resolve, reject) => {
|
|
76
|
-
this.client.on('ready', async () => {
|
|
77
|
-
if (DyNTS_global_settings.bot_settings?.debugLevel >= 1) {
|
|
78
|
-
DyFM_Log.success(`Discord bot logged in as ${this.client.user?.tag}`);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Get guild
|
|
82
|
-
this.guild = this.client.guilds.cache.get(this.config.discord.guildId);
|
|
83
|
-
if (!this.guild) {
|
|
84
|
-
reject(new Error(`Discord server not found with ID: ${this.config.discord.guildId}`));
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Set up event listeners
|
|
89
|
-
this.setupEventListeners();
|
|
90
|
-
|
|
91
|
-
// Trigger ready handlers
|
|
92
|
-
this.readyHandlers.forEach(handler => handler());
|
|
93
|
-
|
|
94
|
-
resolve();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
this.client.on('error', (error) => {
|
|
98
|
-
this.errorHandlers.forEach(handler => handler(error));
|
|
99
|
-
reject(error);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
this.client.login(token).catch(reject);
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private setupEventListeners(): void {
|
|
107
|
-
this.client.on('messageCreate', (message: Message) => {
|
|
108
|
-
if (message.author.bot) return; // Ignore bot messages
|
|
109
|
-
|
|
110
|
-
const botMessage = this.translateMessage(message);
|
|
111
|
-
this.messageHandlers.forEach(handler => handler(botMessage, 'discord-message'));
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Channel operations
|
|
116
|
-
async getChannelByName(name: string): Promise<DyNTS_DiB_Channel> {
|
|
117
|
-
if (this.channelCache.has(name)) {
|
|
118
|
-
return this.translateChannel(this.channelCache.get(name));
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const channel = this.guild.channels.cache.find(
|
|
122
|
-
(ch) => ch.name === name && ch.isTextBased()
|
|
123
|
-
) as TextChannel;
|
|
124
|
-
|
|
125
|
-
if (!channel) {
|
|
126
|
-
throw new Error(`No text channel found with name "${name}"`);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
this.channelCache.set(name, channel);
|
|
130
|
-
return this.translateChannel(channel);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
async sendMessageToChannelByName(channelName: string, message: string): Promise<DyNTS_DiB_Message> {
|
|
134
|
-
const channel = await this.getChannelByName(channelName);
|
|
135
|
-
const discordChannel = this.channelCache.get(channelName);
|
|
136
|
-
const sentMessage = await discordChannel.send(message);
|
|
137
|
-
return this.translateMessage(sentMessage);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async getMessagesFromChannelByChannelName(channelName: string, limit: number = 100): Promise<DyNTS_DiB_Message[]> {
|
|
141
|
-
const channel = await this.getChannelByName(channelName);
|
|
142
|
-
const discordChannel = this.channelCache.get(channelName);
|
|
143
|
-
const messages = await discordChannel.messages.fetch({ limit });
|
|
144
|
-
return Array.from(messages.values()).map(msg => this.translateMessage(msg));
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async getLastMessageInChannel(channelName: string): Promise<DyNTS_DiB_Message> {
|
|
148
|
-
const channel = await this.getChannelByName(channelName);
|
|
149
|
-
const discordChannel = this.channelCache.get(channelName);
|
|
150
|
-
const messages = await discordChannel.messages.fetch({ limit: 1 });
|
|
151
|
-
const lastMessage = messages.first();
|
|
152
|
-
return lastMessage ? this.translateMessage(lastMessage) : null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
async clearChannel(channelId: string): Promise<void> {
|
|
156
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
157
|
-
if (!channel) {
|
|
158
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
let lastId: string | undefined = undefined;
|
|
162
|
-
let fetched = 0;
|
|
163
|
-
const maxFetch = 1000;
|
|
164
|
-
|
|
165
|
-
while (fetched < maxFetch) {
|
|
166
|
-
const options: { limit: number; before?: string } = { limit: 100 };
|
|
167
|
-
if (lastId) options.before = lastId;
|
|
168
|
-
|
|
169
|
-
const messageCollection: Collection<string, Message> = await channel.messages.fetch(options);
|
|
170
|
-
if (messageCollection.size === 0) break;
|
|
171
|
-
|
|
172
|
-
const deletePromises = Array.from(messageCollection.values()).map(message =>
|
|
173
|
-
message.delete().catch((error) => {
|
|
174
|
-
DyFM_Error.logSimple('Failed to delete message', error);
|
|
175
|
-
})
|
|
176
|
-
);
|
|
177
|
-
|
|
178
|
-
await Promise.all(deletePromises);
|
|
179
|
-
lastId = Array.from(messageCollection.values()).pop()?.id;
|
|
180
|
-
fetched += messageCollection.size;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Message operations
|
|
185
|
-
async sendMessage(channelId: string, content: string): Promise<DyNTS_DiB_Message> {
|
|
186
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
187
|
-
if (!channel) {
|
|
188
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
189
|
-
}
|
|
190
|
-
const message = await channel.send(content);
|
|
191
|
-
return this.translateMessage(message);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
async replyToMessage(messageId: string, channelId: string, content: string): Promise<DyNTS_DiB_Message> {
|
|
195
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
196
|
-
if (!channel) {
|
|
197
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
198
|
-
}
|
|
199
|
-
const message = await channel.messages.fetch(messageId);
|
|
200
|
-
const reply = await message.reply(content);
|
|
201
|
-
return this.translateMessage(reply);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
async sendTyping(channelId: string): Promise<void> {
|
|
205
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
206
|
-
if (!channel) {
|
|
207
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
208
|
-
}
|
|
209
|
-
await channel.sendTyping();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
async fetchMessages(channelId: string, limit: number): Promise<DyNTS_DiB_Message[]> {
|
|
213
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
214
|
-
if (!channel) {
|
|
215
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
216
|
-
}
|
|
217
|
-
const messages = await channel.messages.fetch({ limit });
|
|
218
|
-
return Array.from(messages.values()).map(msg => this.translateMessage(msg));
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
async fetchAllMessagesWithPaging(channelId: string, maxFetch: number = 1000): Promise<DyNTS_DiB_Message[]> {
|
|
222
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
223
|
-
if (!channel) {
|
|
224
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
let lastId: string | undefined = undefined;
|
|
228
|
-
let fetched = 0;
|
|
229
|
-
const allMessages: DyNTS_DiB_Message[] = [];
|
|
230
|
-
|
|
231
|
-
while (fetched < maxFetch) {
|
|
232
|
-
const options: { limit: number; before?: string } = { limit: 100 };
|
|
233
|
-
if (lastId) options.before = lastId;
|
|
234
|
-
|
|
235
|
-
const messageCollection: Collection<string, Message> = await channel.messages.fetch(options);
|
|
236
|
-
if (messageCollection.size === 0) break;
|
|
237
|
-
|
|
238
|
-
Array.from(messageCollection.values()).forEach((msg: Message) => {
|
|
239
|
-
allMessages.push(this.translateMessage(msg));
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
lastId = Array.from(messageCollection.values()).pop()?.id;
|
|
243
|
-
fetched += messageCollection.size;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return allMessages;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
async deleteMessage(messageId: string, channelId: string): Promise<void> {
|
|
250
|
-
const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
251
|
-
if (!channel) {
|
|
252
|
-
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
253
|
-
}
|
|
254
|
-
const message = await channel.messages.fetch(messageId);
|
|
255
|
-
await message.delete();
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
// User operations
|
|
259
|
-
async getUserByName(username: string): Promise<DyNTS_DiB_User> {
|
|
260
|
-
const member = this.guild.members.cache.find(m => m.user.username === username);
|
|
261
|
-
if (!member) {
|
|
262
|
-
throw new Error(`User not found with username: ${username}`);
|
|
263
|
-
}
|
|
264
|
-
return this.translateUser(member);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
getUserMention(userId: string): string {
|
|
268
|
-
return `<@${userId}>`;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
async readMembersInChannel(channelName: string): Promise<DyNTS_DiB_User[]> {
|
|
272
|
-
const channel = await this.getChannelByName(channelName);
|
|
273
|
-
const discordChannel = this.channelCache.get(channelName);
|
|
274
|
-
const members = await this.guild.members.fetch();
|
|
275
|
-
|
|
276
|
-
const allowedMembers = members.filter((member) =>
|
|
277
|
-
discordChannel.permissionsFor(member)?.has('ViewChannel')
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
return Array.from(allowedMembers.values()).map(member => this.translateUser(member));
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
async readMemberNamesInChannel(channelName: string): Promise<string[]> {
|
|
284
|
-
const members = await this.readMembersInChannel(channelName);
|
|
285
|
-
return members.map(member => member.username);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// Advanced message queries
|
|
289
|
-
async getLastMessageSentBy(channelName: string, username: string): Promise<DyNTS_DiB_Message> {
|
|
290
|
-
const messages = await this.fetchAllMessagesWithPaging(
|
|
291
|
-
(await this.getChannelByName(channelName)).id,
|
|
292
|
-
1000
|
|
293
|
-
);
|
|
294
|
-
|
|
295
|
-
return messages.find(msg => msg.authorName === username) || null;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
async getLastMentionOf(channelName: string, username: string): Promise<DyNTS_DiB_Message> {
|
|
299
|
-
const messages = await this.fetchAllMessagesWithPaging(
|
|
300
|
-
(await this.getChannelByName(channelName)).id,
|
|
301
|
-
1000
|
|
302
|
-
);
|
|
303
|
-
|
|
304
|
-
return messages.find(msg =>
|
|
305
|
-
msg.content.includes(`@${username}`) ||
|
|
306
|
-
msg.content.includes(`<@${username}>`)
|
|
307
|
-
) || null;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
async readLastMessageDatesByMembers(channelName: string, memberNames: string[]): Promise<DyNTS_Bot_LastMessageDate[]> {
|
|
311
|
-
const channel = await this.getChannelByName(channelName);
|
|
312
|
-
const messages = await this.fetchAllMessagesWithPaging(channel.id, 1000);
|
|
313
|
-
|
|
314
|
-
const memberStatus: Record<string, { lastMessageDate: Date | null, allMessages: number }> = {};
|
|
315
|
-
memberNames.forEach(name => {
|
|
316
|
-
memberStatus[name] = { lastMessageDate: null, allMessages: 0 };
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
const cutoffTime = Date.now() - (3 * 7 * 24 * 60 * 60 * 1000); // 3 weeks
|
|
320
|
-
|
|
321
|
-
messages.forEach((message) => {
|
|
322
|
-
if (message.timestamp < cutoffTime) return;
|
|
323
|
-
|
|
324
|
-
const author = message.authorName;
|
|
325
|
-
if (memberStatus[author] !== undefined) {
|
|
326
|
-
memberStatus[author].allMessages++;
|
|
327
|
-
if (!memberStatus[author].lastMessageDate) {
|
|
328
|
-
memberStatus[author].lastMessageDate = new Date(message.timestamp);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
return memberNames.map((memberName) => {
|
|
334
|
-
const status = memberStatus[memberName];
|
|
335
|
-
return {
|
|
336
|
-
memberName: memberName,
|
|
337
|
-
allMessages: status.allMessages,
|
|
338
|
-
lastMessageDate: status.lastMessageDate
|
|
339
|
-
};
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
async readLastMessageWithMemberNamePingInIt(channelName: string, users: DyNTS_DiB_User[]): Promise<DyNTS_Bot_LastMentionDate[]> {
|
|
344
|
-
const channel = await this.getChannelByName(channelName);
|
|
345
|
-
const messages = await this.fetchAllMessagesWithPaging(channel.id, 1000);
|
|
346
|
-
|
|
347
|
-
const memberStatus: Record<string, { lastMentionDate: Date | null, allMentions: number }> = {};
|
|
348
|
-
users.forEach(user => {
|
|
349
|
-
memberStatus[user.username] = { lastMentionDate: null, allMentions: 0 };
|
|
350
|
-
});
|
|
351
|
-
|
|
352
|
-
const cutoffTime = Date.now() - (3 * 7 * 24 * 60 * 60 * 1000); // 3 weeks
|
|
353
|
-
|
|
354
|
-
messages.forEach((message) => {
|
|
355
|
-
if (message.timestamp < cutoffTime) return;
|
|
356
|
-
|
|
357
|
-
users.forEach(user => {
|
|
358
|
-
if (
|
|
359
|
-
message.content.includes(`@${user.id}`) &&
|
|
360
|
-
!memberStatus[user.username].lastMentionDate
|
|
361
|
-
) {
|
|
362
|
-
memberStatus[user.username].lastMentionDate = new Date(message.timestamp);
|
|
363
|
-
memberStatus[user.username].allMentions++;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
return users.map((user) => {
|
|
369
|
-
const status = memberStatus[user.username];
|
|
370
|
-
return {
|
|
371
|
-
memberId: user.id,
|
|
372
|
-
memberName: user.username,
|
|
373
|
-
allMentions: status.allMentions,
|
|
374
|
-
lastMentionDate: status.lastMentionDate
|
|
375
|
-
};
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Discord-specific features
|
|
380
|
-
getRoleByName(roleName: string): Role {
|
|
381
|
-
if (this.roleCache.has(roleName)) {
|
|
382
|
-
return this.roleCache.get(roleName);
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
const role = this.guild.roles.cache.find(r => r.name === roleName);
|
|
386
|
-
if (role) {
|
|
387
|
-
this.roleCache.set(roleName, role);
|
|
388
|
-
}
|
|
389
|
-
return role;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
async getRolePingByName(roleName: string): Promise<string> {
|
|
393
|
-
const role = this.getRoleByName(roleName);
|
|
394
|
-
return role ? `<@&${role.id}>` : '';
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
async getRolePingsByName(roleNames: string[]): Promise<string> {
|
|
398
|
-
const pings: string[] = await Promise.all(
|
|
399
|
-
roleNames.map(roleName => this.getRolePingByName(roleName))
|
|
400
|
-
);
|
|
401
|
-
return pings.join(' ');
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// Event binding
|
|
405
|
-
onMessage(handler: (message: DyNTS_DiB_Message, issuer: string) => void): void {
|
|
406
|
-
this.messageHandlers.push(handler);
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
onReady(handler: () => void): void {
|
|
410
|
-
this.readyHandlers.push(handler);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
onError(handler: (error: Error) => void): void {
|
|
414
|
-
this.errorHandlers.push(handler);
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
// Metadata
|
|
418
|
-
getBotId(): string {
|
|
419
|
-
return this.client?.user?.id;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
getBotDisplayName(): string {
|
|
423
|
-
return this.client?.user?.displayName;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
getProviderName(): string {
|
|
427
|
-
return 'discord';
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
getProviderId(): string {
|
|
431
|
-
return this.config?.providerId || this.getProviderName();
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
isReady(): boolean {
|
|
435
|
-
return this.isInitialized && this.client?.readyAt !== null;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
// Translation methods
|
|
439
|
-
private translateMessage(discordMessage: Message): DyNTS_DiB_Message {
|
|
440
|
-
return {
|
|
441
|
-
id: discordMessage.id,
|
|
442
|
-
content: discordMessage.content,
|
|
443
|
-
authorId: discordMessage.author.id,
|
|
444
|
-
authorName: discordMessage.author.username,
|
|
445
|
-
authorDisplayName: discordMessage.author.displayName,
|
|
446
|
-
channelId: discordMessage.channelId,
|
|
447
|
-
channelName: (discordMessage.channel as TextChannel)?.name || 'unknown',
|
|
448
|
-
timestamp: discordMessage.createdTimestamp,
|
|
449
|
-
isBot: discordMessage.author.bot,
|
|
450
|
-
replyToMessageId: discordMessage.reference?.messageId,
|
|
451
|
-
mentions: Array.from(discordMessage.mentions.users.keys()),
|
|
452
|
-
rawPlatformMessage: discordMessage
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
private translateChannel(discordChannel: TextChannel): DyNTS_DiB_Channel {
|
|
457
|
-
return {
|
|
458
|
-
id: discordChannel.id,
|
|
459
|
-
name: discordChannel.name,
|
|
460
|
-
isTextBased: discordChannel.isTextBased(),
|
|
461
|
-
isDM: discordChannel.isDMBased(),
|
|
462
|
-
rawPlatformChannel: discordChannel
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
private translateUser(discordMember: GuildMember): DyNTS_DiB_User {
|
|
467
|
-
return {
|
|
468
|
-
id: discordMember.user.id,
|
|
469
|
-
username: discordMember.user.username,
|
|
470
|
-
displayName: discordMember.displayName,
|
|
471
|
-
isBot: discordMember.user.bot,
|
|
472
|
-
rawPlatformUser: discordMember
|
|
473
|
-
};
|
|
474
|
-
}
|
|
475
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
|
-
import { DyNTS_DyB_MessagingProvider } from '../_services/dyb-messaging-provider.service';
|
|
3
|
-
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
4
|
-
|
|
5
|
-
export class DyNTS_DyB_Util {
|
|
6
|
-
|
|
7
|
-
static async reportIn(provider: DyNTS_DyB_MessagingProvider): Promise<void> {
|
|
8
|
-
try {
|
|
9
|
-
const reportMessage = `${provider.getBotDisplayName()} report for duty! ` +
|
|
10
|
-
`(v${DyNTS_global_settings.systemVersion} ${DyNTS_global_settings.env_settings?.environment})`;
|
|
11
|
-
|
|
12
|
-
// Try to send to default conversation if configured
|
|
13
|
-
const config = provider.getConfig();
|
|
14
|
-
if (config?.dynamo?.defaultConversationId) {
|
|
15
|
-
await provider.sendMessage(
|
|
16
|
-
config.dynamo.defaultConversationId,
|
|
17
|
-
reportMessage
|
|
18
|
-
);
|
|
19
|
-
} else {
|
|
20
|
-
DyFM_Log.info('Dynamo bot initialized - no default conversation configured for report');
|
|
21
|
-
}
|
|
22
|
-
} catch (error) {
|
|
23
|
-
DyFM_Error.logSimple('Failed to report in', error);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|