@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
package/src/_modules/bot/_modules/discord-bot/_services/dib-messaging-provider.control-service.ts
ADDED
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import { Client, GatewayIntentBits, Guild, Collection, GuildMember, Message, Partials, Role, TextChannel, Channel, DMChannel } from 'discord.js';
|
|
2
|
+
import { DyFM_AnyError, DyFM_Error, DyFM_Log, week } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DyNTS_Bot_MessagingProvider_ServiceBase, DyNTS_Bot_MessagingProvider_Config } from '../../../_services/bot-messaging-provider.service-base';
|
|
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_global_settings } from '../../../../../_collections/global-settings.const';
|
|
8
|
+
import { DyNTS_Bot_ChannelWrapper } from '../../../_models/bot-channel-wrapper.interface';
|
|
9
|
+
import { DyNTS_Bot_MessageWrapper } from '../../../_models/bot-message-wrapper.interface';
|
|
10
|
+
import { DyNTS_Bot_UserWrapper } from '../../../_models/bot-user-wrapper.interface';
|
|
11
|
+
|
|
12
|
+
export type DyNTS_DiB_Message = DyNTS_Bot_MessageWrapper<Message>;
|
|
13
|
+
export type DyNTS_DiB_Channel = DyNTS_Bot_ChannelWrapper<Channel>;
|
|
14
|
+
export type DyNTS_DiB_User = DyNTS_Bot_UserWrapper<GuildMember>;
|
|
15
|
+
|
|
16
|
+
export interface Discord_MessagingProviderConfig extends DyNTS_Bot_MessagingProvider_Config {
|
|
17
|
+
token: string;
|
|
18
|
+
guildId: string;
|
|
19
|
+
clientId: string;
|
|
20
|
+
oauth2Url: string;
|
|
21
|
+
intents: GatewayIntentBits[];
|
|
22
|
+
partials: Partials[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class DyNTS_DiB_MessagingProvider_ControlService extends DyNTS_Bot_MessagingProvider_ServiceBase<
|
|
26
|
+
Channel,
|
|
27
|
+
Message,
|
|
28
|
+
GuildMember,
|
|
29
|
+
Discord_MessagingProviderConfig,
|
|
30
|
+
Role
|
|
31
|
+
> {
|
|
32
|
+
readonly name = 'discord';
|
|
33
|
+
readonly type = DyNTS_Bot_MessagingProvider_Type.discord;
|
|
34
|
+
|
|
35
|
+
get botId(): string {
|
|
36
|
+
return this.client.user?.id;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get botDisplayName(): string {
|
|
40
|
+
return this.client.user?.displayName;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override readonly config: Discord_MessagingProviderConfig;
|
|
44
|
+
|
|
45
|
+
private client: Client;
|
|
46
|
+
private guild: Guild;
|
|
47
|
+
|
|
48
|
+
constructor(
|
|
49
|
+
setConfig: Discord_MessagingProviderConfig
|
|
50
|
+
) {
|
|
51
|
+
super();
|
|
52
|
+
|
|
53
|
+
this.config = setConfig;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Public accessors for Discord-specific objects (for backward compatibility with CCAP)
|
|
57
|
+
get discordClient(): Client {
|
|
58
|
+
return this.client;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get discordGuild(): Guild {
|
|
62
|
+
return this.guild;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async setup(issuer: string): Promise<void> {
|
|
66
|
+
try {
|
|
67
|
+
this.client = new Client({
|
|
68
|
+
intents: this.config.intents,
|
|
69
|
+
partials: this.config.partials,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
} catch (error) {
|
|
73
|
+
DyFM_Error.logSimple('Error during Discord bot setup:', error);
|
|
74
|
+
|
|
75
|
+
throw new DyFM_Error({
|
|
76
|
+
...this.getDefaultErrorSettings('setup', error, issuer),
|
|
77
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiB-MessagingProvider-S000`,
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async start(issuer: string): Promise<void> {
|
|
83
|
+
try {
|
|
84
|
+
if (!this.client) {
|
|
85
|
+
throw new Error('Discord client not initialized. Call setup() first.');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
this.client.on('ready', async () => {
|
|
90
|
+
if (DyNTS_global_settings.bot_settings?.debugLevel >= 1) {
|
|
91
|
+
DyFM_Log.success(`Discord bot logged in as ${this.client.user?.tag}`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Get guild
|
|
95
|
+
this.guild = this.client.guilds.cache.get(this.config.guildId);
|
|
96
|
+
if (!this.guild) {
|
|
97
|
+
reject(new Error(`Discord server not found with ID: ${this.config.guildId}`));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
resolve();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
this.client.login(this.config.token).catch(reject);
|
|
105
|
+
});
|
|
106
|
+
} catch (error) {
|
|
107
|
+
DyFM_Error.logSimple('Error during Discord bot start:', error);
|
|
108
|
+
|
|
109
|
+
throw new DyFM_Error({
|
|
110
|
+
...this.getDefaultErrorSettings('start', error, issuer),
|
|
111
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-DiB-MessagingProvider-S001`,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async getChannelByName(name: string): Promise<DyNTS_DiB_Channel> {
|
|
117
|
+
if (this.channelCache.has(name)) {
|
|
118
|
+
return this.wrapChannel(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.wrapChannel(channel);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async getChannelById(id: string): Promise<DyNTS_DiB_Channel> {
|
|
134
|
+
const channel = this.guild.channels.cache.get(id) as TextChannel;
|
|
135
|
+
if (!channel) {
|
|
136
|
+
throw new Error(`No text channel found with ID "${id}"`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!this.channelCache.has(channel.name)) {
|
|
140
|
+
this.channelCache.set(channel.name, channel);
|
|
141
|
+
}
|
|
142
|
+
return this.wrapChannel(channel);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async sendMessageToChannelByName(channelName: string, message: string): Promise<DyNTS_DiB_Message> {
|
|
146
|
+
const discordChannel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
147
|
+
|
|
148
|
+
if (!discordChannel.rawPlatformChannel.isTextBased()) {
|
|
149
|
+
throw new Error(`Channel "${channelName}" is not a text channel`);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const sentMessage: Message = await (discordChannel.rawPlatformChannel as TextChannel).send(message);
|
|
153
|
+
|
|
154
|
+
return this.wrapMessage(sentMessage);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async getMessagesFromChannelByChannelName(channelName: string, limit: number = 100): Promise<DyNTS_DiB_Message[]> {
|
|
158
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
159
|
+
|
|
160
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
161
|
+
throw new Error(`Channel "${channelName}" is not a text channel`);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const messages: Collection<string, Message> = await (channel.rawPlatformChannel as TextChannel).messages.fetch({
|
|
165
|
+
limit: limit
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
return Array.from(messages.values()).map((msg: Message) => this.wrapMessage(msg));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async getLastMessageInChannel(channelName: string): Promise<DyNTS_DiB_Message> {
|
|
172
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
173
|
+
|
|
174
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
175
|
+
throw new Error(`Channel "${channelName}" is not a text channel`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const messages: Collection<string, Message> = await (channel.rawPlatformChannel as TextChannel).messages.fetch({
|
|
179
|
+
limit: 1
|
|
180
|
+
});
|
|
181
|
+
const lastMessage: Message = messages.first();
|
|
182
|
+
|
|
183
|
+
return lastMessage ? this.wrapMessage(lastMessage) : null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async clearChannel(channel: DyNTS_DiB_Channel): Promise<void> {
|
|
187
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
188
|
+
throw new Error(`Channel "${channel.name}" is not a text channel`);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
let lastId: string | undefined = undefined;
|
|
192
|
+
let fetched: number = 0;
|
|
193
|
+
const maxFetch: number = 1000;
|
|
194
|
+
|
|
195
|
+
while (fetched < maxFetch) {
|
|
196
|
+
const options: { limit: number; before?: string } = { limit: 100 };
|
|
197
|
+
if (lastId) {
|
|
198
|
+
options.before = lastId;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const messageCollection: Collection<string, Message> = await channel.rawPlatformChannel.messages.fetch(options);
|
|
202
|
+
if (messageCollection.size === 0) {
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const deletePromises = Array.from(messageCollection.values()).map((message: Message) =>
|
|
207
|
+
message.delete().catch((error) => {
|
|
208
|
+
DyFM_Error.logSimple('Failed to delete message', error);
|
|
209
|
+
})
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
await Promise.all(deletePromises);
|
|
213
|
+
lastId = Array.from(messageCollection.values()).pop()?.id;
|
|
214
|
+
fetched += messageCollection.size;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Message operations
|
|
219
|
+
async sendMessage(channel: DyNTS_DiB_Channel, content: string): Promise<DyNTS_DiB_Message> {
|
|
220
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
221
|
+
throw new Error(`Channel "${channel.name}" is not a text channel`);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const message: Message = await (channel.rawPlatformChannel as TextChannel).send(content);
|
|
225
|
+
return this.wrapMessage(message);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
async replyToMessage(message: DyNTS_DiB_Message, content: string): Promise<DyNTS_DiB_Message> {
|
|
229
|
+
/* const channel = this.guild.channels.cache.get(channelId) as TextChannel;
|
|
230
|
+
if (!channel) {
|
|
231
|
+
throw new Error(`Channel not found with ID: ${channelId}`);
|
|
232
|
+
}
|
|
233
|
+
const message = await channel.messages.fetch(messageId); */
|
|
234
|
+
if (!message.rawPlatformMessage.channel.isTextBased()) {
|
|
235
|
+
throw new Error(`Message "${message.id}" is not a text message`);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const reply: Message= await message.rawPlatformMessage.reply(content);
|
|
239
|
+
return this.wrapMessage(reply);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
async sendTyping(channel: DyNTS_DiB_Channel): Promise<void> {
|
|
243
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
244
|
+
throw new Error(`Channel "${channel.name}" is not a text channel`);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
await (channel.rawPlatformChannel as TextChannel).sendTyping();
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async fetchMessages(channel: DyNTS_DiB_Channel, limit: number): Promise<DyNTS_DiB_Message[]> {
|
|
251
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
252
|
+
throw new Error(`Channel "${channel.name}" is not a text channel`);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const messages: Collection<string, Message> = await (channel.rawPlatformChannel as TextChannel).messages.fetch({
|
|
256
|
+
limit: limit
|
|
257
|
+
});
|
|
258
|
+
return Array.from(messages.values()).map((msg: Message) => this.wrapMessage(msg));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async fetchMessagesById(id: string, limit: number): Promise<DyNTS_DiB_Message[]> {
|
|
262
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelById(id);
|
|
263
|
+
return this.fetchMessages(channel, limit);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
async fetchMessagesForMessage(message: DyNTS_DiB_Message, limit: number): Promise<DyNTS_DiB_Message[]> {
|
|
267
|
+
if (!message.rawPlatformMessage.channel.isTextBased()) {
|
|
268
|
+
throw new Error(`Message "${message.id}" is not a text message`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const messages: Collection<string, Message> = await message.rawPlatformMessage.channel.messages.fetch({
|
|
272
|
+
limit: limit
|
|
273
|
+
});
|
|
274
|
+
return Array.from(messages.values()).map((msg: Message) => this.wrapMessage(msg));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async fetchAllMessagesWithPaging(channel: DyNTS_DiB_Channel, maxFetch: number = 1000): Promise<DyNTS_DiB_Message[]> {
|
|
278
|
+
if (!channel.rawPlatformChannel.isTextBased()) {
|
|
279
|
+
throw new Error(`Channel "${channel.name}" is not a text channel`);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
let lastId: string | undefined = undefined;
|
|
283
|
+
let fetched: number = 0;
|
|
284
|
+
const allMessages: DyNTS_DiB_Message[] = [];
|
|
285
|
+
|
|
286
|
+
while (fetched < maxFetch) {
|
|
287
|
+
const options: { limit: number; before?: string } = { limit: 100 };
|
|
288
|
+
if (lastId) options.before = lastId;
|
|
289
|
+
|
|
290
|
+
const messageCollection: Collection<string, Message> = await channel.rawPlatformChannel.messages.fetch(options);
|
|
291
|
+
if (messageCollection.size === 0) break;
|
|
292
|
+
|
|
293
|
+
Array.from(messageCollection.values()).forEach((msg: Message) => {
|
|
294
|
+
allMessages.push(this.wrapMessage(msg));
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
lastId = Array.from(messageCollection.values()).pop()?.id;
|
|
298
|
+
fetched += messageCollection.size;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return allMessages;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
async deleteMessage(message: DyNTS_DiB_Message): Promise<void> {
|
|
305
|
+
await message.rawPlatformMessage.delete();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// User operations
|
|
309
|
+
async getUserByName(username: string): Promise<DyNTS_DiB_User> {
|
|
310
|
+
const member: GuildMember = this.guild.members.cache.find((m: GuildMember) => m.user.username === username);
|
|
311
|
+
|
|
312
|
+
if (!member) {
|
|
313
|
+
throw new Error(`User not found with username: ${username}`);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return this.wrapUser(member);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
getUserMention(userId: string): string {
|
|
320
|
+
return `<@${userId}>`;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
async readMembersInChannel(channelName: string): Promise<DyNTS_DiB_User[]> {
|
|
324
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
325
|
+
const members: Collection<string, GuildMember> = await this.guild.members.fetch();
|
|
326
|
+
|
|
327
|
+
const allowedMembers: Collection<string, GuildMember> = members.filter((member: GuildMember) =>
|
|
328
|
+
channel.rawPlatformChannel.isTextBased() &&
|
|
329
|
+
(channel.rawPlatformChannel as TextChannel).permissionsFor(member)?.has('ViewChannel')
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
return Array.from(allowedMembers.values()).map((member: GuildMember) => this.wrapUser(member));
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
async readMemberNamesInChannel(channelName: string): Promise<string[]> {
|
|
336
|
+
const members: DyNTS_DiB_User[] = await this.readMembersInChannel(channelName);
|
|
337
|
+
return members.map((member: DyNTS_DiB_User) => member.username);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Advanced message queries
|
|
341
|
+
async getLastMessageSentBy(channelName: string, username: string): Promise<DyNTS_DiB_Message> {
|
|
342
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
343
|
+
const messages: DyNTS_DiB_Message[] = await this.fetchAllMessagesWithPaging(channel, 1000);
|
|
344
|
+
|
|
345
|
+
return messages.find((msg: DyNTS_DiB_Message) => msg.authorName === username) || null;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
async getLastMentionOf(channelName: string, username: string): Promise<DyNTS_DiB_Message> {
|
|
349
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
350
|
+
const messages: DyNTS_DiB_Message[] = await this.fetchAllMessagesWithPaging(channel, 1000);
|
|
351
|
+
|
|
352
|
+
return messages.find((msg: DyNTS_DiB_Message) =>
|
|
353
|
+
msg.content.includes(`@${username}`) ||
|
|
354
|
+
msg.content.includes(`<@${username}>`)
|
|
355
|
+
) || null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Advanced message queries
|
|
359
|
+
async readLastMessageDatesByMembers(channelName: string, memberNames: string[]): Promise<DyNTS_Bot_LastMessageDate[]> {
|
|
360
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
361
|
+
const messages: DyNTS_DiB_Message[] = await this.fetchAllMessagesWithPaging(channel, 1000);
|
|
362
|
+
|
|
363
|
+
const memberStatus: Record<string, { lastMessageDate: Date | null, allMessages: number }> = {};
|
|
364
|
+
memberNames.forEach((name: string) => {
|
|
365
|
+
memberStatus[name] = { lastMessageDate: null, allMessages: 0 };
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
const cutoffTime: number = Date.now() - (3 * week); // 3 weeks
|
|
369
|
+
|
|
370
|
+
messages.forEach((message: DyNTS_DiB_Message) => {
|
|
371
|
+
if (message.timestamp < cutoffTime) return;
|
|
372
|
+
|
|
373
|
+
const author = message.authorName;
|
|
374
|
+
if (memberStatus[author] !== undefined) {
|
|
375
|
+
memberStatus[author].allMessages++;
|
|
376
|
+
if (!memberStatus[author].lastMessageDate) {
|
|
377
|
+
memberStatus[author].lastMessageDate = new Date(message.timestamp);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
return memberNames.map((memberName: string) => {
|
|
383
|
+
const status: { lastMessageDate: Date | null, allMessages: number } = memberStatus[memberName];
|
|
384
|
+
|
|
385
|
+
return {
|
|
386
|
+
memberName: memberName,
|
|
387
|
+
allMessages: status.allMessages,
|
|
388
|
+
lastMessageDate: status.lastMessageDate
|
|
389
|
+
};
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// Advanced message queries
|
|
394
|
+
async readLastMessageWithMemberNamePingInIt(channelName: string, users: DyNTS_DiB_User[]): Promise<DyNTS_Bot_LastMentionDate[]> {
|
|
395
|
+
const channel: DyNTS_DiB_Channel = await this.getChannelByName(channelName);
|
|
396
|
+
const messages: DyNTS_DiB_Message[] = await this.fetchAllMessagesWithPaging(channel, 1000);
|
|
397
|
+
|
|
398
|
+
const memberStatus: Record<string, { lastMentionDate: Date | null, allMentions: number }> = {};
|
|
399
|
+
users.forEach((user: DyNTS_DiB_User) => {
|
|
400
|
+
memberStatus[user.username] = { lastMentionDate: null, allMentions: 0 };
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
const cutoffTime: number = Date.now() - (3 * week); // 3 weeks
|
|
404
|
+
|
|
405
|
+
messages.forEach((message: DyNTS_DiB_Message) => {
|
|
406
|
+
if (message.timestamp < cutoffTime) return;
|
|
407
|
+
|
|
408
|
+
users.forEach((user: DyNTS_DiB_User) => {
|
|
409
|
+
if (
|
|
410
|
+
message.content.includes(`@${user.id}`) &&
|
|
411
|
+
!memberStatus[user.username].lastMentionDate
|
|
412
|
+
) {
|
|
413
|
+
memberStatus[user.username].lastMentionDate = new Date(message.timestamp);
|
|
414
|
+
memberStatus[user.username].allMentions++;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
return users.map((user: DyNTS_DiB_User) => {
|
|
420
|
+
const status: { lastMentionDate: Date | null, allMentions: number } = memberStatus[user.username];
|
|
421
|
+
|
|
422
|
+
return {
|
|
423
|
+
memberId: user.id,
|
|
424
|
+
memberName: user.username,
|
|
425
|
+
allMentions: status.allMentions,
|
|
426
|
+
lastMentionDate: status.lastMentionDate
|
|
427
|
+
};
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Discord-specific features
|
|
432
|
+
getRoleByName(roleName: string): Role {
|
|
433
|
+
if (this.roleCache.has(roleName)) {
|
|
434
|
+
return this.roleCache.get(roleName);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const role: Role = this.guild.roles.cache.find((r: Role) => r.name === roleName);
|
|
438
|
+
if (role) {
|
|
439
|
+
this.roleCache.set(roleName, role);
|
|
440
|
+
}
|
|
441
|
+
return role;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
async getRolePingByName(roleName: string): Promise<string> {
|
|
445
|
+
const role: Role = this.getRoleByName(roleName);
|
|
446
|
+
return role ? `<@&${role.id}>` : '';
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
async getRolePingsByName(roleNames: string[]): Promise<string> {
|
|
450
|
+
const pings: string[] = await Promise.all(
|
|
451
|
+
roleNames.map((roleName: string) => this.getRolePingByName(roleName))
|
|
452
|
+
);
|
|
453
|
+
return pings.join(' ');
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
create_onMessageEventListener(handler: (message: DyNTS_DiB_Message, issuer: string) => void): void {
|
|
457
|
+
this.client.on('messageCreate', (message: Message) => {
|
|
458
|
+
handler(this.wrapMessage(message), 'discord');
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
create_onErrorEventListener(handler: (error: DyFM_AnyError) => void): void {
|
|
463
|
+
this.client.on('error', (error: Error) => {
|
|
464
|
+
handler(error);
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
async sendReport(message: string): Promise<DyNTS_DiB_Message> {
|
|
469
|
+
return await this.sendMessageToChannelByName(this.config.reportChannelName, message);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
async sendReportIn(message: string): Promise<DyNTS_DiB_Message> {
|
|
473
|
+
return await this.sendMessageToChannelByName(
|
|
474
|
+
this.config.reportChannelName,
|
|
475
|
+
`${this.botDisplayName} report for duty! ` +
|
|
476
|
+
`(v${DyNTS_global_settings.systemVersion} ${DyNTS_global_settings.env_settings?.environment})`
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
wrapMessage(message: Message): DyNTS_DiB_Message {
|
|
481
|
+
return {
|
|
482
|
+
id: message.id,
|
|
483
|
+
content: message.content,
|
|
484
|
+
authorId: message.author.id,
|
|
485
|
+
authorName: message.author.username,
|
|
486
|
+
authorDisplayName: message.author.displayName,
|
|
487
|
+
channelId: message.channel.id,
|
|
488
|
+
channelName: (message.channel as TextChannel)?.name || 'DM Channel with ' + (message.channel as DMChannel).recipient.username,
|
|
489
|
+
timestamp: message.createdTimestamp,
|
|
490
|
+
isBot: message.author.bot,
|
|
491
|
+
replyToMessageId: message.reference?.messageId,
|
|
492
|
+
mentions: Array.from(message.mentions.users.keys()),
|
|
493
|
+
rawPlatformMessage: message,
|
|
494
|
+
provider: this,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
wrapChannel(channel: Channel): DyNTS_DiB_Channel {
|
|
499
|
+
return {
|
|
500
|
+
id: channel.id,
|
|
501
|
+
name: (channel as TextChannel).name || ('DM Channel with ' + (channel as DMChannel).recipient.username),
|
|
502
|
+
isTextBased: channel.isTextBased(),
|
|
503
|
+
isDM: channel.isDMBased(),
|
|
504
|
+
rawPlatformChannel: channel,
|
|
505
|
+
|
|
506
|
+
provider: this,
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
wrapUser(user: GuildMember): DyNTS_DiB_User {
|
|
511
|
+
return {
|
|
512
|
+
id: user.user.id,
|
|
513
|
+
username: user.user.username,
|
|
514
|
+
displayName: user.displayName,
|
|
515
|
+
isBot: user.user.bot,
|
|
516
|
+
rawPlatformUser: user,
|
|
517
|
+
|
|
518
|
+
provider: this,
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
}
|
|
@@ -5,11 +5,8 @@
|
|
|
5
5
|
//
|
|
6
6
|
|
|
7
7
|
// TYPES
|
|
8
|
-
export * from './_models/dib-platform.types';
|
|
8
|
+
/* export * from './_models/dib-platform.types'; */
|
|
9
9
|
|
|
10
10
|
// SERVICES
|
|
11
|
-
export * from './_services/dib-messaging-provider.service';
|
|
11
|
+
export * from './_services/dib-messaging-provider.control-service';
|
|
12
12
|
|
|
13
|
-
// COLLECTIONS
|
|
14
|
-
export * from './_collections/dib-operations.util';
|
|
15
|
-
export * from './_collections/dib.util';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
|
-
import {
|
|
2
|
+
import { DyNTS_DyB_MessagingProvider_ControlService } from '../_services/dyb-messaging-provider.control-service';
|
|
3
3
|
import { DyNTS_DyB_Message, DyNTS_DyB_Channel } from '../_models/dyb-platform.types';
|
|
4
4
|
|
|
5
5
|
export class DyNTS_DyB_Operations_Util {
|
|
@@ -7,13 +7,16 @@ export class DyNTS_DyB_Operations_Util {
|
|
|
7
7
|
/**
|
|
8
8
|
* Get conversation statistics
|
|
9
9
|
*/
|
|
10
|
-
static async getConversationStats(
|
|
10
|
+
static async getConversationStats(
|
|
11
|
+
provider: DyNTS_DyB_MessagingProvider_ControlService,
|
|
12
|
+
conversationId: string
|
|
13
|
+
): Promise<{
|
|
11
14
|
messageCount: number;
|
|
12
15
|
participantCount: number;
|
|
13
16
|
lastActivity: Date | null;
|
|
14
17
|
}> {
|
|
15
18
|
try {
|
|
16
|
-
const messages: DyNTS_DyB_Message[] = await provider.
|
|
19
|
+
const messages: DyNTS_DyB_Message[] = await provider.fetchMessagesById(conversationId, 1000);
|
|
17
20
|
const channel: DyNTS_DyB_Channel = await provider.getChannelById(conversationId);
|
|
18
21
|
|
|
19
22
|
return {
|
|
@@ -35,12 +38,12 @@ export class DyNTS_DyB_Operations_Util {
|
|
|
35
38
|
* Search messages in conversation
|
|
36
39
|
*/
|
|
37
40
|
static async searchMessages(
|
|
38
|
-
provider:
|
|
41
|
+
provider: DyNTS_DyB_MessagingProvider_ControlService,
|
|
39
42
|
conversationId: string,
|
|
40
43
|
searchTerm: string
|
|
41
44
|
): Promise<DyNTS_DyB_Message[]> {
|
|
42
45
|
try {
|
|
43
|
-
const messages: DyNTS_DyB_Message[] = await provider.
|
|
46
|
+
const messages: DyNTS_DyB_Message[] = await provider.fetchMessagesById(conversationId, 1000);
|
|
44
47
|
return messages.filter((msg: DyNTS_DyB_Message) =>
|
|
45
48
|
msg.content.toLowerCase().includes(searchTerm.toLowerCase())
|
|
46
49
|
);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DyNTS_Bot_MessageWrapper } from '../../../_models/bot-message-wrapper.interface';
|
|
2
|
+
import { DyNTS_Bot_ChannelWrapper } from '../../../_models/bot-channel-wrapper.interface';
|
|
3
|
+
import { DyNTS_Bot_UserWrapper } from '../../../_models/bot-user-wrapper.interface';
|
|
4
4
|
import { DyFM_Msg_Message, DyFM_Msg_Conversation, DyFM_Msg_Participant } from '@futdevpro/fsm-dynamo/messaging';
|
|
5
5
|
|
|
6
6
|
// Dynamo Bot Platform-Specific Types
|
|
7
7
|
// Uses messaging system models as the underlying platform
|
|
8
|
-
export type DyNTS_DyB_Message =
|
|
8
|
+
export type DyNTS_DyB_Message = DyNTS_Bot_MessageWrapper<DyFM_Msg_Message>;
|
|
9
9
|
|
|
10
10
|
// Extended channel interface for dynamo bot with participants
|
|
11
|
-
export interface DyNTS_DyB_Channel extends
|
|
11
|
+
export interface DyNTS_DyB_Channel extends DyNTS_Bot_ChannelWrapper<DyFM_Msg_Conversation> {
|
|
12
12
|
participants?: DyFM_Msg_Participant[];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type DyNTS_DyB_User =
|
|
15
|
+
export type DyNTS_DyB_User = DyNTS_Bot_UserWrapper<any>; // Messaging system user (generic)
|