@futdevpro/nts-dynamo 1.14.7 → 1.14.9

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