trompot 1.0.0

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 (357) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +560 -0
  3. package/lib/bot/BotBase.d.ts +82 -0
  4. package/lib/bot/BotBase.js +144 -0
  5. package/lib/bot/BotBase.js.map +1 -0
  6. package/lib/bot/BotEvents.d.ts +87 -0
  7. package/lib/bot/BotEvents.js +51 -0
  8. package/lib/bot/BotEvents.js.map +1 -0
  9. package/lib/bot/BotServer.d.ts +34 -0
  10. package/lib/bot/BotServer.js +118 -0
  11. package/lib/bot/BotServer.js.map +1 -0
  12. package/lib/bot/BotStatus.d.ts +4 -0
  13. package/lib/bot/BotStatus.js +9 -0
  14. package/lib/bot/BotStatus.js.map +1 -0
  15. package/lib/bot/IBot.d.ts +292 -0
  16. package/lib/bot/IBot.js +3 -0
  17. package/lib/bot/IBot.js.map +1 -0
  18. package/lib/bot/index.d.ts +5 -0
  19. package/lib/bot/index.js +13 -0
  20. package/lib/bot/index.js.map +1 -0
  21. package/lib/client/Client.d.ts +120 -0
  22. package/lib/client/Client.js +687 -0
  23. package/lib/client/Client.js.map +1 -0
  24. package/lib/client/ClientEvents.d.ts +147 -0
  25. package/lib/client/ClientEvents.js +93 -0
  26. package/lib/client/ClientEvents.js.map +1 -0
  27. package/lib/client/ClientFunctionHandler.d.ts +15 -0
  28. package/lib/client/ClientFunctionHandler.js +70 -0
  29. package/lib/client/ClientFunctionHandler.js.map +1 -0
  30. package/lib/client/ConnectionType.d.ts +4 -0
  31. package/lib/client/ConnectionType.js +3 -0
  32. package/lib/client/ConnectionType.js.map +1 -0
  33. package/lib/client/IAuth.d.ts +9 -0
  34. package/lib/client/IAuth.js +3 -0
  35. package/lib/client/IAuth.js.map +1 -0
  36. package/lib/client/IClient.d.ts +358 -0
  37. package/lib/client/IClient.js +3 -0
  38. package/lib/client/IClient.js.map +1 -0
  39. package/lib/client/index.d.ts +7 -0
  40. package/lib/client/index.js +13 -0
  41. package/lib/client/index.js.map +1 -0
  42. package/lib/cluster/ClientCluster.d.ts +428 -0
  43. package/lib/cluster/ClientCluster.js +1746 -0
  44. package/lib/cluster/ClientCluster.js.map +1 -0
  45. package/lib/cluster/WorkerMessage.d.ts +99 -0
  46. package/lib/cluster/WorkerMessage.js +84 -0
  47. package/lib/cluster/WorkerMessage.js.map +1 -0
  48. package/lib/cluster/index.d.ts +5 -0
  49. package/lib/cluster/index.js +27 -0
  50. package/lib/cluster/index.js.map +1 -0
  51. package/lib/configs/ConnectionConfig.d.ts +22 -0
  52. package/lib/configs/ConnectionConfig.js +3 -0
  53. package/lib/configs/ConnectionConfig.js.map +1 -0
  54. package/lib/configs/Defaults.d.ts +2 -0
  55. package/lib/configs/Defaults.js +16 -0
  56. package/lib/configs/Defaults.js.map +1 -0
  57. package/lib/configs/WAConfigs.d.ts +1 -0
  58. package/lib/configs/WAConfigs.js +5 -0
  59. package/lib/configs/WAConfigs.js.map +1 -0
  60. package/lib/configs/index.d.ts +3 -0
  61. package/lib/configs/index.js +18 -0
  62. package/lib/configs/index.js.map +1 -0
  63. package/lib/errors/ChatNotDefinedError.d.ts +4 -0
  64. package/lib/errors/ChatNotDefinedError.js +9 -0
  65. package/lib/errors/ChatNotDefinedError.js.map +1 -0
  66. package/lib/errors/ClientNotDefinedError.d.ts +4 -0
  67. package/lib/errors/ClientNotDefinedError.js +9 -0
  68. package/lib/errors/ClientNotDefinedError.js.map +1 -0
  69. package/lib/errors/UserNotDefinedError.d.ts +4 -0
  70. package/lib/errors/UserNotDefinedError.js +9 -0
  71. package/lib/errors/UserNotDefinedError.js.map +1 -0
  72. package/lib/index.d.ts +17 -0
  73. package/lib/index.js +60 -0
  74. package/lib/index.js.map +1 -0
  75. package/lib/messages/AudioMessage.d.ts +42 -0
  76. package/lib/messages/AudioMessage.js +66 -0
  77. package/lib/messages/AudioMessage.js.map +1 -0
  78. package/lib/messages/ButtonMessage.d.ts +88 -0
  79. package/lib/messages/ButtonMessage.js +137 -0
  80. package/lib/messages/ButtonMessage.js.map +1 -0
  81. package/lib/messages/ContactMessage.d.ts +37 -0
  82. package/lib/messages/ContactMessage.js +93 -0
  83. package/lib/messages/ContactMessage.js.map +1 -0
  84. package/lib/messages/CustomMessage.d.ts +35 -0
  85. package/lib/messages/CustomMessage.js +88 -0
  86. package/lib/messages/CustomMessage.js.map +1 -0
  87. package/lib/messages/EmptyMessage.d.ts +25 -0
  88. package/lib/messages/EmptyMessage.js +78 -0
  89. package/lib/messages/EmptyMessage.js.map +1 -0
  90. package/lib/messages/ErrorMessage.d.ts +35 -0
  91. package/lib/messages/ErrorMessage.js +86 -0
  92. package/lib/messages/ErrorMessage.js.map +1 -0
  93. package/lib/messages/FileMessage.d.ts +36 -0
  94. package/lib/messages/FileMessage.js +60 -0
  95. package/lib/messages/FileMessage.js.map +1 -0
  96. package/lib/messages/ImageMessage.d.ts +41 -0
  97. package/lib/messages/ImageMessage.js +65 -0
  98. package/lib/messages/ImageMessage.js.map +1 -0
  99. package/lib/messages/ListMessage.d.ts +91 -0
  100. package/lib/messages/ListMessage.js +126 -0
  101. package/lib/messages/ListMessage.js.map +1 -0
  102. package/lib/messages/LocationMessage.d.ts +48 -0
  103. package/lib/messages/LocationMessage.js +107 -0
  104. package/lib/messages/LocationMessage.js.map +1 -0
  105. package/lib/messages/MediaMessage.d.ts +54 -0
  106. package/lib/messages/MediaMessage.js +113 -0
  107. package/lib/messages/MediaMessage.js.map +1 -0
  108. package/lib/messages/Message.d.ts +144 -0
  109. package/lib/messages/Message.js +223 -0
  110. package/lib/messages/Message.js.map +1 -0
  111. package/lib/messages/PollMessage.d.ts +87 -0
  112. package/lib/messages/PollMessage.js +145 -0
  113. package/lib/messages/PollMessage.js.map +1 -0
  114. package/lib/messages/PollUpdateMessage.d.ts +40 -0
  115. package/lib/messages/PollUpdateMessage.js +98 -0
  116. package/lib/messages/PollUpdateMessage.js.map +1 -0
  117. package/lib/messages/ReactionMessage.d.ts +36 -0
  118. package/lib/messages/ReactionMessage.js +91 -0
  119. package/lib/messages/ReactionMessage.js.map +1 -0
  120. package/lib/messages/StickerMessage.d.ts +49 -0
  121. package/lib/messages/StickerMessage.js +73 -0
  122. package/lib/messages/StickerMessage.js.map +1 -0
  123. package/lib/messages/TextMessage.d.ts +33 -0
  124. package/lib/messages/TextMessage.js +84 -0
  125. package/lib/messages/TextMessage.js.map +1 -0
  126. package/lib/messages/VideoMessage.d.ts +42 -0
  127. package/lib/messages/VideoMessage.js +66 -0
  128. package/lib/messages/VideoMessage.js.map +1 -0
  129. package/lib/messages/index.d.ts +19 -0
  130. package/lib/messages/index.js +81 -0
  131. package/lib/messages/index.js.map +1 -0
  132. package/lib/models/Address.d.ts +11 -0
  133. package/lib/models/Address.js +18 -0
  134. package/lib/models/Address.js.map +1 -0
  135. package/lib/models/Call.d.ts +68 -0
  136. package/lib/models/Call.js +127 -0
  137. package/lib/models/Call.js.map +1 -0
  138. package/lib/modules/chat/Chat.d.ts +142 -0
  139. package/lib/modules/chat/Chat.js +246 -0
  140. package/lib/modules/chat/Chat.js.map +1 -0
  141. package/lib/modules/chat/ChatAction.d.ts +3 -0
  142. package/lib/modules/chat/ChatAction.js +3 -0
  143. package/lib/modules/chat/ChatAction.js.map +1 -0
  144. package/lib/modules/chat/ChatStatus.d.ts +9 -0
  145. package/lib/modules/chat/ChatStatus.js +13 -0
  146. package/lib/modules/chat/ChatStatus.js.map +1 -0
  147. package/lib/modules/chat/ChatType.d.ts +7 -0
  148. package/lib/modules/chat/ChatType.js +11 -0
  149. package/lib/modules/chat/ChatType.js.map +1 -0
  150. package/lib/modules/chat/index.d.ts +5 -0
  151. package/lib/modules/chat/index.js +13 -0
  152. package/lib/modules/chat/index.js.map +1 -0
  153. package/lib/modules/command/Command.d.ts +67 -0
  154. package/lib/modules/command/Command.js +139 -0
  155. package/lib/modules/command/Command.js.map +1 -0
  156. package/lib/modules/command/CommandController.d.ts +50 -0
  157. package/lib/modules/command/CommandController.js +119 -0
  158. package/lib/modules/command/CommandController.js.map +1 -0
  159. package/lib/modules/command/CommandControllerEvent.d.ts +9 -0
  160. package/lib/modules/command/CommandControllerEvent.js +25 -0
  161. package/lib/modules/command/CommandControllerEvent.js.map +1 -0
  162. package/lib/modules/command/CommandEnums.d.ts +14 -0
  163. package/lib/modules/command/CommandEnums.js +20 -0
  164. package/lib/modules/command/CommandEnums.js.map +1 -0
  165. package/lib/modules/command/CommandKey.d.ts +17 -0
  166. package/lib/modules/command/CommandKey.js +67 -0
  167. package/lib/modules/command/CommandKey.js.map +1 -0
  168. package/lib/modules/command/CommandPermission.d.ts +9 -0
  169. package/lib/modules/command/CommandPermission.js +35 -0
  170. package/lib/modules/command/CommandPermission.js.map +1 -0
  171. package/lib/modules/command/ICommandControllerConfig.d.ts +7 -0
  172. package/lib/modules/command/ICommandControllerConfig.js +3 -0
  173. package/lib/modules/command/ICommandControllerConfig.js.map +1 -0
  174. package/lib/modules/command/advanced/AdvancedCommand.d.ts +23 -0
  175. package/lib/modules/command/advanced/AdvancedCommand.js +131 -0
  176. package/lib/modules/command/advanced/AdvancedCommand.js.map +1 -0
  177. package/lib/modules/command/advanced/AdvancedCommandContext.d.ts +10 -0
  178. package/lib/modules/command/advanced/AdvancedCommandContext.js +3 -0
  179. package/lib/modules/command/advanced/AdvancedCommandContext.js.map +1 -0
  180. package/lib/modules/command/advanced/AdvancedCommandController.d.ts +29 -0
  181. package/lib/modules/command/advanced/AdvancedCommandController.js +118 -0
  182. package/lib/modules/command/advanced/AdvancedCommandController.js.map +1 -0
  183. package/lib/modules/command/advanced/AdvancedCommandData.d.ts +6 -0
  184. package/lib/modules/command/advanced/AdvancedCommandData.js +3 -0
  185. package/lib/modules/command/advanced/AdvancedCommandData.js.map +1 -0
  186. package/lib/modules/command/advanced/AdvancedCommandJob.d.ts +12 -0
  187. package/lib/modules/command/advanced/AdvancedCommandJob.js +3 -0
  188. package/lib/modules/command/advanced/AdvancedCommandJob.js.map +1 -0
  189. package/lib/modules/command/advanced/AdvancedCommandNext.d.ts +4 -0
  190. package/lib/modules/command/advanced/AdvancedCommandNext.js +3 -0
  191. package/lib/modules/command/advanced/AdvancedCommandNext.js.map +1 -0
  192. package/lib/modules/command/advanced/AdvancedCommandOptions.d.ts +8 -0
  193. package/lib/modules/command/advanced/AdvancedCommandOptions.js +3 -0
  194. package/lib/modules/command/advanced/AdvancedCommandOptions.js.map +1 -0
  195. package/lib/modules/command/advanced/AdvancedCommandStart.d.ts +11 -0
  196. package/lib/modules/command/advanced/AdvancedCommandStart.js +3 -0
  197. package/lib/modules/command/advanced/AdvancedCommandStart.js.map +1 -0
  198. package/lib/modules/command/advanced/AdvancedCommandStop.d.ts +3 -0
  199. package/lib/modules/command/advanced/AdvancedCommandStop.js +3 -0
  200. package/lib/modules/command/advanced/AdvancedCommandStop.js.map +1 -0
  201. package/lib/modules/command/advanced/AdvancedCommandTask.d.ts +2 -0
  202. package/lib/modules/command/advanced/AdvancedCommandTask.js +3 -0
  203. package/lib/modules/command/advanced/AdvancedCommandTask.js.map +1 -0
  204. package/lib/modules/command/defaults.d.ts +2 -0
  205. package/lib/modules/command/defaults.js +8 -0
  206. package/lib/modules/command/defaults.js.map +1 -0
  207. package/lib/modules/command/index.d.ts +12 -0
  208. package/lib/modules/command/index.js +36 -0
  209. package/lib/modules/command/index.js.map +1 -0
  210. package/lib/modules/command/keys.d.ts +9 -0
  211. package/lib/modules/command/keys.js +27 -0
  212. package/lib/modules/command/keys.js.map +1 -0
  213. package/lib/modules/command/perms.d.ts +2 -0
  214. package/lib/modules/command/perms.js +11 -0
  215. package/lib/modules/command/perms.js.map +1 -0
  216. package/lib/modules/quickResponse/QuickResponse.d.ts +49 -0
  217. package/lib/modules/quickResponse/QuickResponse.js +64 -0
  218. package/lib/modules/quickResponse/QuickResponse.js.map +1 -0
  219. package/lib/modules/quickResponse/QuickResponseController.d.ts +55 -0
  220. package/lib/modules/quickResponse/QuickResponseController.js +125 -0
  221. package/lib/modules/quickResponse/QuickResponseController.js.map +1 -0
  222. package/lib/modules/quickResponse/QuickResponseOptions.d.ts +56 -0
  223. package/lib/modules/quickResponse/QuickResponseOptions.js +76 -0
  224. package/lib/modules/quickResponse/QuickResponseOptions.js.map +1 -0
  225. package/lib/modules/quickResponse/QuickResponsePattern.d.ts +28 -0
  226. package/lib/modules/quickResponse/QuickResponsePattern.js +3 -0
  227. package/lib/modules/quickResponse/QuickResponsePattern.js.map +1 -0
  228. package/lib/modules/quickResponse/QuickResponseReply.d.ts +6 -0
  229. package/lib/modules/quickResponse/QuickResponseReply.js +3 -0
  230. package/lib/modules/quickResponse/QuickResponseReply.js.map +1 -0
  231. package/lib/modules/quickResponse/index.d.ts +6 -0
  232. package/lib/modules/quickResponse/index.js +13 -0
  233. package/lib/modules/quickResponse/index.js.map +1 -0
  234. package/lib/modules/user/User.d.ts +91 -0
  235. package/lib/modules/user/User.js +173 -0
  236. package/lib/modules/user/User.js.map +1 -0
  237. package/lib/modules/user/UserAction.d.ts +4 -0
  238. package/lib/modules/user/UserAction.js +3 -0
  239. package/lib/modules/user/UserAction.js.map +1 -0
  240. package/lib/modules/user/UserEvent.d.ts +3 -0
  241. package/lib/modules/user/UserEvent.js +3 -0
  242. package/lib/modules/user/UserEvent.js.map +1 -0
  243. package/lib/modules/user/index.d.ts +4 -0
  244. package/lib/modules/user/index.js +9 -0
  245. package/lib/modules/user/index.js.map +1 -0
  246. package/lib/routes/botServer/api/v1/emitEvent.d.ts +3 -0
  247. package/lib/routes/botServer/api/v1/emitEvent.js +17 -0
  248. package/lib/routes/botServer/api/v1/emitEvent.js.map +1 -0
  249. package/lib/routes/botServer/api/v1/function.d.ts +3 -0
  250. package/lib/routes/botServer/api/v1/function.js +22 -0
  251. package/lib/routes/botServer/api/v1/function.js.map +1 -0
  252. package/lib/routes/botServer/api/v1/ping.d.ts +3 -0
  253. package/lib/routes/botServer/api/v1/ping.js +12 -0
  254. package/lib/routes/botServer/api/v1/ping.js.map +1 -0
  255. package/lib/routes/botServer/api/v1/register.d.ts +3 -0
  256. package/lib/routes/botServer/api/v1/register.js +23 -0
  257. package/lib/routes/botServer/api/v1/register.js.map +1 -0
  258. package/lib/routes/botServer/api/v1/setValue.d.ts +3 -0
  259. package/lib/routes/botServer/api/v1/setValue.js +18 -0
  260. package/lib/routes/botServer/api/v1/setValue.js.map +1 -0
  261. package/lib/routes/botServer/api/v1/unregister.d.ts +3 -0
  262. package/lib/routes/botServer/api/v1/unregister.js +22 -0
  263. package/lib/routes/botServer/api/v1/unregister.js.map +1 -0
  264. package/lib/routes/botServer/middlewares/setBotServer.d.ts +4 -0
  265. package/lib/routes/botServer/middlewares/setBotServer.js +16 -0
  266. package/lib/routes/botServer/middlewares/setBotServer.js.map +1 -0
  267. package/lib/routes/botServer/routes.d.ts +8 -0
  268. package/lib/routes/botServer/routes.js +33 -0
  269. package/lib/routes/botServer/routes.js.map +1 -0
  270. package/lib/services/AddressService.d.ts +12 -0
  271. package/lib/services/AddressService.js +51 -0
  272. package/lib/services/AddressService.js.map +1 -0
  273. package/lib/services/BaseService.d.ts +5 -0
  274. package/lib/services/BaseService.js +19 -0
  275. package/lib/services/BaseService.js.map +1 -0
  276. package/lib/services/index.d.ts +3 -0
  277. package/lib/services/index.js +11 -0
  278. package/lib/services/index.js.map +1 -0
  279. package/lib/telegram/TelegramAuth.d.ts +17 -0
  280. package/lib/telegram/TelegramAuth.js +96 -0
  281. package/lib/telegram/TelegramAuth.js.map +1 -0
  282. package/lib/telegram/TelegramBot.d.ts +88 -0
  283. package/lib/telegram/TelegramBot.js +345 -0
  284. package/lib/telegram/TelegramBot.js.map +1 -0
  285. package/lib/telegram/TelegramEvents.d.ts +13 -0
  286. package/lib/telegram/TelegramEvents.js +131 -0
  287. package/lib/telegram/TelegramEvents.js.map +1 -0
  288. package/lib/telegram/TelegramSendingController.d.ts +36 -0
  289. package/lib/telegram/TelegramSendingController.js +213 -0
  290. package/lib/telegram/TelegramSendingController.js.map +1 -0
  291. package/lib/telegram/TelegramToRompotConverter.d.ts +22 -0
  292. package/lib/telegram/TelegramToRompotConverter.js +226 -0
  293. package/lib/telegram/TelegramToRompotConverter.js.map +1 -0
  294. package/lib/telegram/TelegramUtils.d.ts +14 -0
  295. package/lib/telegram/TelegramUtils.js +98 -0
  296. package/lib/telegram/TelegramUtils.js.map +1 -0
  297. package/lib/telegram/index.d.ts +7 -0
  298. package/lib/telegram/index.js +19 -0
  299. package/lib/telegram/index.js.map +1 -0
  300. package/lib/utils/ClientUtils.d.ts +27 -0
  301. package/lib/utils/ClientUtils.js +62 -0
  302. package/lib/utils/ClientUtils.js.map +1 -0
  303. package/lib/utils/Generic.d.ts +47 -0
  304. package/lib/utils/Generic.js +173 -0
  305. package/lib/utils/Generic.js.map +1 -0
  306. package/lib/utils/Libs.d.ts +10 -0
  307. package/lib/utils/Libs.js +55 -0
  308. package/lib/utils/Libs.js.map +1 -0
  309. package/lib/utils/MessageHandler.d.ts +54 -0
  310. package/lib/utils/MessageHandler.js +81 -0
  311. package/lib/utils/MessageHandler.js.map +1 -0
  312. package/lib/utils/MessageUtils.d.ts +3 -0
  313. package/lib/utils/MessageUtils.js +114 -0
  314. package/lib/utils/MessageUtils.js.map +1 -0
  315. package/lib/utils/index.d.ts +6 -0
  316. package/lib/utils/index.js +27 -0
  317. package/lib/utils/index.js.map +1 -0
  318. package/lib/utils/nonce.d.ts +1 -0
  319. package/lib/utils/nonce.js +16 -0
  320. package/lib/utils/nonce.js.map +1 -0
  321. package/lib/utils/server.d.ts +33 -0
  322. package/lib/utils/server.js +75 -0
  323. package/lib/utils/server.js.map +1 -0
  324. package/lib/wa/Auth.d.ts +19 -0
  325. package/lib/wa/Auth.js +123 -0
  326. package/lib/wa/Auth.js.map +1 -0
  327. package/lib/wa/ConfigWAEvents.d.ts +22 -0
  328. package/lib/wa/ConfigWAEvents.js +526 -0
  329. package/lib/wa/ConfigWAEvents.js.map +1 -0
  330. package/lib/wa/ConvertToWAMessage.d.ts +67 -0
  331. package/lib/wa/ConvertToWAMessage.js +403 -0
  332. package/lib/wa/ConvertToWAMessage.js.map +1 -0
  333. package/lib/wa/ConvertWAMessage.d.ts +108 -0
  334. package/lib/wa/ConvertWAMessage.js +527 -0
  335. package/lib/wa/ConvertWAMessage.js.map +1 -0
  336. package/lib/wa/ID.d.ts +4 -0
  337. package/lib/wa/ID.js +19 -0
  338. package/lib/wa/ID.js.map +1 -0
  339. package/lib/wa/WAMessage.d.ts +3 -0
  340. package/lib/wa/WAMessage.js +8 -0
  341. package/lib/wa/WAMessage.js.map +1 -0
  342. package/lib/wa/WAModule.d.ts +3 -0
  343. package/lib/wa/WAModule.js +3 -0
  344. package/lib/wa/WAModule.js.map +1 -0
  345. package/lib/wa/WAStatus.d.ts +3 -0
  346. package/lib/wa/WAStatus.js +15 -0
  347. package/lib/wa/WAStatus.js.map +1 -0
  348. package/lib/wa/WhatsAppBot.d.ts +188 -0
  349. package/lib/wa/WhatsAppBot.js +980 -0
  350. package/lib/wa/WhatsAppBot.js.map +1 -0
  351. package/lib/wa/index.d.ts +12 -0
  352. package/lib/wa/index.js +37 -0
  353. package/lib/wa/index.js.map +1 -0
  354. package/lib/wa/makeInMemoryStore.d.ts +43 -0
  355. package/lib/wa/makeInMemoryStore.js +430 -0
  356. package/lib/wa/makeInMemoryStore.js.map +1 -0
  357. package/package.json +79 -0
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const ClientNotDefinedError_1 = __importDefault(require("../../errors/ClientNotDefinedError"));
7
+ const ClientUtils_1 = require("../../utils/ClientUtils");
8
+ class User {
9
+ /** Obter o cliente do chat */
10
+ get client() {
11
+ if (!this.clientId) {
12
+ throw new ClientNotDefinedError_1.default();
13
+ }
14
+ return ClientUtils_1.ClientUtils.getClient(this.clientId);
15
+ }
16
+ /**
17
+ * Cria uma instância de User.
18
+ * @param id - O ID do usuário.
19
+ * @param name - O nome do usuário (opcional, padrão é uma string vazia).
20
+ */
21
+ constructor(id, name) {
22
+ /** ID do bot associado a este usuário */
23
+ this.botId = '';
24
+ /** ID do cliente associado a este usuário */
25
+ this.clientId = '';
26
+ /** ID do usuário */
27
+ this.id = '';
28
+ this.id = id;
29
+ if (name) {
30
+ this.name = name;
31
+ }
32
+ }
33
+ /** Bloqueia o usuário. */
34
+ async blockUser() {
35
+ await this.client.blockUser(this);
36
+ }
37
+ /** Desbloqueia o usuário. */
38
+ async unblockUser() {
39
+ await this.client.unblockUser(this);
40
+ }
41
+ /** Retorna o nome do usuário. */
42
+ async getName() {
43
+ return this.client.getUserName(this);
44
+ }
45
+ /**
46
+ * Define o nome do usuário.
47
+ * @param name - O novo nome para definir.
48
+ */
49
+ async setName(name) {
50
+ await this.client.setUserName(this, name);
51
+ }
52
+ /** Retorna a descrição do usuário. */
53
+ async getDescription() {
54
+ return this.client.getUserDescription(this);
55
+ }
56
+ /**
57
+ * Define a descrição do usuário.
58
+ * @param description - A nova descrição para definir.
59
+ */
60
+ async setDescription(description) {
61
+ await this.client.setUserDescription(this, description);
62
+ }
63
+ /** Retorna o perfil do usuário. */
64
+ async getProfile() {
65
+ return this.client.getUserProfile(this);
66
+ }
67
+ /**
68
+ * Define o perfil do usuário.
69
+ * @param image - O novo perfil para definir como um Buffer.
70
+ */
71
+ async setProfile(image) {
72
+ await this.client.setUserProfile(this, image);
73
+ }
74
+ /**
75
+ * Verifica se o usuário é um administrador de um chat.
76
+ * @param chat - O chat ou ID do chat a ser verificado.
77
+ */
78
+ async isAdmin(chat) {
79
+ const admins = await this.client.getChatAdmins(chat);
80
+ return admins.includes(this.id);
81
+ }
82
+ /**
83
+ * Verifica se o usuário é o líder de um chat.
84
+ * @param chat - O chat ou ID do chat a ser verificado.
85
+ */
86
+ async isLeader(chat) {
87
+ const leader = await this.client.getChatLeader(chat);
88
+ return (leader === null || leader === void 0 ? void 0 : leader.id) == this.id;
89
+ }
90
+ /**
91
+ * Converte o objeto atual para uma representação em formato JSON.
92
+ * @returns Um objeto JSON que representa o estado atual do objeto.
93
+ */
94
+ toJSON() {
95
+ const data = {};
96
+ for (const [key, value] of Object.entries(this)) {
97
+ if (key == 'toJSON')
98
+ continue;
99
+ data[key] = value;
100
+ }
101
+ return JSON.parse(JSON.stringify(data));
102
+ }
103
+ /**
104
+ * Cria uma instância de User a partir de uma representação em formato JSON.
105
+ * @param data - Os dados JSON a serem usados para criar a instância.
106
+ */
107
+ static fromJSON(data) {
108
+ if (!data || typeof data != 'object') {
109
+ return new User('');
110
+ }
111
+ const user = new User('');
112
+ if (data.botId)
113
+ user.botId = data.botId;
114
+ if (data.clientId)
115
+ user.clientId = data.clientId;
116
+ if (data.id)
117
+ user.id = data.id;
118
+ if (data.name)
119
+ user.name = data.name;
120
+ if (data.savedName)
121
+ user.phoneNumber = data.phoneNumber;
122
+ if (data.phoneNumber)
123
+ user.phoneNumber = data.phoneNumber;
124
+ if (data.description)
125
+ user.description = data.description;
126
+ if (data.profileUrl)
127
+ user.profileUrl = data.profileUrl;
128
+ if (data.nickname)
129
+ user.nickname = data.nickname;
130
+ return user;
131
+ }
132
+ /**
133
+ * Retorna uma instância de User com base em um ID e/ou dados passados.
134
+ * @param user - O ID do usuário ou uma instância existente de User.
135
+ * @param data - Dados que serão aplicados no usuário.
136
+ */
137
+ static apply(user, data) {
138
+ if (!user || typeof user != 'object') {
139
+ user = new User(`${user}`);
140
+ }
141
+ else {
142
+ user = User.fromJSON(user);
143
+ }
144
+ for (const key of Object.keys(data || {})) {
145
+ user[key] = data === null || data === void 0 ? void 0 : data[key];
146
+ }
147
+ return user;
148
+ }
149
+ /**
150
+ * Retorna o ID de um usuário.
151
+ * @param user - O usuário ou ID do usuário de onde obter o ID.
152
+ * @returns O ID do usuário como uma string, ou uma string vazia se o usuário for inválido.
153
+ */
154
+ static getId(user) {
155
+ if (typeof user === 'object') {
156
+ return user === null || user === void 0 ? void 0 : user.id;
157
+ }
158
+ if (typeof user === 'string') {
159
+ return user;
160
+ }
161
+ return undefined;
162
+ }
163
+ /**
164
+ * Verifica se um objeto é uma instância válida de User.
165
+ * @param user - O objeto a ser verificado.
166
+ */
167
+ static isValid(user) {
168
+ return (typeof user === 'object' &&
169
+ Object.keys(new User('')).every((key) => key in user));
170
+ }
171
+ }
172
+ exports.default = User;
173
+ //# sourceMappingURL=User.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/modules/user/User.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,4 @@
1
+ import type UserEvent from "./UserEvent";
2
+ /** Ação relacionada aos usuários. */
3
+ type UserAction = "join" | "leave" | UserEvent;
4
+ export default UserAction;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=UserAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserAction.js","sourceRoot":"","sources":["../../../src/modules/user/UserAction.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ /** Evento relacionado aos usuários. */
2
+ type UserEvent = "add" | "remove" | "promote" | "demote";
3
+ export default UserEvent;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=UserEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserEvent.js","sourceRoot":"","sources":["../../../src/modules/user/UserEvent.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type UserAction from "./UserAction";
2
+ import type UserEvent from "./UserEvent";
3
+ import User from "./User";
4
+ export { User, UserEvent, UserAction };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.User = void 0;
7
+ const User_1 = __importDefault(require("./User"));
8
+ exports.User = User_1.default;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/user/index.ts"],"names":[],"mappings":";;;;;;AAEA,kDAA0B;AAEjB,eAFF,cAAI,CAEE"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from "express";
2
+ declare const _default: (req: Request, res: Response) => void;
3
+ export default _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const server_1 = require("../../../../utils/server");
4
+ exports.default = (req, res) => {
5
+ try {
6
+ const { key, args } = req.body;
7
+ if (!key || !args || !Array.isArray(args) || args.length == 0) {
8
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Invalid request", {}), req["botServer"].options);
9
+ }
10
+ req["botServer"].emit(key, args[0]);
11
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(200, "OK", {}), req["botServer"].options);
12
+ }
13
+ catch (error) {
14
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generateError(error), req["botServer"].options);
15
+ }
16
+ };
17
+ //# sourceMappingURL=emitEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emitEvent.js","sourceRoot":"","sources":["../../../../../src/routes/botServer/api/v1/emitEvent.ts"],"names":[],"mappings":";;AAEA,qDAA0D;AAE1D,kBAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAE/B,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC9D,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;QAC1G,CAAC;QAED,GAAG,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpC,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7F,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from "express";
2
+ declare const _default: (req: Request, res: Response) => Promise<void>;
3
+ export default _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const server_1 = require("../../../../utils/server");
4
+ exports.default = async (req, res) => {
5
+ try {
6
+ const { key, args } = req.body;
7
+ if (!key || !args || !Array.isArray(args)) {
8
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Invalid request", {}), req["botServer"].options);
9
+ return;
10
+ }
11
+ if (typeof req["botServer"].bot[key] != "function") {
12
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Key not is function", {}), req["botServer"].options);
13
+ return;
14
+ }
15
+ const value = await req["botServer"].bot[key](...args);
16
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(200, "OK", { value }), req["botServer"].options);
17
+ }
18
+ catch (error) {
19
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generateError(error), req["botServer"].options);
20
+ }
21
+ };
22
+ //# sourceMappingURL=function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../../src/routes/botServer/api/v1/function.ts"],"names":[],"mappings":";;AAEA,qDAA0D;AAE1D,kBAAe,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;IACnD,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAE/B,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;YAExG,OAAO;QACT,CAAC;QAED,IAAI,OAAO,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,UAAU,EAAE,CAAC;YACnD,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,qBAAqB,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;YAE5G,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAEvD,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IACpG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from "express";
2
+ declare const _default: (req: Request, res: Response) => void;
3
+ export default _default;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const server_1 = require("../../../../utils/server");
4
+ exports.default = (req, res) => {
5
+ try {
6
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(200, `PING ${new Date().toISOString()}`, {}), req["botServer"].options);
7
+ }
8
+ catch (error) {
9
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generateError(error), req["botServer"].options);
10
+ }
11
+ };
12
+ //# sourceMappingURL=ping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ping.js","sourceRoot":"","sources":["../../../../../src/routes/botServer/api/v1/ping.ts"],"names":[],"mappings":";;AAEA,qDAA0D;AAE1D,kBAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,IAAI,CAAC;QACH,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC3H,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from "express";
2
+ declare const _default: (req: Request, res: Response) => void;
3
+ export default _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const server_1 = require("../../../../utils/server");
7
+ const nonce_1 = __importDefault(require("../../../../utils/nonce"));
8
+ exports.default = (req, res) => {
9
+ try {
10
+ const { url, id } = req.body;
11
+ if (!url) {
12
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Invalid url", {}), req["botServer"].options);
13
+ return;
14
+ }
15
+ const webhook = { id: id || (0, nonce_1.default)(), url, ping: 0 };
16
+ req["botServer"].registerWebhook(webhook);
17
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(200, "Webhook registered successfully", webhook), req["botServer"].options);
18
+ }
19
+ catch (error) {
20
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generateError(error), req["botServer"].options);
21
+ }
22
+ };
23
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../../src/routes/botServer/api/v1/register.ts"],"names":[],"mappings":";;;;;AAEA,qDAA0D;AAC1D,oEAA4C;AAE5C,kBAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAE7B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;YAEpG,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,IAAA,eAAK,GAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAEpD,GAAG,CAAC,WAAW,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAE1C,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,iCAAiC,EAAE,OAAO,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC/H,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from "express";
2
+ declare const _default: (req: Request, res: Response) => void;
3
+ export default _default;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const server_1 = require("../../../../utils/server");
4
+ exports.default = (req, res) => {
5
+ try {
6
+ const { key, args } = req.body;
7
+ if (!key || !args || !Array.isArray(args) || args.length == 0) {
8
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Invalid request", {}), req["botServer"].options);
9
+ return;
10
+ }
11
+ req["botServer"].bot[key] = args[0];
12
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(200, "OK", {}), req["botServer"].options);
13
+ }
14
+ catch (error) {
15
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generateError(error), req["botServer"].options);
16
+ }
17
+ };
18
+ //# sourceMappingURL=setValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setValue.js","sourceRoot":"","sources":["../../../../../src/routes/botServer/api/v1/setValue.ts"],"names":[],"mappings":";;AAEA,qDAA0D;AAE1D,kBAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAE/B,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC9D,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;YAExG,OAAO;QACT,CAAC;QAED,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAEpC,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7F,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Request, Response } from "express";
2
+ declare const _default: (req: Request, res: Response) => void;
3
+ export default _default;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const server_1 = require("../../../../utils/server");
4
+ exports.default = (req, res) => {
5
+ try {
6
+ const { id } = req.body;
7
+ if (!id) {
8
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Invalid id", {}), req["botServer"].options);
9
+ return;
10
+ }
11
+ const removed = req["botServer"].removeWebhook(id);
12
+ if (!removed) {
13
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(400, "Webhook not registred", {}), req["botServer"].options);
14
+ return;
15
+ }
16
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generate(200, "Webhook unregistered successfully", { id }), req["botServer"].options);
17
+ }
18
+ catch (error) {
19
+ server_1.ServerResponse.send(res, server_1.ServerResponse.generateError(error), req["botServer"].options);
20
+ }
21
+ };
22
+ //# sourceMappingURL=unregister.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unregister.js","sourceRoot":"","sources":["../../../../../src/routes/botServer/api/v1/unregister.ts"],"names":[],"mappings":";;AAEA,qDAA0D;AAE1D,kBAAe,CAAC,GAAY,EAAE,GAAa,EAAE,EAAE;IAC7C,IAAI,CAAC;QACH,MAAM,EAAE,EAAE,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QAExB,IAAI,CAAC,EAAE,EAAE,CAAC;YACR,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;YAEnG,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAEnD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,uBAAuB,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;YAE9G,OAAO;QACT,CAAC;QAED,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,mCAAmC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAChI,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,uBAAc,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAc,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { NextFunction, Request, Response } from "express";
2
+ import { BotServer } from "../../../bot/BotServer";
3
+ declare const _default: (botServer: BotServer) => (req: Request, res: Response, next: NextFunction) => void;
4
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = (botServer) => {
4
+ return (req, res, next) => {
5
+ Object.defineProperty(req, "botServer", {
6
+ get() {
7
+ return botServer;
8
+ },
9
+ set(value) {
10
+ botServer = value;
11
+ },
12
+ });
13
+ return next();
14
+ };
15
+ };
16
+ //# sourceMappingURL=setBotServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setBotServer.js","sourceRoot":"","sources":["../../../../src/routes/botServer/middlewares/setBotServer.ts"],"names":[],"mappings":";;AAIA,kBAAe,CAAC,SAAoB,EAAE,EAAE;IACtC,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QACzD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE;YACtC,GAAG;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,GAAG,CAAC,KAAK;gBACP,SAAS,GAAG,KAAK,CAAC;YACpB,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Router } from "express";
2
+ import { BotServer } from "../../bot/BotServer";
3
+ export declare enum RouterMethod {
4
+ PATCH = "patch",
5
+ POST = "post",
6
+ GET = "get"
7
+ }
8
+ export declare function apiV1(botServer: BotServer): Router;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RouterMethod = void 0;
7
+ exports.apiV1 = apiV1;
8
+ const express_1 = require("express");
9
+ const setBotServer_1 = __importDefault(require("./middlewares/setBotServer"));
10
+ const ping_1 = __importDefault(require("./api/v1/ping"));
11
+ const emitEvent_1 = __importDefault(require("./api/v1/emitEvent"));
12
+ const setValue_1 = __importDefault(require("./api/v1/setValue"));
13
+ const function_1 = __importDefault(require("./api/v1/function"));
14
+ const register_1 = __importDefault(require("./api/v1/register"));
15
+ const unregister_1 = __importDefault(require("./api/v1/unregister"));
16
+ var RouterMethod;
17
+ (function (RouterMethod) {
18
+ RouterMethod["PATCH"] = "patch";
19
+ RouterMethod["POST"] = "post";
20
+ RouterMethod["GET"] = "get";
21
+ })(RouterMethod || (exports.RouterMethod = RouterMethod = {}));
22
+ function apiV1(botServer) {
23
+ const routes = (0, express_1.Router)();
24
+ const baseUrl = `/api/v1`;
25
+ routes.get(`${baseUrl}/ping`, (0, setBotServer_1.default)(botServer), ping_1.default);
26
+ routes.patch(`${baseUrl}/emitEvent`, (0, setBotServer_1.default)(botServer), emitEvent_1.default);
27
+ routes.patch(`${baseUrl}/setValue`, (0, setBotServer_1.default)(botServer), setValue_1.default);
28
+ routes.patch(`${baseUrl}/function`, (0, setBotServer_1.default)(botServer), function_1.default);
29
+ routes.post(`${baseUrl}/register`, (0, setBotServer_1.default)(botServer), register_1.default);
30
+ routes.post(`${baseUrl}/unregister`, (0, setBotServer_1.default)(botServer), unregister_1.default);
31
+ return routes;
32
+ }
33
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/routes/botServer/routes.ts"],"names":[],"mappings":";;;;;;AAmBA,sBAYC;AA/BD,qCAAiC;AAIjC,8EAAsD;AAEtD,yDAAiC;AACjC,mEAA2C;AAC3C,iEAAyC;AACzC,iEAA0C;AAC1C,iEAAyC;AACzC,qEAA6C;AAE7C,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,+BAAe,CAAA;IACf,6BAAa,CAAA;IACb,2BAAW,CAAA;AACb,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED,SAAgB,KAAK,CAAC,SAAoB;IACxC,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IACxB,MAAM,OAAO,GAAG,SAAS,CAAC;IAE1B,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,OAAO,EAAE,IAAA,sBAAY,EAAC,SAAS,CAAC,EAAE,cAAI,CAAC,CAAC;IAC7D,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,YAAY,EAAE,IAAA,sBAAY,EAAC,SAAS,CAAC,EAAE,mBAAS,CAAC,CAAC;IACzE,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,WAAW,EAAE,IAAA,sBAAY,EAAC,SAAS,CAAC,EAAE,kBAAQ,CAAC,CAAC;IACvE,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,WAAW,EAAE,IAAA,sBAAY,EAAC,SAAS,CAAC,EAAE,kBAAS,CAAC,CAAC;IACxE,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,WAAW,EAAE,IAAA,sBAAY,EAAC,SAAS,CAAC,EAAE,kBAAQ,CAAC,CAAC;IACtE,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,aAAa,EAAE,IAAA,sBAAY,EAAC,SAAS,CAAC,EAAE,oBAAU,CAAC,CAAC;IAE1E,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import Address from "../models/Address";
2
+ import BaseService from "./BaseService";
3
+ /** Serviço para obter os dados de uma localização. */
4
+ export default class AddressService extends BaseService {
5
+ /**
6
+ * Obtem os dados de uma localização.
7
+ * @param latitude - Latitude da localização.
8
+ * @param longitude - Longitude da localização.
9
+ * @returns Dados da localização.
10
+ */
11
+ static getByLocation(latitude: number, longitude: number): Promise<Address>;
12
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Address_1 = __importDefault(require("../models/Address"));
7
+ const BaseService_1 = __importDefault(require("./BaseService"));
8
+ /** Serviço para obter os dados de uma localização. */
9
+ class AddressService extends BaseService_1.default {
10
+ /**
11
+ * Obtem os dados de uma localização.
12
+ * @param latitude - Latitude da localização.
13
+ * @param longitude - Longitude da localização.
14
+ * @returns Dados da localização.
15
+ */
16
+ static async getByLocation(latitude, longitude) {
17
+ const { data } = await this.get(`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${latitude}&lon=${longitude}`);
18
+ const loc = new Address_1.default();
19
+ if (!(data === null || data === void 0 ? void 0 : data.address))
20
+ return loc;
21
+ loc.data = data;
22
+ //? Lendo país da localização
23
+ if (data.address.country)
24
+ loc.country = data.address.country;
25
+ //? Lendo estado da localização
26
+ if (data.address.state)
27
+ loc.state = data.address.state;
28
+ //? Lendo cidade da localização
29
+ if (data.address.city)
30
+ loc.city = data.address.city;
31
+ else if (data.address.city_district)
32
+ loc.city = data.address.city_district;
33
+ else if (data.address.town)
34
+ loc.city = data.address.town;
35
+ //? Lendo bairro da localização
36
+ if (data.address.suburb)
37
+ loc.neighborhood = data.address.suburb;
38
+ //? Lendo rua da localização
39
+ if (data.address.road)
40
+ loc.street = data.address.road;
41
+ //? Lendo CEP da localização
42
+ if (data.address.postcode)
43
+ loc.zipcode = data.address.postcode;
44
+ //? Lendo complemento da localização
45
+ if (data.display_name)
46
+ loc.complement = data.display_name;
47
+ return loc;
48
+ }
49
+ }
50
+ exports.default = AddressService;
51
+ //# sourceMappingURL=AddressService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AddressService.js","sourceRoot":"","sources":["../../src/services/AddressService.ts"],"names":[],"mappings":";;;;;AAAA,gEAAwC;AAExC,gEAAwC;AAExC,sDAAsD;AACtD,MAAqB,cAAe,SAAQ,qBAAW;IACrD;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,SAAiB;QACnE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,iEAAiE,QAAQ,QAAQ,SAAS,EAAE,CAAC,CAAC;QAE9H,MAAM,GAAG,GAAG,IAAI,iBAAO,EAAE,CAAC;QAE1B,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAA;YAAE,OAAO,GAAG,CAAC;QAE/B,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;QAEhB,6BAA6B;QAC7B,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO;YAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;QAE7D,+BAA+B;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK;YAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QAEvD,+BAA+B;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;aAC/C,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;aACtE,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;YAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAEzD,+BAA+B;QAC/B,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM;YAAE,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QAEhE,4BAA4B;QAC5B,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;YAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;QAEtD,4BAA4B;QAC5B,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ;YAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QAE/D,oCAAoC;QACpC,IAAI,IAAI,CAAC,YAAY;YAAE,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC;QAE1D,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAzCD,iCAyCC"}
@@ -0,0 +1,5 @@
1
+ export default class BaseService {
2
+ static get(path: string, body?: any): Promise<import("axios").AxiosResponse<any, any>>;
3
+ static post(path: string, body?: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ static patch(path: string, body?: any): Promise<import("axios").AxiosResponse<any, any>>;
5
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const axios_1 = __importDefault(require("axios"));
7
+ class BaseService {
8
+ static async get(path, body = {}) {
9
+ return await axios_1.default.get(path, body);
10
+ }
11
+ static async post(path, body = {}) {
12
+ return await axios_1.default.post(path, body);
13
+ }
14
+ static async patch(path, body = {}) {
15
+ return await axios_1.default.patch(path, body);
16
+ }
17
+ }
18
+ exports.default = BaseService;
19
+ //# sourceMappingURL=BaseService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseService.js","sourceRoot":"","sources":["../../src/services/BaseService.ts"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,MAAqB,WAAW;IACvB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,OAAY,EAAE;QAClD,OAAO,MAAM,eAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAY,EAAE,OAAY,EAAE;QACnD,OAAO,MAAM,eAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAAY,EAAE;QACpD,OAAO,MAAM,eAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;CACF;AAZD,8BAYC"}
@@ -0,0 +1,3 @@
1
+ import AddressService from "./AddressService";
2
+ import BaseService from "./BaseService";
3
+ export { BaseService, AddressService };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AddressService = exports.BaseService = void 0;
7
+ const AddressService_1 = __importDefault(require("./AddressService"));
8
+ exports.AddressService = AddressService_1.default;
9
+ const BaseService_1 = __importDefault(require("./BaseService"));
10
+ exports.BaseService = BaseService_1.default;
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA8C;AAGxB,yBAHf,wBAAc,CAGe;AAFpC,gEAAwC;AAE/B,sBAFF,qBAAW,CAEE"}
@@ -0,0 +1,17 @@
1
+ import IAuth from "../client/IAuth";
2
+ export default class TelegramAuth implements IAuth {
3
+ #private;
4
+ sessionsDir: string;
5
+ botPhoneNumber?: string;
6
+ autoCreateDir: boolean;
7
+ fixFileName: (file?: string) => string | undefined;
8
+ getStat(folder: string): import("fs").Stats | null;
9
+ setBotToken(botToken: string): void;
10
+ constructor(botToken: string, sessionsDir?: string, autoCreateDir?: boolean);
11
+ prepare(): void;
12
+ getSession(...paths: string[]): string;
13
+ get(file: string): Promise<any>;
14
+ set(file: string, data: any): Promise<void>;
15
+ remove(file: string): Promise<void>;
16
+ listAll(pattern?: string): Promise<string[]>;
17
+ }