@futdevpro/nts-dynamo 1.14.8 → 1.14.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/_collections/global-settings.const.d.ts.map +1 -1
- package/build/_collections/global-settings.const.js +1 -0
- package/build/_collections/global-settings.const.js.map +1 -1
- package/build/_models/interfaces/global-settings.interface.d.ts +18 -2
- package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts +3 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts.map +1 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.js +15 -0
- package/build/_modules/assistant/_collections/ass-global-settings.const.js.map +1 -0
- package/build/_modules/assistant/_collections/ass.util.d.ts +16 -0
- package/build/_modules/assistant/_collections/ass.util.d.ts.map +1 -0
- package/build/_modules/assistant/_collections/ass.util.js +43 -0
- package/build/_modules/assistant/_collections/ass.util.js.map +1 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts +14 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.js +3 -0
- package/build/_modules/assistant/_models/ass-global-settings.interface.js.map +1 -0
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts +23 -0
- package/build/_modules/assistant/_services/ass-io.control-service.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass-io.control-service.js +59 -0
- package/build/_modules/assistant/_services/ass-io.control-service.js.map +1 -0
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts +15 -0
- package/build/_modules/assistant/_services/ass-main.control-service.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass-main.control-service.js +12 -0
- package/build/_modules/assistant/_services/ass-main.control-service.js.map +1 -0
- package/build/_modules/assistant/_services/ass.service-base.d.ts +31 -0
- package/build/_modules/assistant/_services/ass.service-base.d.ts.map +1 -0
- package/build/_modules/assistant/_services/ass.service-base.js +56 -0
- package/build/_modules/assistant/_services/ass.service-base.js.map +1 -0
- package/build/_modules/assistant/index.d.ts +7 -0
- package/build/_modules/assistant/index.d.ts.map +1 -0
- package/build/_modules/assistant/index.js +19 -0
- package/build/_modules/assistant/index.js.map +1 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.d.ts +3 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.js +14 -0
- package/build/_modules/bot/_collections/bot-default-commands.const.js.map +1 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.d.ts +3 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.js +32 -0
- package/build/_modules/bot/_collections/bot-global-settings.const.js.map +1 -0
- package/build/_modules/bot/_collections/bot-operations.util.d.ts +21 -0
- package/build/_modules/bot/_collections/bot-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_collections/bot-operations.util.js +74 -0
- package/build/_modules/bot/_collections/bot-operations.util.js.map +1 -0
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts +7 -0
- package/build/_modules/bot/_enums/bot-provider.enum.d.ts.map +1 -0
- package/build/_modules/bot/_enums/bot-provider.enum.js +11 -0
- package/build/_modules/bot/_enums/bot-provider.enum.js.map +1 -0
- package/build/_modules/bot/_models/bot-channel.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-channel.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-channel.interface.js +3 -0
- package/build/_modules/bot/_models/bot-channel.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-command.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-command.interface.js +3 -0
- package/build/_modules/bot/_models/bot-command.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +79 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.js +3 -0
- package/build/_modules/bot/_models/bot-global-settings.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts +7 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.js +3 -0
- package/build/_modules/bot/_models/bot-last-mention-date.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts +6 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.js +3 -0
- package/build/_modules/bot/_models/bot-last-message-date.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-message.interface.d.ts +15 -0
- package/build/_modules/bot/_models/bot-message.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-message.interface.js +3 -0
- package/build/_modules/bot/_models/bot-message.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-provider.interface.d.ts +60 -0
- package/build/_modules/bot/_models/bot-provider.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-provider.interface.js +3 -0
- package/build/_modules/bot/_models/bot-provider.interface.js.map +1 -0
- package/build/_modules/bot/_models/bot-user.interface.d.ts +8 -0
- package/build/_modules/bot/_models/bot-user.interface.d.ts.map +1 -0
- package/build/_modules/bot/_models/bot-user.interface.js +3 -0
- package/build/_modules/bot/_models/bot-user.interface.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js +13 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts +5 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js +19 -0
- package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts +8 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js +3 -0
- package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts +53 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js +369 -0
- package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts +5 -0
- package/build/_modules/bot/_modules/discord-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/discord-bot/index.js +16 -0
- package/build/_modules/bot/_modules/discord-bot/index.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js +13 -0
- package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts +7 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js +3 -0
- package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts +40 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js +116 -0
- package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts +4 -0
- package/build/_modules/bot/_modules/slack-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/slack-bot/index.js +15 -0
- package/build/_modules/bot/_modules/slack-bot/index.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts +11 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js +13 -0
- package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts +7 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js +3 -0
- package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts +40 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js +116 -0
- package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts +4 -0
- package/build/_modules/bot/_modules/teams-bot/index.d.ts.map +1 -0
- package/build/_modules/bot/_modules/teams-bot/index.js +15 -0
- package/build/_modules/bot/_modules/teams-bot/index.js.map +1 -0
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts +15 -0
- package/build/_modules/bot/_services/bot-commands.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-commands.control-service.js +72 -0
- package/build/_modules/bot/_services/bot-commands.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-io.control-service.d.ts +24 -0
- package/build/_modules/bot/_services/bot-io.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-io.control-service.js +207 -0
- package/build/_modules/bot/_services/bot-io.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-main.control-service.d.ts +42 -0
- package/build/_modules/bot/_services/bot-main.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-main.control-service.js +223 -0
- package/build/_modules/bot/_services/bot-main.control-service.js.map +1 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts +5 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.js +28 -0
- package/build/_modules/bot/_services/bot-provider-factory.service.js.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts +17 -0
- package/build/_modules/bot/_services/bot-routines.control-service.d.ts.map +1 -0
- package/build/_modules/bot/_services/bot-routines.control-service.js +40 -0
- package/build/_modules/bot/_services/bot-routines.control-service.js.map +1 -0
- package/build/_modules/bot/index.d.ts +21 -0
- package/build/_modules/bot/index.d.ts.map +1 -0
- package/build/_modules/bot/index.js +35 -0
- package/build/_modules/bot/index.js.map +1 -0
- package/build/_modules/defaults/_models/default-user.data-model.d.ts +20 -0
- package/build/_modules/defaults/_models/default-user.data-model.d.ts.map +1 -0
- package/build/_modules/defaults/_models/default-user.data-model.js +73 -0
- package/build/_modules/defaults/_models/default-user.data-model.js.map +1 -0
- package/build/_modules/defaults/_services/default-auth.service.d.ts +51 -0
- package/build/_modules/defaults/_services/default-auth.service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-auth.service.js +159 -0
- package/build/_modules/defaults/_services/default-auth.service.js.map +1 -0
- package/build/_modules/defaults/_services/default-socket-events.service.d.ts +24 -0
- package/build/_modules/defaults/_services/default-socket-events.service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-socket-events.service.js +61 -0
- package/build/_modules/defaults/_services/default-socket-events.service.js.map +1 -0
- package/build/_modules/defaults/_services/default-user.data-service.d.ts +25 -0
- package/build/_modules/defaults/_services/default-user.data-service.d.ts.map +1 -0
- package/build/_modules/defaults/_services/default-user.data-service.js +88 -0
- package/build/_modules/defaults/_services/default-user.data-service.js.map +1 -0
- package/build/_modules/defaults/index.d.ts +5 -0
- package/build/_modules/defaults/index.d.ts.map +1 -0
- package/build/_modules/defaults/index.js +16 -0
- package/build/_modules/defaults/index.js.map +1 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts +6 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts.map +1 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.js +27 -0
- package/build/_modules/messaging/_collections/msg-global-settings.const.js.map +1 -0
- package/build/_modules/messaging/_collections/msg.util.d.ts +25 -0
- package/build/_modules/messaging/_collections/msg.util.d.ts.map +1 -0
- package/build/_modules/messaging/_collections/msg.util.js +63 -0
- package/build/_modules/messaging/_collections/msg.util.js.map +1 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts +23 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts.map +1 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.js +32 -0
- package/build/_modules/messaging/_enums/msg-event-key.enum.js.map +1 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts +38 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts.map +1 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.js +3 -0
- package/build/_modules/messaging/_models/msg-global-settings.interface.js.map +1 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts +29 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.js +110 -0
- package/build/_modules/messaging/_services/msg-conversation.data-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-events.service.d.ts +62 -0
- package/build/_modules/messaging/_services/msg-events.service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-events.service.js +204 -0
- package/build/_modules/messaging/_services/msg-events.service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts +26 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.js +126 -0
- package/build/_modules/messaging/_services/msg-integration.control-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-main.control-service.d.ts +62 -0
- package/build/_modules/messaging/_services/msg-main.control-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-main.control-service.js +408 -0
- package/build/_modules/messaging/_services/msg-main.control-service.js.map +1 -0
- package/build/_modules/messaging/_services/msg-message.data-service.d.ts +29 -0
- package/build/_modules/messaging/_services/msg-message.data-service.d.ts.map +1 -0
- package/build/_modules/messaging/_services/msg-message.data-service.js +104 -0
- package/build/_modules/messaging/_services/msg-message.data-service.js.map +1 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.d.ts +8 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.d.ts.map +1 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.js +21 -0
- package/build/_modules/messaging/get-messaging-routing-module.util.js.map +1 -0
- package/build/_modules/messaging/index.d.ts +13 -0
- package/build/_modules/messaging/index.d.ts.map +1 -0
- package/build/_modules/messaging/index.js +30 -0
- package/build/_modules/messaging/index.js.map +1 -0
- package/build/_modules/messaging/messaging.controller.d.ts +13 -0
- package/build/_modules/messaging/messaging.controller.d.ts.map +1 -0
- package/build/_modules/messaging/messaging.controller.js +257 -0
- package/build/_modules/messaging/messaging.controller.js.map +1 -0
- package/package.json +71 -3
- package/src/_collections/global-settings.const.ts +2 -0
- package/src/_models/interfaces/global-settings.interface.ts +20 -2
- package/src/_modules/assistant/_collections/ass-global-settings.const.ts +13 -0
- package/src/_modules/assistant/_collections/ass.util.ts +50 -0
- package/src/_modules/assistant/_models/ass-global-settings.interface.ts +15 -0
- package/src/_modules/assistant/_services/ass-io.control-service.ts +100 -0
- package/src/_modules/assistant/_services/ass-main.control-service.ts +38 -0
- package/src/_modules/assistant/_services/ass.service-base.ts +92 -0
- package/src/_modules/assistant/index.ts +19 -0
- package/src/_modules/bot/_collections/bot-default-commands.const.ts +12 -0
- package/src/_modules/bot/_collections/bot-global-settings.const.ts +39 -0
- package/src/_modules/bot/_collections/bot-operations.util.ts +149 -0
- package/src/_modules/bot/_enums/bot-provider.enum.ts +6 -0
- package/src/_modules/bot/_models/bot-channel.interface.ts +7 -0
- package/src/_modules/bot/_models/bot-command.interface.ts +8 -0
- package/src/_modules/bot/_models/bot-global-settings.interface.ts +87 -0
- package/src/_modules/bot/_models/bot-last-mention-date.interface.ts +6 -0
- package/src/_modules/bot/_models/bot-last-message-date.interface.ts +5 -0
- package/src/_modules/bot/_models/bot-message.interface.ts +14 -0
- package/src/_modules/bot/_models/bot-provider.interface.ts +80 -0
- package/src/_modules/bot/_models/bot-user.interface.ts +7 -0
- package/src/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/discord-bot/_collections/dib.util.ts +20 -0
- package/src/_modules/bot/_modules/discord-bot/_models/dib-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/discord-bot/_services/dib-provider.service.ts +462 -0
- package/src/_modules/bot/_modules/discord-bot/index.ts +15 -0
- package/src/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/slack-bot/_models/slb-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/slack-bot/_services/slb-provider.service.ts +152 -0
- package/src/_modules/bot/_modules/slack-bot/index.ts +14 -0
- package/src/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.ts +18 -0
- package/src/_modules/bot/_modules/teams-bot/_models/teb-platform.types.ts +9 -0
- package/src/_modules/bot/_modules/teams-bot/_services/teb-provider.service.ts +152 -0
- package/src/_modules/bot/_modules/teams-bot/index.ts +14 -0
- package/src/_modules/bot/_services/bot-commands.control-service.ts +126 -0
- package/src/_modules/bot/_services/bot-io.control-service.ts +325 -0
- package/src/_modules/bot/_services/bot-main.control-service.ts +344 -0
- package/src/_modules/bot/_services/bot-provider-factory.service.ts +30 -0
- package/src/_modules/bot/_services/bot-routines.control-service.ts +83 -0
- package/src/_modules/bot/index.ts +36 -0
- package/src/_modules/defaults/_models/default-user.data-model.ts +72 -0
- package/src/_modules/defaults/_services/default-auth.service.ts +177 -0
- package/src/_modules/defaults/_services/default-socket-events.service.ts +61 -0
- package/src/_modules/defaults/_services/default-user.data-service.ts +98 -0
- package/src/_modules/defaults/index.ts +14 -0
- package/src/_modules/messaging/_collections/msg-global-settings.const.ts +27 -0
- package/src/_modules/messaging/_collections/msg.util.ts +83 -0
- package/src/_modules/messaging/_enums/msg-event-key.enum.ts +31 -0
- package/src/_modules/messaging/_models/msg-global-settings.interface.ts +49 -0
- package/src/_modules/messaging/_services/msg-conversation.data-service.ts +146 -0
- package/src/_modules/messaging/_services/msg-events.service.ts +267 -0
- package/src/_modules/messaging/_services/msg-integration.control-service.ts +179 -0
- package/src/_modules/messaging/_services/msg-main.control-service.ts +548 -0
- package/src/_modules/messaging/_services/msg-message.data-service.ts +129 -0
- package/src/_modules/messaging/get-messaging-routing-module.util.ts +26 -0
- package/src/_modules/messaging/index.ts +33 -0
- package/src/_modules/messaging/messaging.controller.ts +370 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import { DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
import { DyNTS_Bot_IO_ControlService } from '../../bot/_services/bot-io.control-service';
|
|
4
|
+
import { DyNTS_Bot_Message } from '../../bot/_models/bot-message.interface';
|
|
5
|
+
import { DyNTS_Bot_Channel } from '../../bot/_models/bot-channel.interface';
|
|
6
|
+
import { DyNTS_Bot_User } from '../../bot/_models/bot-user.interface';
|
|
7
|
+
import { DyNTS_Bot_Provider } from '../../bot/_models/bot-provider.interface';
|
|
8
|
+
import { DyNTS_Ass_Main_ControlService } from './ass-main.control-service';
|
|
9
|
+
import { DyNTS_Ass_Util } from '../_collections/ass.util';
|
|
10
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
11
|
+
import { DyNTS_AI_LLMChat_ServiceBase } from '../../ai/_services/ai-llm-chat.service-base';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Assistant IO Control Service
|
|
15
|
+
* Handles message processing with AI provider
|
|
16
|
+
* EXACT SAME LOGIC as DiAs_IO_ControlService but platform and AI provider agnostic
|
|
17
|
+
*/
|
|
18
|
+
export abstract class DyNTS_Ass_IO_ControlService<
|
|
19
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
20
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
21
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
22
|
+
T_CommsProvider extends DyNTS_Bot_Provider<
|
|
23
|
+
T_PlatformChannel,
|
|
24
|
+
T_PlatformMessage,
|
|
25
|
+
T_PlatformUser
|
|
26
|
+
> = DyNTS_Bot_Provider<
|
|
27
|
+
T_PlatformChannel,
|
|
28
|
+
T_PlatformMessage,
|
|
29
|
+
T_PlatformUser
|
|
30
|
+
>
|
|
31
|
+
> extends DyNTS_Bot_IO_ControlService<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_CommsProvider> {
|
|
32
|
+
|
|
33
|
+
protected abstract override getMainBotControlService(): DyNTS_Ass_Main_ControlService<
|
|
34
|
+
T_PlatformChannel,
|
|
35
|
+
T_PlatformMessage,
|
|
36
|
+
T_PlatformUser,
|
|
37
|
+
T_CommsProvider
|
|
38
|
+
>;
|
|
39
|
+
|
|
40
|
+
protected abstract override mainBot_CS: DyNTS_Ass_Main_ControlService<
|
|
41
|
+
T_PlatformChannel,
|
|
42
|
+
T_PlatformMessage,
|
|
43
|
+
T_PlatformUser,
|
|
44
|
+
T_CommsProvider
|
|
45
|
+
>;
|
|
46
|
+
|
|
47
|
+
get aiProvider(): DyNTS_AI_LLMChat_ServiceBase {
|
|
48
|
+
return this.mainBot_CS?.aiProvider;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Handle incoming message with AI
|
|
53
|
+
* EXACT SAME LOGIC as dias-io.control-service.ts handleMessage()
|
|
54
|
+
*/
|
|
55
|
+
override async handleMessage(message: T_PlatformMessage, issuer: string): Promise<T_PlatformMessage> {
|
|
56
|
+
try {
|
|
57
|
+
// Gather messages from comms platform
|
|
58
|
+
const messages: T_PlatformMessage[] = await this.mainBot_CS.gatherMessagesForMessage(message);
|
|
59
|
+
|
|
60
|
+
// Convert to AI conversation format (uses EXISTING DyFM_AI_Message)
|
|
61
|
+
const aiMessages: DyFM_AI_Message[] =
|
|
62
|
+
DyNTS_Ass_Util.convertBotMessagesToAIConversation({
|
|
63
|
+
messages: messages,
|
|
64
|
+
botClientId: this.mainBot_CS.botClientId,
|
|
65
|
+
botDisplayName: this.mainBot_CS.botDisplayName,
|
|
66
|
+
issuer: issuer,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Get AI response using EXISTING getAnswerInConversation method
|
|
70
|
+
const aiResult: string = await this.aiProvider.getAnswerInConversation({
|
|
71
|
+
conversation: aiMessages,
|
|
72
|
+
issuer: issuer,
|
|
73
|
+
settings: {
|
|
74
|
+
systemPrompt: this.mainBot_CS.defaultSystemPrompt,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Reply via comms platform
|
|
79
|
+
return await this.provider.replyToMessage(message.id, message.channelId, aiResult);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
DyFM_Error.logSimple('❌❌ Error handleMessage:', error);
|
|
82
|
+
|
|
83
|
+
if (!this.dontSendErrorReply && DyNTS_global_settings.bot_settings?.debugLevel >= 1) {
|
|
84
|
+
await this.provider.replyToMessage(
|
|
85
|
+
message.id,
|
|
86
|
+
message.channelId,
|
|
87
|
+
`[SYSTEM|ERROR|${DyNTS_global_settings.systemShortCodeName}|DyNTS-Ass-IOCS-H0] Error occurred while handling the message:\n` +
|
|
88
|
+
DyFM_Error.getAnyMessage(error)
|
|
89
|
+
).catch(error => {
|
|
90
|
+
DyFM_Error.logSimple('❌❌ Error sending error reply:', error);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
throw new DyFM_Error({
|
|
95
|
+
...this.getDefaultErrorSettings('handleMessage', error, issuer),
|
|
96
|
+
errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Ass-IOCS-H0`,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DyNTS_Ass_ServiceBase } from './ass.service-base';
|
|
2
|
+
import { DyNTS_Ass_IO_ControlService } from './ass-io.control-service';
|
|
3
|
+
import { DyNTS_Bot_Channel } from '../../bot/_models/bot-channel.interface';
|
|
4
|
+
import { DyNTS_Bot_Message } from '../../bot/_models/bot-message.interface';
|
|
5
|
+
import { DyNTS_Bot_User } from '../../bot/_models/bot-user.interface';
|
|
6
|
+
import { DyNTS_Bot_Provider } from '../../bot/_models/bot-provider.interface';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Assistant Main Control Service
|
|
10
|
+
* Abstract base for concrete assistant implementations
|
|
11
|
+
*/
|
|
12
|
+
export abstract class DyNTS_Ass_Main_ControlService<
|
|
13
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
14
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
15
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
16
|
+
T_CommsProvider extends DyNTS_Bot_Provider<
|
|
17
|
+
T_PlatformChannel,
|
|
18
|
+
T_PlatformMessage,
|
|
19
|
+
T_PlatformUser
|
|
20
|
+
> = DyNTS_Bot_Provider<
|
|
21
|
+
T_PlatformChannel,
|
|
22
|
+
T_PlatformMessage,
|
|
23
|
+
T_PlatformUser
|
|
24
|
+
>
|
|
25
|
+
> extends DyNTS_Ass_ServiceBase<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_CommsProvider> {
|
|
26
|
+
protected abstract override getBotIOControlService(): DyNTS_Ass_IO_ControlService<
|
|
27
|
+
T_PlatformChannel,
|
|
28
|
+
T_PlatformMessage,
|
|
29
|
+
T_PlatformUser,
|
|
30
|
+
T_CommsProvider
|
|
31
|
+
>;
|
|
32
|
+
protected abstract override botIO_CS: DyNTS_Ass_IO_ControlService<
|
|
33
|
+
T_PlatformChannel,
|
|
34
|
+
T_PlatformMessage,
|
|
35
|
+
T_PlatformUser,
|
|
36
|
+
T_CommsProvider
|
|
37
|
+
>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DyNTS_Bot_Main_ControlService } from '../../bot/_services/bot-main.control-service';
|
|
2
|
+
import { DyNTS_Bot_Message } from '../../bot/_models/bot-message.interface';
|
|
3
|
+
import { DyNTS_Bot_Channel } from '../../bot/_models/bot-channel.interface';
|
|
4
|
+
import { DyNTS_Bot_User } from '../../bot/_models/bot-user.interface';
|
|
5
|
+
import { DyNTS_Bot_Provider } from '../../bot/_models/bot-provider.interface';
|
|
6
|
+
import { DyNTS_AI_LLMChat_ServiceBase } from '../../ai/_services/ai-llm-chat.service-base';
|
|
7
|
+
import { DyFM_AI_Message } from '@futdevpro/fsm-dynamo/ai';
|
|
8
|
+
import { DyNTS_Ass_global_settings } from '../_collections/ass-global-settings.const';
|
|
9
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
10
|
+
import { DyNTS_Ass_Util } from '../_collections/ass.util';
|
|
11
|
+
import { DyNTS_Ass_IO_ControlService } from './ass-io.control-service';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Assistant Service Base
|
|
15
|
+
* Integrates commsProvider (bot) and aiProvider (LLMChat) to create AI-powered assistant
|
|
16
|
+
* USES EXISTING AI ABSTRACTIONS - no duplication
|
|
17
|
+
*/
|
|
18
|
+
export abstract class DyNTS_Ass_ServiceBase<
|
|
19
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
20
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
21
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
22
|
+
T_CommsProvider extends DyNTS_Bot_Provider<T_PlatformChannel, T_PlatformMessage, T_PlatformUser> = DyNTS_Bot_Provider<T_PlatformChannel, T_PlatformMessage, T_PlatformUser>
|
|
23
|
+
> extends DyNTS_Bot_Main_ControlService<T_PlatformChannel, T_PlatformMessage, T_PlatformUser, T_CommsProvider> {
|
|
24
|
+
|
|
25
|
+
// AI Provider - uses EXISTING abstraction
|
|
26
|
+
protected _aiProvider: DyNTS_AI_LLMChat_ServiceBase;
|
|
27
|
+
|
|
28
|
+
get aiProvider(): DyNTS_AI_LLMChat_ServiceBase {
|
|
29
|
+
return this._aiProvider;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected abstract getAIProvider(): DyNTS_AI_LLMChat_ServiceBase;
|
|
33
|
+
|
|
34
|
+
// Override botIO to use assistant IO
|
|
35
|
+
protected abstract override getBotIOControlService(): DyNTS_Ass_IO_ControlService<
|
|
36
|
+
T_PlatformChannel,
|
|
37
|
+
T_PlatformMessage,
|
|
38
|
+
T_PlatformUser,
|
|
39
|
+
T_CommsProvider
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
// Assistant-specific settings
|
|
43
|
+
defaultSystemPrompt: string = DyNTS_Ass_global_settings.defaultSystemPrompt;
|
|
44
|
+
|
|
45
|
+
protected constructor(setupAutomatically?: boolean) {
|
|
46
|
+
super(setupAutomatically);
|
|
47
|
+
|
|
48
|
+
// Initialize AI provider
|
|
49
|
+
this._aiProvider = this.getAIProvider();
|
|
50
|
+
|
|
51
|
+
// Apply system prompt
|
|
52
|
+
if (this._aiProvider.defaultSettings) {
|
|
53
|
+
this._aiProvider.defaultSettings.systemPrompt = this.defaultSystemPrompt;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Set global settings
|
|
57
|
+
DyNTS_global_settings.assistant_settings ??= DyNTS_Ass_global_settings;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Gather messages from comms platform (any platform)
|
|
62
|
+
* Same as dias.service-base but platform-agnostic
|
|
63
|
+
*/
|
|
64
|
+
async gatherMessagesForMessage(message: T_PlatformMessage, limit: number = 100): Promise<T_PlatformMessage[]> {
|
|
65
|
+
const channelId = message.channelId;
|
|
66
|
+
const messages = await this.provider.fetchMessages(channelId, limit);
|
|
67
|
+
|
|
68
|
+
// Filter out messages with skip flags
|
|
69
|
+
return messages.filter(
|
|
70
|
+
msg => !DyNTS_Ass_global_settings.skipConversationMessagesFlags.some(
|
|
71
|
+
flag => msg.content.includes(flag)
|
|
72
|
+
)
|
|
73
|
+
).sort((a, b) => a.timestamp - b.timestamp);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Convert gathered messages to AI conversation using EXISTING DyFM_AI_Message
|
|
78
|
+
*/
|
|
79
|
+
async gatherMessagesAsAIConversation(
|
|
80
|
+
message: T_PlatformMessage,
|
|
81
|
+
issuer: string,
|
|
82
|
+
): Promise<DyFM_AI_Message[]> {
|
|
83
|
+
const messages = await this.gatherMessagesForMessage(message);
|
|
84
|
+
|
|
85
|
+
return DyNTS_Ass_Util.convertBotMessagesToAIConversation({
|
|
86
|
+
messages: messages,
|
|
87
|
+
botClientId: this.botClientId,
|
|
88
|
+
botDisplayName: this.botDisplayName,
|
|
89
|
+
issuer: issuer,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Assistant module (platform and AI provider agnostic)
|
|
3
|
+
//
|
|
4
|
+
// Integrates commsProvider (bot) with aiProvider (AI LLMChat) to create intelligent assistants
|
|
5
|
+
// REUSES existing AI abstractions - no duplication
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// MODELS
|
|
9
|
+
export * from './_models/ass-global-settings.interface';
|
|
10
|
+
|
|
11
|
+
// COLLECTIONS
|
|
12
|
+
export * from './_collections/ass.util';
|
|
13
|
+
export * from './_collections/ass-global-settings.const';
|
|
14
|
+
|
|
15
|
+
// SERVICES
|
|
16
|
+
export * from './_services/ass.service-base';
|
|
17
|
+
export * from './_services/ass-main.control-service';
|
|
18
|
+
export * from './_services/ass-io.control-service';
|
|
19
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DyNTS_Bot_Command } from '../_models/bot-command.interface';
|
|
2
|
+
|
|
3
|
+
export const DyNTS_Bot_defaultCommands: DyNTS_Bot_Command[] = [
|
|
4
|
+
{
|
|
5
|
+
command: '!ping',
|
|
6
|
+
description: 'Ping the bot',
|
|
7
|
+
commandHandler: async (message) => {
|
|
8
|
+
// This will be handled by the provider's replyToMessage method
|
|
9
|
+
// The actual implementation will be in the provider
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { DyNTS_Bot_Global_Settings } from '../_models/bot-global-settings.interface';
|
|
2
|
+
import { minute, week } from '@futdevpro/fsm-dynamo';
|
|
3
|
+
import { DyNTS_Bot_defaultCommands } from './bot-default-commands.const';
|
|
4
|
+
|
|
5
|
+
export const DyNTS_Bot_global_settings: DyNTS_Bot_Global_Settings = {
|
|
6
|
+
debugLevel: 3,
|
|
7
|
+
|
|
8
|
+
allowedUsers: 'all',
|
|
9
|
+
|
|
10
|
+
messageSettings: {
|
|
11
|
+
messageFetchTimeLimit: 3 * week,
|
|
12
|
+
messageFetchCountLimit: 1000,
|
|
13
|
+
messageSendDelay: minute / 3,
|
|
14
|
+
|
|
15
|
+
skipFlags: [
|
|
16
|
+
'[BOT-SKIP]',
|
|
17
|
+
'[SYSTEM|REFUSE|BOT]',
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
channelSettings: {
|
|
22
|
+
reportChannelName: 'bot-reports',
|
|
23
|
+
|
|
24
|
+
defaultChannels: [
|
|
25
|
+
'bot-help',
|
|
26
|
+
],
|
|
27
|
+
|
|
28
|
+
allowedChannels: [],
|
|
29
|
+
dmIsAllowed: false,
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
commandSettings: {
|
|
33
|
+
commandOperator: '',
|
|
34
|
+
|
|
35
|
+
commands: DyNTS_Bot_defaultCommands,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
allowBotsInteractEachOther: false,
|
|
39
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import { DyNTS_Bot_Provider } from '../_models/bot-provider.interface';
|
|
3
|
+
import { DyNTS_Bot_Message } from '../_models/bot-message.interface';
|
|
4
|
+
import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface';
|
|
5
|
+
import { DyNTS_Bot_User } from '../_models/bot-user.interface';
|
|
6
|
+
import { DyNTS_Bot_LastMessageDate } from '../_models/bot-last-message-date.interface';
|
|
7
|
+
import { DyNTS_Bot_LastMentionDate } from '../_models/bot-last-mention-date.interface';
|
|
8
|
+
import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
|
|
9
|
+
|
|
10
|
+
export abstract class DyNTS_Bot_Operations_Util<
|
|
11
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
12
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
13
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
|
|
14
|
+
T_PlatformProvider extends DyNTS_Bot_Provider<
|
|
15
|
+
T_PlatformChannel,
|
|
16
|
+
T_PlatformMessage,
|
|
17
|
+
T_PlatformUser
|
|
18
|
+
> = DyNTS_Bot_Provider<
|
|
19
|
+
T_PlatformChannel,
|
|
20
|
+
T_PlatformMessage,
|
|
21
|
+
T_PlatformUser
|
|
22
|
+
>
|
|
23
|
+
> {
|
|
24
|
+
|
|
25
|
+
static async findChannelByName<
|
|
26
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any>,
|
|
27
|
+
T_PlatformProvider extends DyNTS_Bot_Provider<T_PlatformChannel, any, any>
|
|
28
|
+
>(
|
|
29
|
+
provider: T_PlatformProvider,
|
|
30
|
+
name: string
|
|
31
|
+
): Promise<T_PlatformChannel> {
|
|
32
|
+
const channel = await provider.getChannelByName(name);
|
|
33
|
+
|
|
34
|
+
if (!channel) {
|
|
35
|
+
DyFM_Log.error(`No text channel found with name "${name}"`)
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return channel;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static async sendMessageToChannelByName<T_PlatformChannel extends DyNTS_Bot_Channel<any>, T_PlatformProvider extends DyNTS_Bot_Provider<T_PlatformChannel, any, any>>(
|
|
43
|
+
provider: T_PlatformProvider,
|
|
44
|
+
channelName: string,
|
|
45
|
+
message: string
|
|
46
|
+
): Promise<void> {
|
|
47
|
+
const channel = await this.findChannelByName(provider, channelName);
|
|
48
|
+
|
|
49
|
+
if (channel?.isTextBased) {
|
|
50
|
+
await provider.sendMessageToChannelByName(channelName, message);
|
|
51
|
+
DyFM_Log.success('Message sent to channel', channel.name);
|
|
52
|
+
} else {
|
|
53
|
+
DyFM_Log.error(`Channel is not text based "${channelName}"`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static async readMembersInChannel<T_PlatformUser extends DyNTS_Bot_User<any>, T_PlatformProvider extends DyNTS_Bot_Provider<any, any, T_PlatformUser>>(
|
|
58
|
+
provider: T_PlatformProvider,
|
|
59
|
+
channelName: string
|
|
60
|
+
): Promise<T_PlatformUser[]> {
|
|
61
|
+
return await provider.readMembersInChannel(channelName);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static async readMemberNamesInChannel<T_PlatformProvider extends DyNTS_Bot_Provider<any, any, any>>(
|
|
65
|
+
provider: T_PlatformProvider,
|
|
66
|
+
channelName: string
|
|
67
|
+
): Promise<string[]> {
|
|
68
|
+
return await provider.readMemberNamesInChannel(channelName);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static async fetchAllMessagesWithPaging<T_PlatformMessage extends DyNTS_Bot_Message<any>, T_PlatformProvider extends DyNTS_Bot_Provider<any, T_PlatformMessage, any>>(
|
|
72
|
+
provider: T_PlatformProvider,
|
|
73
|
+
channelId: string,
|
|
74
|
+
maxFetch = 1000
|
|
75
|
+
): Promise<T_PlatformMessage[]> {
|
|
76
|
+
return await provider.fetchAllMessagesWithPaging(channelId, maxFetch);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
static async readLastMessageDatesByMembers<T_PlatformProvider extends DyNTS_Bot_Provider<any, any, any>>(
|
|
80
|
+
provider: T_PlatformProvider,
|
|
81
|
+
channelName: string,
|
|
82
|
+
memberNames: string[]
|
|
83
|
+
): Promise<DyNTS_Bot_LastMessageDate[]> {
|
|
84
|
+
return await provider.readLastMessageDatesByMembers(channelName, memberNames);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static async readLastMessageWithMemberNamePingInIt<T_PlatformUser extends DyNTS_Bot_User<any>, T_PlatformProvider extends DyNTS_Bot_Provider<any, any, T_PlatformUser>>(
|
|
88
|
+
provider: T_PlatformProvider,
|
|
89
|
+
channelName: string,
|
|
90
|
+
users: T_PlatformUser[]
|
|
91
|
+
): Promise<DyNTS_Bot_LastMentionDate[]> {
|
|
92
|
+
return await provider.readLastMessageWithMemberNamePingInIt(channelName, users);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static readMentionsInChannel = this.readLastMessageWithMemberNamePingInIt;
|
|
96
|
+
|
|
97
|
+
static async readLastMessagesInChannel<T_PlatformMessage extends DyNTS_Bot_Message<any>, T_PlatformChannel extends DyNTS_Bot_Channel<any>, T_PlatformProvider extends DyNTS_Bot_Provider<T_PlatformChannel, T_PlatformMessage, any>>(
|
|
98
|
+
provider: T_PlatformProvider,
|
|
99
|
+
channelName: string,
|
|
100
|
+
): Promise<T_PlatformMessage[]> {
|
|
101
|
+
const channel = await provider.getChannelByName(channelName);
|
|
102
|
+
return await provider.fetchMessages(channel.id, 100);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static async getLastMessageInChannel<T_PlatformMessage extends DyNTS_Bot_Message<any>, T_PlatformProvider extends DyNTS_Bot_Provider<any, T_PlatformMessage, any>>(
|
|
106
|
+
provider: T_PlatformProvider,
|
|
107
|
+
channelName: string
|
|
108
|
+
): Promise<T_PlatformMessage> {
|
|
109
|
+
return await provider.getLastMessageInChannel(channelName);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
static async deleteMessage<T_PlatformProvider extends DyNTS_Bot_Provider<any, any, any>>(
|
|
113
|
+
provider: T_PlatformProvider,
|
|
114
|
+
messageId: string,
|
|
115
|
+
channelId: string
|
|
116
|
+
): Promise<void> {
|
|
117
|
+
await provider.deleteMessage(messageId, channelId).catch((error) => {
|
|
118
|
+
DyFM_Error.logSimple('Failed to delete message', error);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
DyFM_Log.success('Message deleted');
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
static async reportIn<T_PlatformMessage extends DyNTS_Bot_Message<any>, T_PlatformProvider extends DyNTS_Bot_Provider<any, T_PlatformMessage, any>>(provider: T_PlatformProvider): Promise<void> {
|
|
125
|
+
try {
|
|
126
|
+
const lastReportMessage = await this.getLastMessageInChannel(
|
|
127
|
+
provider,
|
|
128
|
+
'bot-reports' // Use default since we can't access channelSettings from provider config
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const reportMessage = `${provider.getBotDisplayName()} report for duty! ` +
|
|
132
|
+
`(v${DyNTS_global_settings.systemVersion} ${DyNTS_global_settings.env_settings?.environment})`;
|
|
133
|
+
|
|
134
|
+
if (lastReportMessage?.content === reportMessage) {
|
|
135
|
+
await this.deleteMessage(provider, lastReportMessage.id, lastReportMessage.channelId).catch((error) => {
|
|
136
|
+
DyFM_Error.logSimple('Failed to delete message', error);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
this.sendMessageToChannelByName(
|
|
141
|
+
provider,
|
|
142
|
+
'bot-reports', // Use default since we can't access channelSettings from provider config
|
|
143
|
+
reportMessage
|
|
144
|
+
);
|
|
145
|
+
} catch (error) {
|
|
146
|
+
DyFM_Error.logSimple('Failed to report in', error);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DyNTS_Bot_Message } from './bot-message.interface';
|
|
2
|
+
|
|
3
|
+
export interface DyNTS_Bot_Command<T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>> {
|
|
4
|
+
command: string;
|
|
5
|
+
description: string;
|
|
6
|
+
commandHandler: (message: T_PlatformMessage) => Promise<void>;
|
|
7
|
+
permissionNeeded?: (message: T_PlatformMessage) => Promise<boolean>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { DyNTS_Bot_Command } from './bot-command.interface';
|
|
2
|
+
|
|
3
|
+
export interface DyNTS_Bot_Global_Settings {
|
|
4
|
+
/**
|
|
5
|
+
* this setting will set the debug level for the bot
|
|
6
|
+
*
|
|
7
|
+
* 0 - no logs
|
|
8
|
+
* 1 - errors sending to report channel
|
|
9
|
+
* 2 - errors sending as response, will log events in console
|
|
10
|
+
* 3 - errors sending as response, creating reports to report channel, debug events are in console (default)
|
|
11
|
+
* 4 - errors and debug events are sending as response
|
|
12
|
+
* 5 - all events are sending as response (that are set to send)
|
|
13
|
+
* 6 - all debug logs are enabled
|
|
14
|
+
*
|
|
15
|
+
* _
|
|
16
|
+
*/
|
|
17
|
+
debugLevel: number;
|
|
18
|
+
|
|
19
|
+
allowedUsers: 'all' | string[];
|
|
20
|
+
|
|
21
|
+
messageSettings: {
|
|
22
|
+
/**
|
|
23
|
+
* this setting will set the time limit for message fetching
|
|
24
|
+
* so we will stop fetching messages sent later than this time
|
|
25
|
+
*/
|
|
26
|
+
messageFetchTimeLimit: number;
|
|
27
|
+
/**
|
|
28
|
+
* this setting will set the count limit for message fetching
|
|
29
|
+
* so we will stop fetching messages after this count
|
|
30
|
+
*/
|
|
31
|
+
messageFetchCountLimit: number;
|
|
32
|
+
/**
|
|
33
|
+
* this setting will set the delay for message sending,
|
|
34
|
+
* so we won't flood the channel too fast
|
|
35
|
+
*/
|
|
36
|
+
messageSendDelay: number;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* this setting will be used to skip answering to messages
|
|
40
|
+
* if the message contains any of these flags, the bot will not answer
|
|
41
|
+
*
|
|
42
|
+
* @default [ '[BOT-SKIP]' ]
|
|
43
|
+
*/
|
|
44
|
+
skipFlags: string[];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* this setting will set the channel settings for the bot
|
|
49
|
+
*/
|
|
50
|
+
channelSettings: {
|
|
51
|
+
/**
|
|
52
|
+
* this setting will set the name of the channel where the bot will send the reports
|
|
53
|
+
*
|
|
54
|
+
* @default 'bot-report'
|
|
55
|
+
*/
|
|
56
|
+
reportChannelName: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* this setting will set the channels where the bot will answer automatically
|
|
60
|
+
* whenever a message is sent in one of these channels, that is not from the bot
|
|
61
|
+
*
|
|
62
|
+
* it will be populated automatically from the default channels
|
|
63
|
+
*/
|
|
64
|
+
allowedChannels: string[];
|
|
65
|
+
/**
|
|
66
|
+
* this setting will set if the bot can answer in Direct Messages Channels
|
|
67
|
+
*
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
70
|
+
dmIsAllowed: boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* this setting will set the default channels where the bot will answer automatically
|
|
74
|
+
* whenever a message is sent in one of these channels, that is not from the bot
|
|
75
|
+
*
|
|
76
|
+
* @default [ 'bot-report' ]
|
|
77
|
+
*/
|
|
78
|
+
defaultChannels: string[];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
commandSettings: {
|
|
82
|
+
commandOperator: string;
|
|
83
|
+
commands: DyNTS_Bot_Command[];
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
allowBotsInteractEachOther: boolean;
|
|
87
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface DyNTS_Bot_Message<T_PlatformMessage = 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_PlatformMessage; // Original platform message for platform-specific operations
|
|
14
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
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_Provider_Type } from '../_enums/bot-provider.enum';
|
|
7
|
+
import { DyNTS_Bot_Global_Settings } from './bot-global-settings.interface';
|
|
8
|
+
|
|
9
|
+
export interface DyNTS_Bot_Provider_Config extends DyNTS_Bot_Global_Settings {
|
|
10
|
+
provider: DyNTS_Bot_Provider_Type;
|
|
11
|
+
providerInstance?: DyNTS_Bot_Provider;
|
|
12
|
+
discord?: {
|
|
13
|
+
token: string;
|
|
14
|
+
guildId: string;
|
|
15
|
+
clientId: string;
|
|
16
|
+
oauth2Url: string;
|
|
17
|
+
};
|
|
18
|
+
slack?: {
|
|
19
|
+
token: string;
|
|
20
|
+
workspace: string;
|
|
21
|
+
};
|
|
22
|
+
teams?: {
|
|
23
|
+
appId: string;
|
|
24
|
+
appPassword: string;
|
|
25
|
+
tenantId: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface DyNTS_Bot_Provider<
|
|
30
|
+
T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
|
|
31
|
+
T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
|
|
32
|
+
T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>
|
|
33
|
+
> {
|
|
34
|
+
// Initialization
|
|
35
|
+
initialize(config: DyNTS_Bot_Provider_Config): Promise<void>;
|
|
36
|
+
login(token: string): Promise<void>;
|
|
37
|
+
|
|
38
|
+
// Channel operations
|
|
39
|
+
getChannelByName(name: string): Promise<T_PlatformChannel>;
|
|
40
|
+
sendMessageToChannelByName(channelName: string, message: string): Promise<T_PlatformMessage>;
|
|
41
|
+
getMessagesFromChannelByChannelName(channelName: string, limit?: number): Promise<T_PlatformMessage[]>;
|
|
42
|
+
getLastMessageInChannel(channelName: string): Promise<T_PlatformMessage>;
|
|
43
|
+
clearChannel(channelId: string): Promise<void>;
|
|
44
|
+
|
|
45
|
+
// Message operations
|
|
46
|
+
sendMessage(channelId: string, content: string): Promise<T_PlatformMessage>;
|
|
47
|
+
replyToMessage(messageId: string, channelId: string, content: string): Promise<T_PlatformMessage>;
|
|
48
|
+
sendTyping(channelId: string): Promise<void>;
|
|
49
|
+
fetchMessages(channelId: string, limit: number): Promise<T_PlatformMessage[]>;
|
|
50
|
+
fetchAllMessagesWithPaging(channelId: string, maxFetch?: number): Promise<T_PlatformMessage[]>;
|
|
51
|
+
deleteMessage(messageId: string, channelId: string): Promise<void>;
|
|
52
|
+
|
|
53
|
+
// User operations
|
|
54
|
+
getUserByName(username: string): Promise<T_PlatformUser>;
|
|
55
|
+
getUserMention(userId: string): string;
|
|
56
|
+
readMembersInChannel(channelName: string): Promise<T_PlatformUser[]>;
|
|
57
|
+
readMemberNamesInChannel(channelName: string): Promise<string[]>;
|
|
58
|
+
|
|
59
|
+
// Advanced message queries
|
|
60
|
+
getLastMessageSentBy(channelName: string, username: string): Promise<T_PlatformMessage>;
|
|
61
|
+
getLastMentionOf(channelName: string, username: string): Promise<T_PlatformMessage>;
|
|
62
|
+
readLastMessageDatesByMembers(channelName: string, memberNames: string[]): Promise<DyNTS_Bot_LastMessageDate[]>;
|
|
63
|
+
readLastMessageWithMemberNamePingInIt(channelName: string, users: T_PlatformUser[]): Promise<DyNTS_Bot_LastMentionDate[]>;
|
|
64
|
+
|
|
65
|
+
// Platform-specific features (optional, may return null/undefined for unsupported platforms)
|
|
66
|
+
getRoleByName?(roleName: string): any;
|
|
67
|
+
getRolePingByName?(roleName: string): Promise<string>;
|
|
68
|
+
getRolePingsByName?(roleNames: string[]): Promise<string>;
|
|
69
|
+
|
|
70
|
+
// Event binding
|
|
71
|
+
onMessage(handler: (message: T_PlatformMessage, issuer: string) => void): void;
|
|
72
|
+
onReady(handler: () => void): void;
|
|
73
|
+
onError(handler: (error: Error) => void): void;
|
|
74
|
+
|
|
75
|
+
// Metadata
|
|
76
|
+
getBotId(): string;
|
|
77
|
+
getBotDisplayName(): string;
|
|
78
|
+
getProviderName(): string;
|
|
79
|
+
isReady(): boolean;
|
|
80
|
+
}
|