@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.
Files changed (283) 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/assistant/_collections/ass-global-settings.const.d.ts +3 -0
  7. package/build/_modules/assistant/_collections/ass-global-settings.const.d.ts.map +1 -0
  8. package/build/_modules/assistant/_collections/ass-global-settings.const.js +15 -0
  9. package/build/_modules/assistant/_collections/ass-global-settings.const.js.map +1 -0
  10. package/build/_modules/assistant/_collections/ass.util.d.ts +16 -0
  11. package/build/_modules/assistant/_collections/ass.util.d.ts.map +1 -0
  12. package/build/_modules/assistant/_collections/ass.util.js +43 -0
  13. package/build/_modules/assistant/_collections/ass.util.js.map +1 -0
  14. package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts +14 -0
  15. package/build/_modules/assistant/_models/ass-global-settings.interface.d.ts.map +1 -0
  16. package/build/_modules/assistant/_models/ass-global-settings.interface.js +3 -0
  17. package/build/_modules/assistant/_models/ass-global-settings.interface.js.map +1 -0
  18. package/build/_modules/assistant/_services/ass-io.control-service.d.ts +23 -0
  19. package/build/_modules/assistant/_services/ass-io.control-service.d.ts.map +1 -0
  20. package/build/_modules/assistant/_services/ass-io.control-service.js +59 -0
  21. package/build/_modules/assistant/_services/ass-io.control-service.js.map +1 -0
  22. package/build/_modules/assistant/_services/ass-main.control-service.d.ts +15 -0
  23. package/build/_modules/assistant/_services/ass-main.control-service.d.ts.map +1 -0
  24. package/build/_modules/assistant/_services/ass-main.control-service.js +12 -0
  25. package/build/_modules/assistant/_services/ass-main.control-service.js.map +1 -0
  26. package/build/_modules/assistant/_services/ass.service-base.d.ts +31 -0
  27. package/build/_modules/assistant/_services/ass.service-base.d.ts.map +1 -0
  28. package/build/_modules/assistant/_services/ass.service-base.js +56 -0
  29. package/build/_modules/assistant/_services/ass.service-base.js.map +1 -0
  30. package/build/_modules/assistant/index.d.ts +7 -0
  31. package/build/_modules/assistant/index.d.ts.map +1 -0
  32. package/build/_modules/assistant/index.js +19 -0
  33. package/build/_modules/assistant/index.js.map +1 -0
  34. package/build/_modules/bot/_collections/bot-default-commands.const.d.ts +3 -0
  35. package/build/_modules/bot/_collections/bot-default-commands.const.d.ts.map +1 -0
  36. package/build/_modules/bot/_collections/bot-default-commands.const.js +14 -0
  37. package/build/_modules/bot/_collections/bot-default-commands.const.js.map +1 -0
  38. package/build/_modules/bot/_collections/bot-global-settings.const.d.ts +3 -0
  39. package/build/_modules/bot/_collections/bot-global-settings.const.d.ts.map +1 -0
  40. package/build/_modules/bot/_collections/bot-global-settings.const.js +32 -0
  41. package/build/_modules/bot/_collections/bot-global-settings.const.js.map +1 -0
  42. package/build/_modules/bot/_collections/bot-operations.util.d.ts +21 -0
  43. package/build/_modules/bot/_collections/bot-operations.util.d.ts.map +1 -0
  44. package/build/_modules/bot/_collections/bot-operations.util.js +74 -0
  45. package/build/_modules/bot/_collections/bot-operations.util.js.map +1 -0
  46. package/build/_modules/bot/_enums/bot-provider.enum.d.ts +7 -0
  47. package/build/_modules/bot/_enums/bot-provider.enum.d.ts.map +1 -0
  48. package/build/_modules/bot/_enums/bot-provider.enum.js +11 -0
  49. package/build/_modules/bot/_enums/bot-provider.enum.js.map +1 -0
  50. package/build/_modules/bot/_models/bot-channel.interface.d.ts +8 -0
  51. package/build/_modules/bot/_models/bot-channel.interface.d.ts.map +1 -0
  52. package/build/_modules/bot/_models/bot-channel.interface.js +3 -0
  53. package/build/_modules/bot/_models/bot-channel.interface.js.map +1 -0
  54. package/build/_modules/bot/_models/bot-command.interface.d.ts +8 -0
  55. package/build/_modules/bot/_models/bot-command.interface.d.ts.map +1 -0
  56. package/build/_modules/bot/_models/bot-command.interface.js +3 -0
  57. package/build/_modules/bot/_models/bot-command.interface.js.map +1 -0
  58. package/build/_modules/bot/_models/bot-global-settings.interface.d.ts +79 -0
  59. package/build/_modules/bot/_models/bot-global-settings.interface.d.ts.map +1 -0
  60. package/build/_modules/bot/_models/bot-global-settings.interface.js +3 -0
  61. package/build/_modules/bot/_models/bot-global-settings.interface.js.map +1 -0
  62. package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts +7 -0
  63. package/build/_modules/bot/_models/bot-last-mention-date.interface.d.ts.map +1 -0
  64. package/build/_modules/bot/_models/bot-last-mention-date.interface.js +3 -0
  65. package/build/_modules/bot/_models/bot-last-mention-date.interface.js.map +1 -0
  66. package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts +6 -0
  67. package/build/_modules/bot/_models/bot-last-message-date.interface.d.ts.map +1 -0
  68. package/build/_modules/bot/_models/bot-last-message-date.interface.js +3 -0
  69. package/build/_modules/bot/_models/bot-last-message-date.interface.js.map +1 -0
  70. package/build/_modules/bot/_models/bot-message.interface.d.ts +15 -0
  71. package/build/_modules/bot/_models/bot-message.interface.d.ts.map +1 -0
  72. package/build/_modules/bot/_models/bot-message.interface.js +3 -0
  73. package/build/_modules/bot/_models/bot-message.interface.js.map +1 -0
  74. package/build/_modules/bot/_models/bot-provider.interface.d.ts +60 -0
  75. package/build/_modules/bot/_models/bot-provider.interface.d.ts.map +1 -0
  76. package/build/_modules/bot/_models/bot-provider.interface.js +3 -0
  77. package/build/_modules/bot/_models/bot-provider.interface.js.map +1 -0
  78. package/build/_modules/bot/_models/bot-user.interface.d.ts +8 -0
  79. package/build/_modules/bot/_models/bot-user.interface.d.ts.map +1 -0
  80. package/build/_modules/bot/_models/bot-user.interface.js +3 -0
  81. package/build/_modules/bot/_models/bot-user.interface.js.map +1 -0
  82. package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts +11 -0
  83. package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.d.ts.map +1 -0
  84. package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js +13 -0
  85. package/build/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.js.map +1 -0
  86. package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts +5 -0
  87. package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.d.ts.map +1 -0
  88. package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js +19 -0
  89. package/build/_modules/bot/_modules/discord-bot/_collections/dib.util.js.map +1 -0
  90. package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts +8 -0
  91. package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.d.ts.map +1 -0
  92. package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js +3 -0
  93. package/build/_modules/bot/_modules/discord-bot/_models/dib-platform.types.js.map +1 -0
  94. package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts +53 -0
  95. package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.d.ts.map +1 -0
  96. package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js +369 -0
  97. package/build/_modules/bot/_modules/discord-bot/_services/dib-provider.service.js.map +1 -0
  98. package/build/_modules/bot/_modules/discord-bot/index.d.ts +5 -0
  99. package/build/_modules/bot/_modules/discord-bot/index.d.ts.map +1 -0
  100. package/build/_modules/bot/_modules/discord-bot/index.js +16 -0
  101. package/build/_modules/bot/_modules/discord-bot/index.js.map +1 -0
  102. package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts +11 -0
  103. package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.d.ts.map +1 -0
  104. package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js +13 -0
  105. package/build/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.js.map +1 -0
  106. package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts +7 -0
  107. package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.d.ts.map +1 -0
  108. package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js +3 -0
  109. package/build/_modules/bot/_modules/slack-bot/_models/slb-platform.types.js.map +1 -0
  110. package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts +40 -0
  111. package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.d.ts.map +1 -0
  112. package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js +116 -0
  113. package/build/_modules/bot/_modules/slack-bot/_services/slb-provider.service.js.map +1 -0
  114. package/build/_modules/bot/_modules/slack-bot/index.d.ts +4 -0
  115. package/build/_modules/bot/_modules/slack-bot/index.d.ts.map +1 -0
  116. package/build/_modules/bot/_modules/slack-bot/index.js +15 -0
  117. package/build/_modules/bot/_modules/slack-bot/index.js.map +1 -0
  118. package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts +11 -0
  119. package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.d.ts.map +1 -0
  120. package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js +13 -0
  121. package/build/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.js.map +1 -0
  122. package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts +7 -0
  123. package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.d.ts.map +1 -0
  124. package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js +3 -0
  125. package/build/_modules/bot/_modules/teams-bot/_models/teb-platform.types.js.map +1 -0
  126. package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts +40 -0
  127. package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.d.ts.map +1 -0
  128. package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js +116 -0
  129. package/build/_modules/bot/_modules/teams-bot/_services/teb-provider.service.js.map +1 -0
  130. package/build/_modules/bot/_modules/teams-bot/index.d.ts +4 -0
  131. package/build/_modules/bot/_modules/teams-bot/index.d.ts.map +1 -0
  132. package/build/_modules/bot/_modules/teams-bot/index.js +15 -0
  133. package/build/_modules/bot/_modules/teams-bot/index.js.map +1 -0
  134. package/build/_modules/bot/_services/bot-commands.control-service.d.ts +15 -0
  135. package/build/_modules/bot/_services/bot-commands.control-service.d.ts.map +1 -0
  136. package/build/_modules/bot/_services/bot-commands.control-service.js +72 -0
  137. package/build/_modules/bot/_services/bot-commands.control-service.js.map +1 -0
  138. package/build/_modules/bot/_services/bot-io.control-service.d.ts +24 -0
  139. package/build/_modules/bot/_services/bot-io.control-service.d.ts.map +1 -0
  140. package/build/_modules/bot/_services/bot-io.control-service.js +207 -0
  141. package/build/_modules/bot/_services/bot-io.control-service.js.map +1 -0
  142. package/build/_modules/bot/_services/bot-main.control-service.d.ts +42 -0
  143. package/build/_modules/bot/_services/bot-main.control-service.d.ts.map +1 -0
  144. package/build/_modules/bot/_services/bot-main.control-service.js +223 -0
  145. package/build/_modules/bot/_services/bot-main.control-service.js.map +1 -0
  146. package/build/_modules/bot/_services/bot-provider-factory.service.d.ts +5 -0
  147. package/build/_modules/bot/_services/bot-provider-factory.service.d.ts.map +1 -0
  148. package/build/_modules/bot/_services/bot-provider-factory.service.js +28 -0
  149. package/build/_modules/bot/_services/bot-provider-factory.service.js.map +1 -0
  150. package/build/_modules/bot/_services/bot-routines.control-service.d.ts +17 -0
  151. package/build/_modules/bot/_services/bot-routines.control-service.d.ts.map +1 -0
  152. package/build/_modules/bot/_services/bot-routines.control-service.js +40 -0
  153. package/build/_modules/bot/_services/bot-routines.control-service.js.map +1 -0
  154. package/build/_modules/bot/index.d.ts +21 -0
  155. package/build/_modules/bot/index.d.ts.map +1 -0
  156. package/build/_modules/bot/index.js +35 -0
  157. package/build/_modules/bot/index.js.map +1 -0
  158. package/build/_modules/defaults/_models/default-user.data-model.d.ts +20 -0
  159. package/build/_modules/defaults/_models/default-user.data-model.d.ts.map +1 -0
  160. package/build/_modules/defaults/_models/default-user.data-model.js +73 -0
  161. package/build/_modules/defaults/_models/default-user.data-model.js.map +1 -0
  162. package/build/_modules/defaults/_services/default-auth.service.d.ts +51 -0
  163. package/build/_modules/defaults/_services/default-auth.service.d.ts.map +1 -0
  164. package/build/_modules/defaults/_services/default-auth.service.js +159 -0
  165. package/build/_modules/defaults/_services/default-auth.service.js.map +1 -0
  166. package/build/_modules/defaults/_services/default-socket-events.service.d.ts +24 -0
  167. package/build/_modules/defaults/_services/default-socket-events.service.d.ts.map +1 -0
  168. package/build/_modules/defaults/_services/default-socket-events.service.js +61 -0
  169. package/build/_modules/defaults/_services/default-socket-events.service.js.map +1 -0
  170. package/build/_modules/defaults/_services/default-user.data-service.d.ts +25 -0
  171. package/build/_modules/defaults/_services/default-user.data-service.d.ts.map +1 -0
  172. package/build/_modules/defaults/_services/default-user.data-service.js +88 -0
  173. package/build/_modules/defaults/_services/default-user.data-service.js.map +1 -0
  174. package/build/_modules/defaults/index.d.ts +5 -0
  175. package/build/_modules/defaults/index.d.ts.map +1 -0
  176. package/build/_modules/defaults/index.js +16 -0
  177. package/build/_modules/defaults/index.js.map +1 -0
  178. package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts +6 -0
  179. package/build/_modules/messaging/_collections/msg-global-settings.const.d.ts.map +1 -0
  180. package/build/_modules/messaging/_collections/msg-global-settings.const.js +27 -0
  181. package/build/_modules/messaging/_collections/msg-global-settings.const.js.map +1 -0
  182. package/build/_modules/messaging/_collections/msg.util.d.ts +25 -0
  183. package/build/_modules/messaging/_collections/msg.util.d.ts.map +1 -0
  184. package/build/_modules/messaging/_collections/msg.util.js +63 -0
  185. package/build/_modules/messaging/_collections/msg.util.js.map +1 -0
  186. package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts +23 -0
  187. package/build/_modules/messaging/_enums/msg-event-key.enum.d.ts.map +1 -0
  188. package/build/_modules/messaging/_enums/msg-event-key.enum.js +32 -0
  189. package/build/_modules/messaging/_enums/msg-event-key.enum.js.map +1 -0
  190. package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts +38 -0
  191. package/build/_modules/messaging/_models/msg-global-settings.interface.d.ts.map +1 -0
  192. package/build/_modules/messaging/_models/msg-global-settings.interface.js +3 -0
  193. package/build/_modules/messaging/_models/msg-global-settings.interface.js.map +1 -0
  194. package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts +29 -0
  195. package/build/_modules/messaging/_services/msg-conversation.data-service.d.ts.map +1 -0
  196. package/build/_modules/messaging/_services/msg-conversation.data-service.js +110 -0
  197. package/build/_modules/messaging/_services/msg-conversation.data-service.js.map +1 -0
  198. package/build/_modules/messaging/_services/msg-events.service.d.ts +62 -0
  199. package/build/_modules/messaging/_services/msg-events.service.d.ts.map +1 -0
  200. package/build/_modules/messaging/_services/msg-events.service.js +204 -0
  201. package/build/_modules/messaging/_services/msg-events.service.js.map +1 -0
  202. package/build/_modules/messaging/_services/msg-integration.control-service.d.ts +26 -0
  203. package/build/_modules/messaging/_services/msg-integration.control-service.d.ts.map +1 -0
  204. package/build/_modules/messaging/_services/msg-integration.control-service.js +126 -0
  205. package/build/_modules/messaging/_services/msg-integration.control-service.js.map +1 -0
  206. package/build/_modules/messaging/_services/msg-main.control-service.d.ts +62 -0
  207. package/build/_modules/messaging/_services/msg-main.control-service.d.ts.map +1 -0
  208. package/build/_modules/messaging/_services/msg-main.control-service.js +408 -0
  209. package/build/_modules/messaging/_services/msg-main.control-service.js.map +1 -0
  210. package/build/_modules/messaging/_services/msg-message.data-service.d.ts +29 -0
  211. package/build/_modules/messaging/_services/msg-message.data-service.d.ts.map +1 -0
  212. package/build/_modules/messaging/_services/msg-message.data-service.js +104 -0
  213. package/build/_modules/messaging/_services/msg-message.data-service.js.map +1 -0
  214. package/build/_modules/messaging/get-messaging-routing-module.util.d.ts +8 -0
  215. package/build/_modules/messaging/get-messaging-routing-module.util.d.ts.map +1 -0
  216. package/build/_modules/messaging/get-messaging-routing-module.util.js +21 -0
  217. package/build/_modules/messaging/get-messaging-routing-module.util.js.map +1 -0
  218. package/build/_modules/messaging/index.d.ts +13 -0
  219. package/build/_modules/messaging/index.d.ts.map +1 -0
  220. package/build/_modules/messaging/index.js +30 -0
  221. package/build/_modules/messaging/index.js.map +1 -0
  222. package/build/_modules/messaging/messaging.controller.d.ts +13 -0
  223. package/build/_modules/messaging/messaging.controller.d.ts.map +1 -0
  224. package/build/_modules/messaging/messaging.controller.js +257 -0
  225. package/build/_modules/messaging/messaging.controller.js.map +1 -0
  226. package/package.json +71 -3
  227. package/src/_collections/global-settings.const.ts +2 -0
  228. package/src/_models/interfaces/global-settings.interface.ts +20 -2
  229. package/src/_modules/assistant/_collections/ass-global-settings.const.ts +13 -0
  230. package/src/_modules/assistant/_collections/ass.util.ts +50 -0
  231. package/src/_modules/assistant/_models/ass-global-settings.interface.ts +15 -0
  232. package/src/_modules/assistant/_services/ass-io.control-service.ts +100 -0
  233. package/src/_modules/assistant/_services/ass-main.control-service.ts +38 -0
  234. package/src/_modules/assistant/_services/ass.service-base.ts +92 -0
  235. package/src/_modules/assistant/index.ts +19 -0
  236. package/src/_modules/bot/_collections/bot-default-commands.const.ts +12 -0
  237. package/src/_modules/bot/_collections/bot-global-settings.const.ts +39 -0
  238. package/src/_modules/bot/_collections/bot-operations.util.ts +149 -0
  239. package/src/_modules/bot/_enums/bot-provider.enum.ts +6 -0
  240. package/src/_modules/bot/_models/bot-channel.interface.ts +7 -0
  241. package/src/_modules/bot/_models/bot-command.interface.ts +8 -0
  242. package/src/_modules/bot/_models/bot-global-settings.interface.ts +87 -0
  243. package/src/_modules/bot/_models/bot-last-mention-date.interface.ts +6 -0
  244. package/src/_modules/bot/_models/bot-last-message-date.interface.ts +5 -0
  245. package/src/_modules/bot/_models/bot-message.interface.ts +14 -0
  246. package/src/_modules/bot/_models/bot-provider.interface.ts +80 -0
  247. package/src/_modules/bot/_models/bot-user.interface.ts +7 -0
  248. package/src/_modules/bot/_modules/discord-bot/_collections/dib-operations.util.ts +18 -0
  249. package/src/_modules/bot/_modules/discord-bot/_collections/dib.util.ts +20 -0
  250. package/src/_modules/bot/_modules/discord-bot/_models/dib-platform.types.ts +9 -0
  251. package/src/_modules/bot/_modules/discord-bot/_services/dib-provider.service.ts +462 -0
  252. package/src/_modules/bot/_modules/discord-bot/index.ts +15 -0
  253. package/src/_modules/bot/_modules/slack-bot/_collections/slb-operations.util.ts +18 -0
  254. package/src/_modules/bot/_modules/slack-bot/_models/slb-platform.types.ts +9 -0
  255. package/src/_modules/bot/_modules/slack-bot/_services/slb-provider.service.ts +152 -0
  256. package/src/_modules/bot/_modules/slack-bot/index.ts +14 -0
  257. package/src/_modules/bot/_modules/teams-bot/_collections/teb-operations.util.ts +18 -0
  258. package/src/_modules/bot/_modules/teams-bot/_models/teb-platform.types.ts +9 -0
  259. package/src/_modules/bot/_modules/teams-bot/_services/teb-provider.service.ts +152 -0
  260. package/src/_modules/bot/_modules/teams-bot/index.ts +14 -0
  261. package/src/_modules/bot/_services/bot-commands.control-service.ts +126 -0
  262. package/src/_modules/bot/_services/bot-io.control-service.ts +325 -0
  263. package/src/_modules/bot/_services/bot-main.control-service.ts +344 -0
  264. package/src/_modules/bot/_services/bot-provider-factory.service.ts +30 -0
  265. package/src/_modules/bot/_services/bot-routines.control-service.ts +83 -0
  266. package/src/_modules/bot/index.ts +36 -0
  267. package/src/_modules/defaults/_models/default-user.data-model.ts +72 -0
  268. package/src/_modules/defaults/_services/default-auth.service.ts +177 -0
  269. package/src/_modules/defaults/_services/default-socket-events.service.ts +61 -0
  270. package/src/_modules/defaults/_services/default-user.data-service.ts +98 -0
  271. package/src/_modules/defaults/index.ts +14 -0
  272. package/src/_modules/messaging/_collections/msg-global-settings.const.ts +27 -0
  273. package/src/_modules/messaging/_collections/msg.util.ts +83 -0
  274. package/src/_modules/messaging/_enums/msg-event-key.enum.ts +31 -0
  275. package/src/_modules/messaging/_models/msg-global-settings.interface.ts +49 -0
  276. package/src/_modules/messaging/_services/msg-conversation.data-service.ts +146 -0
  277. package/src/_modules/messaging/_services/msg-events.service.ts +267 -0
  278. package/src/_modules/messaging/_services/msg-integration.control-service.ts +179 -0
  279. package/src/_modules/messaging/_services/msg-main.control-service.ts +548 -0
  280. package/src/_modules/messaging/_services/msg-message.data-service.ts +129 -0
  281. package/src/_modules/messaging/get-messaging-routing-module.util.ts +26 -0
  282. package/src/_modules/messaging/index.ts +33 -0
  283. package/src/_modules/messaging/messaging.controller.ts +370 -0
@@ -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
+ }
@@ -0,0 +1,344 @@
1
+ import { DyNTS_SingletonService } from '../../../_services/base/singleton.service';
2
+ import { DyFM_Async, DyFM_Error, DyFM_Log } from '@futdevpro/fsm-dynamo';
3
+ import { DyNTS_global_settings } from '../../../_collections/global-settings.const';
4
+ import { DyNTS_Bot_Provider } from '../_models/bot-provider.interface';
5
+ import { DyNTS_Bot_Message } from '../_models/bot-message.interface';
6
+ import { DyNTS_Bot_Channel } from '../_models/bot-channel.interface';
7
+ import { DyNTS_Bot_User } from '../_models/bot-user.interface';
8
+ import { DyNTS_Bot_Global_Settings } from '../_models/bot-global-settings.interface';
9
+ import { DyNTS_GlobalService } from '../../../_services/core/global.service';
10
+ import { DyNTS_Bot_IO_ControlService } from './bot-io.control-service';
11
+ import { DyNTS_Bot_Routines_ControlService } from './bot-routines.control-service';
12
+
13
+ /**
14
+ * This is the main control service for the Bot.
15
+ *
16
+ * Platform-agnostic bot service that works with any provider (Discord, Slack, Teams, etc.)
17
+ *
18
+ * Setup:
19
+ * 1. Configure provider in DyNTS_global_settings.bot_settings
20
+ * 2. Set provider type and credentials
21
+ * 3. Initialize the bot with setup()
22
+ */
23
+
24
+ export abstract class DyNTS_Bot_Main_ControlService<
25
+ T_PlatformChannel extends DyNTS_Bot_Channel<any> = DyNTS_Bot_Channel<any>,
26
+ T_PlatformMessage extends DyNTS_Bot_Message<any> = DyNTS_Bot_Message<any>,
27
+ T_PlatformUser extends DyNTS_Bot_User<any> = DyNTS_Bot_User<any>,
28
+ T_PlatformProvider extends DyNTS_Bot_Provider<
29
+ T_PlatformChannel,
30
+ T_PlatformMessage,
31
+ T_PlatformUser
32
+ > = DyNTS_Bot_Provider<
33
+ T_PlatformChannel,
34
+ T_PlatformMessage,
35
+ T_PlatformUser
36
+ >
37
+ > extends DyNTS_SingletonService {
38
+
39
+ protected _provider: T_PlatformProvider;
40
+
41
+ get provider(): T_PlatformProvider {
42
+ return this._provider;
43
+ }
44
+
45
+ get botClientId(): string {
46
+ return this.provider?.getBotId() ?? DyNTS_global_settings?.bot_settings?.discord?.clientId;
47
+ }
48
+
49
+ get botDisplayName(): string {
50
+ return this.provider?.getBotDisplayName();
51
+ }
52
+
53
+ protected abstract getBotIOControlService(): DyNTS_Bot_IO_ControlService<
54
+ T_PlatformChannel,
55
+ T_PlatformMessage,
56
+ T_PlatformUser,
57
+ T_PlatformProvider
58
+ >;
59
+ protected botIO_CS: DyNTS_Bot_IO_ControlService<
60
+ T_PlatformChannel,
61
+ T_PlatformMessage,
62
+ T_PlatformUser,
63
+ T_PlatformProvider
64
+ >;
65
+
66
+ protected abstract getRoutinesControlService(): DyNTS_Bot_Routines_ControlService<
67
+ T_PlatformChannel,
68
+ T_PlatformMessage,
69
+ T_PlatformUser,
70
+ T_PlatformProvider
71
+ >;
72
+ protected routines_CS: DyNTS_Bot_Routines_ControlService<
73
+ T_PlatformChannel,
74
+ T_PlatformMessage,
75
+ T_PlatformUser,
76
+ T_PlatformProvider
77
+ >;
78
+
79
+ protected abstract getProvider(): T_PlatformProvider;
80
+
81
+ private _channelsByNames: {
82
+ [key: string]: T_PlatformChannel;
83
+ } = {};
84
+
85
+ private _rolesByNames: {
86
+ [key: string]: any;
87
+ } = {};
88
+
89
+ protected debugLog = false;
90
+
91
+ protected constructor(
92
+ setupAutomatically?: boolean,
93
+ ) {
94
+ super();
95
+
96
+ if (this.provider) {
97
+ throw new DyFM_Error({
98
+ ...this.getDefaultErrorSettings(
99
+ 'start',
100
+ new Error('Bot provider already initialized'),
101
+ 'system-init'
102
+ ),
103
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-C000`,
104
+ })
105
+ }
106
+
107
+ this._provider = this.getProvider();
108
+ DyFM_Log.success('Bot provider initialized');
109
+
110
+ if (setupAutomatically) {
111
+ this.setup('system-init');
112
+ }
113
+ }
114
+
115
+ async setup(issuer: string): Promise<void> {
116
+ try {
117
+ await DyFM_Async.delay(100);
118
+
119
+ if (!DyNTS_global_settings.bot_settings?.provider) {
120
+ throw new Error(
121
+ `No bot provider configured!` +
122
+ `\nPlease set the provider in DyNTS_global_settings.bot_settings.provider` +
123
+ `\nSupported providers: 'discord', 'slack', 'teams', 'custom'`
124
+ );
125
+ }
126
+
127
+ if (!this.provider) {
128
+ throw new Error(
129
+ `No bot provider instance found!` +
130
+ `\nPlease ensure getProvider() returns a valid provider instance`
131
+ );
132
+ }
133
+
134
+ return new Promise((resolve, reject) => {
135
+ this.provider.onError((error) => {
136
+ if (DyNTS_global_settings.bot_settings?.debugLevel >= 1) {
137
+ DyFM_Error.logSimple('Bot provider error:', error);
138
+ }
139
+ DyNTS_GlobalService.globalErrorHandler(error);
140
+ reject(error);
141
+ });
142
+
143
+ if (this.debugLog) {
144
+ DyFM_Log.success('Error event registered\n\n', new Error().stack);
145
+ } else {
146
+ DyFM_Log.success('Error event registered');
147
+ }
148
+
149
+ this.provider.onReady(async () => {
150
+ if (DyNTS_global_settings.bot_settings?.debugLevel >= 1) {
151
+ DyFM_Log.success(`Bot logged in as ${this.botDisplayName}`)
152
+ }
153
+
154
+ await this.start(issuer);
155
+
156
+ DyFM_Log.success('Bot setup complete')
157
+ resolve();
158
+ });
159
+
160
+ if (this.debugLog) {
161
+ DyFM_Log.success('Ready event registered\n\n', new Error().stack);
162
+ } else {
163
+ DyFM_Log.success('Ready event registered');
164
+ }
165
+
166
+ this.provider.onMessage((message: T_PlatformMessage, messageIssuer: string) => {
167
+ try {
168
+ this.botIO_CS.handleNewMessage(message, messageIssuer)
169
+ } catch (error) {
170
+ DyFM_Error.logSimple('Error handling new message:', error);
171
+ }
172
+ });
173
+
174
+ if (this.debugLog) {
175
+ DyFM_Log.success('Message create event registered\n\n', new Error().stack);
176
+ } else {
177
+ DyFM_Log.success('Message create event registered');
178
+ }
179
+
180
+ process.on('exit', () => {
181
+ try {
182
+ DyFM_Log.warn('Bot is shutting down...')
183
+ this.sendMessageToChannelByName(
184
+ DyNTS_global_settings.bot_settings?.channelSettings?.reportChannelName || 'bot-reports',
185
+ `Bot is shutting down...`,
186
+ 'system-shutdown'
187
+ )
188
+ } catch (error) {
189
+ DyFM_Error.logSimple('Error sending message to report channel:', error);
190
+ }
191
+ });
192
+
193
+ if (this.debugLog) {
194
+ DyFM_Log.success('Exit event registered\n\n', new Error().stack);
195
+ } else {
196
+ DyFM_Log.success('Exit event registered');
197
+ }
198
+
199
+ // Initialize and login the provider
200
+ this.provider.initialize(DyNTS_global_settings.bot_settings).then(() => {
201
+ const token = this.getTokenForProvider();
202
+ return this.provider.login(token);
203
+ }).catch((error) => {
204
+ reject(error);
205
+ });
206
+ });
207
+ } catch (error) {
208
+ DyFM_Error.logSimple('Error during bot startup:', error);
209
+
210
+ throw new DyFM_Error({
211
+ ...this.getDefaultErrorSettings('start', error, issuer),
212
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-SE0`,
213
+ })
214
+ }
215
+ }
216
+
217
+ private getTokenForProvider(): string {
218
+ const provider = DyNTS_global_settings.bot_settings?.provider;
219
+ switch (provider) {
220
+ case 'discord':
221
+ return DyNTS_global_settings.bot_settings?.discord?.token;
222
+ case 'slack':
223
+ return DyNTS_global_settings.bot_settings?.slack?.token;
224
+ case 'teams':
225
+ return DyNTS_global_settings.bot_settings?.teams?.appPassword;
226
+ default:
227
+ throw new Error(`Unsupported provider: ${provider}`);
228
+ }
229
+ }
230
+
231
+ async start(issuer: string): Promise<void> {
232
+ try {
233
+ this.botIO_CS = this.getBotIOControlService();
234
+ this.routines_CS = this.getRoutinesControlService();
235
+
236
+ await this.routines_CS.start(issuer);
237
+ await this.botIO_CS.start(issuer);
238
+
239
+ DyFM_Log.success('Bot started')
240
+ } catch (error) {
241
+ DyFM_Error.logSimple('Error during bot start:', error);
242
+
243
+ throw new DyFM_Error({
244
+ ...this.getDefaultErrorSettings('start', error, issuer),
245
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-ST0`,
246
+ })
247
+ }
248
+ }
249
+
250
+ async getRolePingByName(roleName: string): Promise<string> {
251
+ const role = this.getRoleByName(roleName);
252
+
253
+ return role ? await this.provider.getRolePingByName?.(roleName) || '' : '';
254
+ }
255
+
256
+ async getRolePingsByName(roleNames: string[]): Promise<string> {
257
+ const pings: string[] = await Promise.all(
258
+ roleNames.map(roleName => this.getRolePingByName(roleName))
259
+ );
260
+
261
+ return pings.join(' ');
262
+ }
263
+
264
+ getRoleByName(roleName: string): any {
265
+ this._rolesByNames[roleName] ??= this.provider.getRoleByName?.(roleName);
266
+
267
+ return this._rolesByNames[roleName];
268
+ }
269
+
270
+ async getChannelByName(channelName: string): Promise<T_PlatformChannel> {
271
+ if (!this._channelsByNames[channelName]) {
272
+ this._channelsByNames[channelName] = await this.provider.getChannelByName(channelName);
273
+ }
274
+
275
+ return this._channelsByNames[channelName];
276
+ }
277
+
278
+ async sendMessageToChannelByName(
279
+ channelName: string,
280
+ message: string,
281
+ issuer: string,
282
+ ): Promise<T_PlatformMessage> {
283
+ try {
284
+ const channel = await this.getChannelByName(channelName);
285
+
286
+ if (!channel) {
287
+ throw new DyFM_Error({
288
+ ...this.getDefaultErrorSettings(
289
+ 'sendMessageToChannelByName',
290
+ new Error('Channel not found'),
291
+ issuer
292
+ ),
293
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-SMCN1`,
294
+ })
295
+ }
296
+
297
+ if (!channel.isTextBased) {
298
+ throw new DyFM_Error({
299
+ ...this.getDefaultErrorSettings(
300
+ 'sendMessageToChannelByName',
301
+ new Error('Channel is not a text channel'),
302
+ issuer
303
+ ),
304
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-SMCN2`,
305
+ })
306
+ }
307
+
308
+ return await this.provider.sendMessageToChannelByName(channelName, message);
309
+ } catch (error) {
310
+ DyFM_Error.logSimple('Error sending message to channel by name:', error);
311
+
312
+ throw new DyFM_Error({
313
+ ...this.getDefaultErrorSettings('sendMessageToChannelByName', error, issuer),
314
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-SMCN0`,
315
+ })
316
+ }
317
+ }
318
+
319
+ async clearChannel(
320
+ channel: T_PlatformChannel,
321
+ issuer: string,
322
+ ): Promise<void> {
323
+ try {
324
+ DyFM_Log.testInfo('Clearing channel... ', channel.name);
325
+
326
+ await this.provider.clearChannel(channel.id);
327
+
328
+ DyFM_Log.success('Channel cleared');
329
+
330
+ this.sendMessageToChannelByName(
331
+ channel.name,
332
+ '[SYSTEM|OPERATION|RESULT] Channel messages deletion completed successfully.',
333
+ issuer
334
+ );
335
+ } catch (error) {
336
+ DyFM_Error.logSimple('Error clearing channel:', error);
337
+
338
+ throw new DyFM_Error({
339
+ ...this.getDefaultErrorSettings('clearChannel', error, issuer),
340
+ errorCode: `${DyNTS_global_settings.systemShortCodeName}|DyNTS-Bot-MCS-CC0`,
341
+ })
342
+ }
343
+ }
344
+ }
@@ -0,0 +1,30 @@
1
+ import { DyNTS_Bot_Provider, DyNTS_Bot_Provider_Config } from '../_models/bot-provider.interface';
2
+ import { DyNTS_Bot_Provider_Type } from '../_enums/bot-provider.enum';
3
+ import { DyNTS_DiB_Provider } from '../_modules/discord-bot/_services/dib-provider.service';
4
+ import { DyNTS_SlB_Provider } from '../_modules/slack-bot/_services/slb-provider.service';
5
+ import { DyNTS_TeB_Provider } from '../_modules/teams-bot/_services/teb-provider.service';
6
+
7
+ export class DyNTS_Bot_Provider_Factory {
8
+
9
+ static createProvider(config: DyNTS_Bot_Provider_Config): DyNTS_Bot_Provider {
10
+ switch (config.provider) {
11
+ case DyNTS_Bot_Provider_Type.discord:
12
+ return new DyNTS_DiB_Provider();
13
+
14
+ case DyNTS_Bot_Provider_Type.slack:
15
+ return new DyNTS_SlB_Provider();
16
+
17
+ case DyNTS_Bot_Provider_Type.teams:
18
+ return new DyNTS_TeB_Provider();
19
+
20
+ case DyNTS_Bot_Provider_Type.custom:
21
+ if (!config.providerInstance) {
22
+ throw new Error('Custom provider instance is required when provider type is "custom"');
23
+ }
24
+ return config.providerInstance;
25
+
26
+ default:
27
+ throw new Error(`Unsupported provider type: ${config.provider}`);
28
+ }
29
+ }
30
+ }