@vraksha/bottender 1.6.1-beta.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 (454) hide show
  1. package/README.md +161 -0
  2. package/bin/cli.js +4 -0
  3. package/dist/bot/Bot.d.ts +44 -0
  4. package/dist/bot/Bot.d.ts.map +1 -0
  5. package/dist/bot/Bot.js +226 -0
  6. package/dist/bot/Bot.js.map +1 -0
  7. package/dist/bot/Connector.d.ts +23 -0
  8. package/dist/bot/Connector.d.ts.map +1 -0
  9. package/dist/bot/Connector.js +3 -0
  10. package/dist/bot/Connector.js.map +1 -0
  11. package/dist/bottender.d.ts +7 -0
  12. package/dist/bottender.d.ts.map +1 -0
  13. package/dist/bottender.js +15 -0
  14. package/dist/bottender.js.map +1 -0
  15. package/dist/browser.d.ts +9 -0
  16. package/dist/browser.d.ts.map +1 -0
  17. package/dist/browser.js +23 -0
  18. package/dist/browser.js.map +1 -0
  19. package/dist/cache/CacheStore.d.ts +12 -0
  20. package/dist/cache/CacheStore.d.ts.map +1 -0
  21. package/dist/cache/CacheStore.js +3 -0
  22. package/dist/cache/CacheStore.js.map +1 -0
  23. package/dist/cache/MemoryCacheStore.d.ts +13 -0
  24. package/dist/cache/MemoryCacheStore.d.ts.map +1 -0
  25. package/dist/cache/MemoryCacheStore.js +59 -0
  26. package/dist/cache/MemoryCacheStore.js.map +1 -0
  27. package/dist/cache/RedisCacheStore.d.ts +18 -0
  28. package/dist/cache/RedisCacheStore.d.ts.map +1 -0
  29. package/dist/cache/RedisCacheStore.js +79 -0
  30. package/dist/cache/RedisCacheStore.js.map +1 -0
  31. package/dist/chain.d.ts +5 -0
  32. package/dist/chain.d.ts.map +1 -0
  33. package/dist/chain.js +27 -0
  34. package/dist/chain.js.map +1 -0
  35. package/dist/cli/index.d.ts +11 -0
  36. package/dist/cli/index.d.ts.map +1 -0
  37. package/dist/cli/index.js +99 -0
  38. package/dist/cli/index.js.map +1 -0
  39. package/dist/cli/providers/index.d.ts +37 -0
  40. package/dist/cli/providers/index.d.ts.map +1 -0
  41. package/dist/cli/providers/index.js +18 -0
  42. package/dist/cli/providers/index.js.map +1 -0
  43. package/dist/cli/providers/line/help.d.ts +3 -0
  44. package/dist/cli/providers/line/help.d.ts.map +1 -0
  45. package/dist/cli/providers/line/help.js +9 -0
  46. package/dist/cli/providers/line/help.js.map +1 -0
  47. package/dist/cli/providers/line/index.d.ts +7 -0
  48. package/dist/cli/providers/line/index.d.ts.map +1 -0
  49. package/dist/cli/providers/line/index.js +10 -0
  50. package/dist/cli/providers/line/index.js.map +1 -0
  51. package/dist/cli/providers/messenger/help.d.ts +3 -0
  52. package/dist/cli/providers/messenger/help.d.ts.map +1 -0
  53. package/dist/cli/providers/messenger/help.js +31 -0
  54. package/dist/cli/providers/messenger/help.js.map +1 -0
  55. package/dist/cli/providers/messenger/index.d.ts +10 -0
  56. package/dist/cli/providers/messenger/index.d.ts.map +1 -0
  57. package/dist/cli/providers/messenger/index.js +19 -0
  58. package/dist/cli/providers/messenger/index.js.map +1 -0
  59. package/dist/cli/providers/messenger/persona.d.ts +7 -0
  60. package/dist/cli/providers/messenger/persona.d.ts.map +1 -0
  61. package/dist/cli/providers/messenger/persona.js +235 -0
  62. package/dist/cli/providers/messenger/persona.js.map +1 -0
  63. package/dist/cli/providers/messenger/profile.d.ts +9 -0
  64. package/dist/cli/providers/messenger/profile.d.ts.map +1 -0
  65. package/dist/cli/providers/messenger/profile.js +233 -0
  66. package/dist/cli/providers/messenger/profile.js.map +1 -0
  67. package/dist/cli/providers/messenger/webhook.d.ts +4 -0
  68. package/dist/cli/providers/messenger/webhook.d.ts.map +1 -0
  69. package/dist/cli/providers/messenger/webhook.js +165 -0
  70. package/dist/cli/providers/messenger/webhook.js.map +1 -0
  71. package/dist/cli/providers/sh/dev.d.ts +4 -0
  72. package/dist/cli/providers/sh/dev.d.ts.map +1 -0
  73. package/dist/cli/providers/sh/dev.js +79 -0
  74. package/dist/cli/providers/sh/dev.js.map +1 -0
  75. package/dist/cli/providers/sh/help.d.ts +3 -0
  76. package/dist/cli/providers/sh/help.d.ts.map +1 -0
  77. package/dist/cli/providers/sh/help.js +42 -0
  78. package/dist/cli/providers/sh/help.js.map +1 -0
  79. package/dist/cli/providers/sh/index.d.ts +10 -0
  80. package/dist/cli/providers/sh/index.d.ts.map +1 -0
  81. package/dist/cli/providers/sh/index.js +19 -0
  82. package/dist/cli/providers/sh/index.js.map +1 -0
  83. package/dist/cli/providers/sh/init.d.ts +3 -0
  84. package/dist/cli/providers/sh/init.d.ts.map +1 -0
  85. package/dist/cli/providers/sh/init.js +22 -0
  86. package/dist/cli/providers/sh/init.js.map +1 -0
  87. package/dist/cli/providers/sh/start.d.ts +4 -0
  88. package/dist/cli/providers/sh/start.d.ts.map +1 -0
  89. package/dist/cli/providers/sh/start.js +51 -0
  90. package/dist/cli/providers/sh/start.js.map +1 -0
  91. package/dist/cli/providers/sh/utils/argCommon.d.ts +8 -0
  92. package/dist/cli/providers/sh/utils/argCommon.d.ts.map +1 -0
  93. package/dist/cli/providers/sh/utils/argCommon.js +10 -0
  94. package/dist/cli/providers/sh/utils/argCommon.js.map +1 -0
  95. package/dist/cli/providers/sh/utils/getArgs.d.ts +9 -0
  96. package/dist/cli/providers/sh/utils/getArgs.d.ts.map +1 -0
  97. package/dist/cli/providers/sh/utils/getArgs.js +10 -0
  98. package/dist/cli/providers/sh/utils/getArgs.js.map +1 -0
  99. package/dist/cli/providers/sh/utils/getSubArgs.d.ts +6 -0
  100. package/dist/cli/providers/sh/utils/getSubArgs.d.ts.map +1 -0
  101. package/dist/cli/providers/sh/utils/getSubArgs.js +23 -0
  102. package/dist/cli/providers/sh/utils/getSubArgs.js.map +1 -0
  103. package/dist/cli/providers/telegram/help.d.ts +3 -0
  104. package/dist/cli/providers/telegram/help.d.ts.map +1 -0
  105. package/dist/cli/providers/telegram/help.js +34 -0
  106. package/dist/cli/providers/telegram/help.js.map +1 -0
  107. package/dist/cli/providers/telegram/index.d.ts +8 -0
  108. package/dist/cli/providers/telegram/index.d.ts.map +1 -0
  109. package/dist/cli/providers/telegram/index.js +13 -0
  110. package/dist/cli/providers/telegram/index.js.map +1 -0
  111. package/dist/cli/providers/telegram/webhook.d.ts +6 -0
  112. package/dist/cli/providers/telegram/webhook.d.ts.map +1 -0
  113. package/dist/cli/providers/telegram/webhook.js +149 -0
  114. package/dist/cli/providers/telegram/webhook.js.map +1 -0
  115. package/dist/cli/providers/viber/help.d.ts +3 -0
  116. package/dist/cli/providers/viber/help.d.ts.map +1 -0
  117. package/dist/cli/providers/viber/help.js +33 -0
  118. package/dist/cli/providers/viber/help.js.map +1 -0
  119. package/dist/cli/providers/viber/index.d.ts +8 -0
  120. package/dist/cli/providers/viber/index.d.ts.map +1 -0
  121. package/dist/cli/providers/viber/index.js +13 -0
  122. package/dist/cli/providers/viber/index.js.map +1 -0
  123. package/dist/cli/providers/viber/webhook.d.ts +5 -0
  124. package/dist/cli/providers/viber/webhook.d.ts.map +1 -0
  125. package/dist/cli/providers/viber/webhook.js +122 -0
  126. package/dist/cli/providers/viber/webhook.js.map +1 -0
  127. package/dist/console/ConsoleBot.d.ts +17 -0
  128. package/dist/console/ConsoleBot.d.ts.map +1 -0
  129. package/dist/console/ConsoleBot.js +80 -0
  130. package/dist/console/ConsoleBot.js.map +1 -0
  131. package/dist/console/ConsoleClient.d.ts +4 -0
  132. package/dist/console/ConsoleClient.d.ts.map +1 -0
  133. package/dist/console/ConsoleClient.js +3 -0
  134. package/dist/console/ConsoleClient.js.map +1 -0
  135. package/dist/console/ConsoleConnector.d.ts +35 -0
  136. package/dist/console/ConsoleConnector.d.ts.map +1 -0
  137. package/dist/console/ConsoleConnector.js +62 -0
  138. package/dist/console/ConsoleConnector.js.map +1 -0
  139. package/dist/console/ConsoleContext.d.ts +28 -0
  140. package/dist/console/ConsoleContext.d.ts.map +1 -0
  141. package/dist/console/ConsoleContext.js +66 -0
  142. package/dist/console/ConsoleContext.js.map +1 -0
  143. package/dist/console/ConsoleEvent.d.ts +24 -0
  144. package/dist/console/ConsoleEvent.d.ts.map +1 -0
  145. package/dist/console/ConsoleEvent.js +36 -0
  146. package/dist/console/ConsoleEvent.js.map +1 -0
  147. package/dist/context/Context.d.ts +52 -0
  148. package/dist/context/Context.d.ts.map +1 -0
  149. package/dist/context/Context.js +118 -0
  150. package/dist/context/Context.js.map +1 -0
  151. package/dist/context/Event.d.ts +8 -0
  152. package/dist/context/Event.d.ts.map +1 -0
  153. package/dist/context/Event.js +3 -0
  154. package/dist/context/Event.js.map +1 -0
  155. package/dist/index.d.ts +69 -0
  156. package/dist/index.d.ts.map +1 -0
  157. package/dist/index.js +155 -0
  158. package/dist/index.js.map +1 -0
  159. package/dist/initializeServer.d.ts +10 -0
  160. package/dist/initializeServer.d.ts.map +1 -0
  161. package/dist/initializeServer.js +98 -0
  162. package/dist/initializeServer.js.map +1 -0
  163. package/dist/line/LineBot.d.ts +15 -0
  164. package/dist/line/LineBot.d.ts.map +1 -0
  165. package/dist/line/LineBot.js +27 -0
  166. package/dist/line/LineBot.js.map +1 -0
  167. package/dist/line/LineConnector.d.ts +92 -0
  168. package/dist/line/LineConnector.d.ts.map +1 -0
  169. package/dist/line/LineConnector.js +283 -0
  170. package/dist/line/LineConnector.js.map +1 -0
  171. package/dist/line/LineContext.d.ts +135 -0
  172. package/dist/line/LineContext.d.ts.map +1 -0
  173. package/dist/line/LineContext.js +419 -0
  174. package/dist/line/LineContext.js.map +1 -0
  175. package/dist/line/LineEvent.d.ts +61 -0
  176. package/dist/line/LineEvent.d.ts.map +1 -0
  177. package/dist/line/LineEvent.js +217 -0
  178. package/dist/line/LineEvent.js.map +1 -0
  179. package/dist/line/LineTypes.d.ts +199 -0
  180. package/dist/line/LineTypes.d.ts.map +1 -0
  181. package/dist/line/LineTypes.js +18 -0
  182. package/dist/line/LineTypes.js.map +1 -0
  183. package/dist/line/routes.d.ts +33 -0
  184. package/dist/line/routes.d.ts.map +1 -0
  185. package/dist/line/routes.js +89 -0
  186. package/dist/line/routes.js.map +1 -0
  187. package/dist/messenger/FacebookBaseConnector.d.ts +66 -0
  188. package/dist/messenger/FacebookBaseConnector.d.ts.map +1 -0
  189. package/dist/messenger/FacebookBaseConnector.js +118 -0
  190. package/dist/messenger/FacebookBaseConnector.js.map +1 -0
  191. package/dist/messenger/MessengerBot.d.ts +15 -0
  192. package/dist/messenger/MessengerBot.d.ts.map +1 -0
  193. package/dist/messenger/MessengerBot.js +27 -0
  194. package/dist/messenger/MessengerBot.js.map +1 -0
  195. package/dist/messenger/MessengerConnector.d.ts +37 -0
  196. package/dist/messenger/MessengerConnector.d.ts.map +1 -0
  197. package/dist/messenger/MessengerConnector.js +204 -0
  198. package/dist/messenger/MessengerConnector.js.map +1 -0
  199. package/dist/messenger/MessengerContext.d.ts +114 -0
  200. package/dist/messenger/MessengerContext.d.ts.map +1 -0
  201. package/dist/messenger/MessengerContext.js +547 -0
  202. package/dist/messenger/MessengerContext.js.map +1 -0
  203. package/dist/messenger/MessengerEvent.d.ts +76 -0
  204. package/dist/messenger/MessengerEvent.d.ts.map +1 -0
  205. package/dist/messenger/MessengerEvent.js +380 -0
  206. package/dist/messenger/MessengerEvent.js.map +1 -0
  207. package/dist/messenger/MessengerTypes.d.ts +292 -0
  208. package/dist/messenger/MessengerTypes.d.ts.map +1 -0
  209. package/dist/messenger/MessengerTypes.js +18 -0
  210. package/dist/messenger/MessengerTypes.js.map +1 -0
  211. package/dist/messenger/routes.d.ts +39 -0
  212. package/dist/messenger/routes.d.ts.map +1 -0
  213. package/dist/messenger/routes.js +109 -0
  214. package/dist/messenger/routes.js.map +1 -0
  215. package/dist/plugins/withTyping.d.ts +6 -0
  216. package/dist/plugins/withTyping.d.ts.map +1 -0
  217. package/dist/plugins/withTyping.js +135 -0
  218. package/dist/plugins/withTyping.js.map +1 -0
  219. package/dist/router/index.d.ts +39 -0
  220. package/dist/router/index.d.ts.map +1 -0
  221. package/dist/router/index.js +166 -0
  222. package/dist/router/index.js.map +1 -0
  223. package/dist/server/DevServer.d.ts +6 -0
  224. package/dist/server/DevServer.d.ts.map +1 -0
  225. package/dist/server/DevServer.js +27 -0
  226. package/dist/server/DevServer.js.map +1 -0
  227. package/dist/server/Server.d.ts +26 -0
  228. package/dist/server/Server.d.ts.map +1 -0
  229. package/dist/server/Server.js +86 -0
  230. package/dist/server/Server.js.map +1 -0
  231. package/dist/session/CacheBasedSessionStore.d.ts +14 -0
  232. package/dist/session/CacheBasedSessionStore.d.ts.map +1 -0
  233. package/dist/session/CacheBasedSessionStore.js +44 -0
  234. package/dist/session/CacheBasedSessionStore.js.map +1 -0
  235. package/dist/session/FileSessionStore.d.ts +20 -0
  236. package/dist/session/FileSessionStore.d.ts.map +1 -0
  237. package/dist/session/FileSessionStore.js +118 -0
  238. package/dist/session/FileSessionStore.js.map +1 -0
  239. package/dist/session/MemorySessionStore.d.ts +10 -0
  240. package/dist/session/MemorySessionStore.d.ts.map +1 -0
  241. package/dist/session/MemorySessionStore.js +25 -0
  242. package/dist/session/MemorySessionStore.js.map +1 -0
  243. package/dist/session/MongoSessionStore.d.ts +23 -0
  244. package/dist/session/MongoSessionStore.d.ts.map +1 -0
  245. package/dist/session/MongoSessionStore.js +97 -0
  246. package/dist/session/MongoSessionStore.js.map +1 -0
  247. package/dist/session/RedisSessionStore.d.ts +14 -0
  248. package/dist/session/RedisSessionStore.d.ts.map +1 -0
  249. package/dist/session/RedisSessionStore.js +15 -0
  250. package/dist/session/RedisSessionStore.js.map +1 -0
  251. package/dist/session/Session.d.ts +3 -0
  252. package/dist/session/Session.d.ts.map +1 -0
  253. package/dist/session/Session.js +3 -0
  254. package/dist/session/Session.js.map +1 -0
  255. package/dist/session/SessionStore.d.ts +10 -0
  256. package/dist/session/SessionStore.d.ts.map +1 -0
  257. package/dist/session/SessionStore.js +3 -0
  258. package/dist/session/SessionStore.js.map +1 -0
  259. package/dist/shared/getBottenderConfig.d.ts +5 -0
  260. package/dist/shared/getBottenderConfig.d.ts.map +1 -0
  261. package/dist/shared/getBottenderConfig.js +24 -0
  262. package/dist/shared/getBottenderConfig.js.map +1 -0
  263. package/dist/shared/getChannelBotAndRequestContext.d.ts +10 -0
  264. package/dist/shared/getChannelBotAndRequestContext.d.ts.map +1 -0
  265. package/dist/shared/getChannelBotAndRequestContext.js +41 -0
  266. package/dist/shared/getChannelBotAndRequestContext.js.map +1 -0
  267. package/dist/shared/getChannelBots.d.ts +6 -0
  268. package/dist/shared/getChannelBots.d.ts.map +1 -0
  269. package/dist/shared/getChannelBots.js +84 -0
  270. package/dist/shared/getChannelBots.js.map +1 -0
  271. package/dist/shared/getChannelConfig.d.ts +5 -0
  272. package/dist/shared/getChannelConfig.d.ts.map +1 -0
  273. package/dist/shared/getChannelConfig.js +28 -0
  274. package/dist/shared/getChannelConfig.js.map +1 -0
  275. package/dist/shared/getChannelSchema.d.ts +4 -0
  276. package/dist/shared/getChannelSchema.d.ts.map +1 -0
  277. package/dist/shared/getChannelSchema.js +110 -0
  278. package/dist/shared/getChannelSchema.js.map +1 -0
  279. package/dist/shared/getClient.d.ts +11 -0
  280. package/dist/shared/getClient.d.ts.map +1 -0
  281. package/dist/shared/getClient.js +36 -0
  282. package/dist/shared/getClient.js.map +1 -0
  283. package/dist/shared/getConsoleBot.d.ts +5 -0
  284. package/dist/shared/getConsoleBot.d.ts.map +1 -0
  285. package/dist/shared/getConsoleBot.js +43 -0
  286. package/dist/shared/getConsoleBot.js.map +1 -0
  287. package/dist/shared/getSessionStore.d.ts +5 -0
  288. package/dist/shared/getSessionStore.d.ts.map +1 -0
  289. package/dist/shared/getSessionStore.js +41 -0
  290. package/dist/shared/getSessionStore.js.map +1 -0
  291. package/dist/shared/getWebhookFromNgrok.d.ts +2 -0
  292. package/dist/shared/getWebhookFromNgrok.d.ts.map +1 -0
  293. package/dist/shared/getWebhookFromNgrok.js +33 -0
  294. package/dist/shared/getWebhookFromNgrok.js.map +1 -0
  295. package/dist/shared/log.d.ts +6 -0
  296. package/dist/shared/log.d.ts.map +1 -0
  297. package/dist/shared/log.js +29 -0
  298. package/dist/shared/log.js.map +1 -0
  299. package/dist/slack/SlackBot.d.ts +22 -0
  300. package/dist/slack/SlackBot.d.ts.map +1 -0
  301. package/dist/slack/SlackBot.js +30 -0
  302. package/dist/slack/SlackBot.js.map +1 -0
  303. package/dist/slack/SlackConnector.d.ts +72 -0
  304. package/dist/slack/SlackConnector.d.ts.map +1 -0
  305. package/dist/slack/SlackConnector.js +302 -0
  306. package/dist/slack/SlackConnector.js.map +1 -0
  307. package/dist/slack/SlackContext.d.ts +65 -0
  308. package/dist/slack/SlackContext.d.ts.map +1 -0
  309. package/dist/slack/SlackContext.js +131 -0
  310. package/dist/slack/SlackContext.js.map +1 -0
  311. package/dist/slack/SlackEvent.d.ts +28 -0
  312. package/dist/slack/SlackEvent.d.ts.map +1 -0
  313. package/dist/slack/SlackEvent.js +171 -0
  314. package/dist/slack/SlackEvent.js.map +1 -0
  315. package/dist/slack/SlackTypes.d.ts +79 -0
  316. package/dist/slack/SlackTypes.d.ts.map +1 -0
  317. package/dist/slack/SlackTypes.js +18 -0
  318. package/dist/slack/SlackTypes.js.map +1 -0
  319. package/dist/slack/routes.d.ts +24 -0
  320. package/dist/slack/routes.d.ts.map +1 -0
  321. package/dist/slack/routes.js +25 -0
  322. package/dist/slack/routes.js.map +1 -0
  323. package/dist/telegram/TelegramBot.d.ts +20 -0
  324. package/dist/telegram/TelegramBot.d.ts.map +1 -0
  325. package/dist/telegram/TelegramBot.js +68 -0
  326. package/dist/telegram/TelegramBot.js.map +1 -0
  327. package/dist/telegram/TelegramConnector.d.ts +42 -0
  328. package/dist/telegram/TelegramConnector.d.ts.map +1 -0
  329. package/dist/telegram/TelegramConnector.js +191 -0
  330. package/dist/telegram/TelegramConnector.js.map +1 -0
  331. package/dist/telegram/TelegramContext.d.ts +64 -0
  332. package/dist/telegram/TelegramContext.d.ts.map +1 -0
  333. package/dist/telegram/TelegramContext.js +742 -0
  334. package/dist/telegram/TelegramContext.js.map +1 -0
  335. package/dist/telegram/TelegramEvent.d.ts +61 -0
  336. package/dist/telegram/TelegramEvent.d.ts.map +1 -0
  337. package/dist/telegram/TelegramEvent.js +246 -0
  338. package/dist/telegram/TelegramEvent.js.map +1 -0
  339. package/dist/telegram/TelegramTypes.d.ts +27 -0
  340. package/dist/telegram/TelegramTypes.d.ts.map +1 -0
  341. package/dist/telegram/TelegramTypes.js +18 -0
  342. package/dist/telegram/TelegramTypes.js.map +1 -0
  343. package/dist/telegram/routes.d.ts +25 -0
  344. package/dist/telegram/routes.d.ts.map +1 -0
  345. package/dist/telegram/routes.js +53 -0
  346. package/dist/telegram/routes.js.map +1 -0
  347. package/dist/test-utils/ContextSimulator.d.ts +196 -0
  348. package/dist/test-utils/ContextSimulator.d.ts.map +1 -0
  349. package/dist/test-utils/ContextSimulator.js +237 -0
  350. package/dist/test-utils/ContextSimulator.js.map +1 -0
  351. package/dist/test-utils/SimulatedContext.d.ts +9 -0
  352. package/dist/test-utils/SimulatedContext.d.ts.map +1 -0
  353. package/dist/test-utils/SimulatedContext.js +18 -0
  354. package/dist/test-utils/SimulatedContext.js.map +1 -0
  355. package/dist/test-utils/index.d.ts +2 -0
  356. package/dist/test-utils/index.d.ts.map +1 -0
  357. package/dist/test-utils/index.js +9 -0
  358. package/dist/test-utils/index.js.map +1 -0
  359. package/dist/types.d.ts +107 -0
  360. package/dist/types.d.ts.map +1 -0
  361. package/dist/types.js +22 -0
  362. package/dist/types.js.map +1 -0
  363. package/dist/utils.d.ts +4 -0
  364. package/dist/utils.d.ts.map +1 -0
  365. package/dist/utils.js +13 -0
  366. package/dist/utils.js.map +1 -0
  367. package/dist/viber/ViberBot.d.ts +15 -0
  368. package/dist/viber/ViberBot.d.ts.map +1 -0
  369. package/dist/viber/ViberBot.js +27 -0
  370. package/dist/viber/ViberBot.js.map +1 -0
  371. package/dist/viber/ViberConnector.d.ts +62 -0
  372. package/dist/viber/ViberConnector.d.ts.map +1 -0
  373. package/dist/viber/ViberConnector.js +152 -0
  374. package/dist/viber/ViberConnector.js.map +1 -0
  375. package/dist/viber/ViberContext.d.ts +20 -0
  376. package/dist/viber/ViberContext.d.ts.map +1 -0
  377. package/dist/viber/ViberContext.js +132 -0
  378. package/dist/viber/ViberContext.js.map +1 -0
  379. package/dist/viber/ViberEvent.d.ts +39 -0
  380. package/dist/viber/ViberEvent.d.ts.map +1 -0
  381. package/dist/viber/ViberEvent.js +150 -0
  382. package/dist/viber/ViberEvent.js.map +1 -0
  383. package/dist/viber/ViberTypes.d.ts +82 -0
  384. package/dist/viber/ViberTypes.d.ts.map +1 -0
  385. package/dist/viber/ViberTypes.js +18 -0
  386. package/dist/viber/ViberTypes.js.map +1 -0
  387. package/dist/viber/routes.d.ts +21 -0
  388. package/dist/viber/routes.d.ts.map +1 -0
  389. package/dist/viber/routes.js +37 -0
  390. package/dist/viber/routes.js.map +1 -0
  391. package/dist/whatsapp/TwilioClient.d.ts +55 -0
  392. package/dist/whatsapp/TwilioClient.d.ts.map +1 -0
  393. package/dist/whatsapp/TwilioClient.js +66 -0
  394. package/dist/whatsapp/TwilioClient.js.map +1 -0
  395. package/dist/whatsapp/WhatsappBot.d.ts +15 -0
  396. package/dist/whatsapp/WhatsappBot.d.ts.map +1 -0
  397. package/dist/whatsapp/WhatsappBot.js +27 -0
  398. package/dist/whatsapp/WhatsappBot.js.map +1 -0
  399. package/dist/whatsapp/WhatsappConnector.d.ts +64 -0
  400. package/dist/whatsapp/WhatsappConnector.d.ts.map +1 -0
  401. package/dist/whatsapp/WhatsappConnector.js +111 -0
  402. package/dist/whatsapp/WhatsappConnector.js.map +1 -0
  403. package/dist/whatsapp/WhatsappContext.d.ts +17 -0
  404. package/dist/whatsapp/WhatsappContext.d.ts.map +1 -0
  405. package/dist/whatsapp/WhatsappContext.js +30 -0
  406. package/dist/whatsapp/WhatsappContext.js.map +1 -0
  407. package/dist/whatsapp/WhatsappEvent.d.ts +25 -0
  408. package/dist/whatsapp/WhatsappEvent.d.ts.map +1 -0
  409. package/dist/whatsapp/WhatsappEvent.js +60 -0
  410. package/dist/whatsapp/WhatsappEvent.js.map +1 -0
  411. package/dist/whatsapp/WhatsappTypes.d.ts +59 -0
  412. package/dist/whatsapp/WhatsappTypes.d.ts.map +1 -0
  413. package/dist/whatsapp/WhatsappTypes.js +3 -0
  414. package/dist/whatsapp/WhatsappTypes.js.map +1 -0
  415. package/dist/whatsapp/routes.d.ts +20 -0
  416. package/dist/whatsapp/routes.d.ts.map +1 -0
  417. package/dist/whatsapp/routes.js +33 -0
  418. package/dist/whatsapp/routes.js.map +1 -0
  419. package/dist/whatsapp-by-meta/MetaClient.d.ts +297 -0
  420. package/dist/whatsapp-by-meta/MetaClient.d.ts.map +1 -0
  421. package/dist/whatsapp-by-meta/MetaClient.js +74 -0
  422. package/dist/whatsapp-by-meta/MetaClient.js.map +1 -0
  423. package/dist/whatsapp-by-meta/WhatsappByMetaBot.d.ts +15 -0
  424. package/dist/whatsapp-by-meta/WhatsappByMetaBot.d.ts.map +1 -0
  425. package/dist/whatsapp-by-meta/WhatsappByMetaBot.js +27 -0
  426. package/dist/whatsapp-by-meta/WhatsappByMetaBot.js.map +1 -0
  427. package/dist/whatsapp-by-meta/WhatsappByMetaConnector.d.ts +67 -0
  428. package/dist/whatsapp-by-meta/WhatsappByMetaConnector.d.ts.map +1 -0
  429. package/dist/whatsapp-by-meta/WhatsappByMetaConnector.js +130 -0
  430. package/dist/whatsapp-by-meta/WhatsappByMetaConnector.js.map +1 -0
  431. package/dist/whatsapp-by-meta/WhatsappByMetaContext.d.ts +45 -0
  432. package/dist/whatsapp-by-meta/WhatsappByMetaContext.d.ts.map +1 -0
  433. package/dist/whatsapp-by-meta/WhatsappByMetaContext.js +49 -0
  434. package/dist/whatsapp-by-meta/WhatsappByMetaContext.js.map +1 -0
  435. package/dist/whatsapp-by-meta/WhatsappByMetaTypes.d.ts +236 -0
  436. package/dist/whatsapp-by-meta/WhatsappByMetaTypes.d.ts.map +1 -0
  437. package/dist/whatsapp-by-meta/WhatsappByMetaTypes.js +3 -0
  438. package/dist/whatsapp-by-meta/WhatsappByMetaTypes.js.map +1 -0
  439. package/dist/whatsapp-by-meta/events/BaseEvent.d.ts +26 -0
  440. package/dist/whatsapp-by-meta/events/BaseEvent.d.ts.map +1 -0
  441. package/dist/whatsapp-by-meta/events/BaseEvent.js +61 -0
  442. package/dist/whatsapp-by-meta/events/BaseEvent.js.map +1 -0
  443. package/dist/whatsapp-by-meta/routes.d.ts +20 -0
  444. package/dist/whatsapp-by-meta/routes.d.ts.map +1 -0
  445. package/dist/whatsapp-by-meta/routes.js +33 -0
  446. package/dist/whatsapp-by-meta/routes.js.map +1 -0
  447. package/dist/withProps.d.ts +5 -0
  448. package/dist/withProps.d.ts.map +1 -0
  449. package/dist/withProps.js +16 -0
  450. package/dist/withProps.js.map +1 -0
  451. package/package.json +110 -0
  452. package/router.d.ts +1 -0
  453. package/router.js +2 -0
  454. package/test-utils.js +2 -0
@@ -0,0 +1,742 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const warning_1 = __importDefault(require("warning"));
16
+ const Context_1 = __importDefault(require("../context/Context"));
17
+ class TelegramContext extends Context_1.default {
18
+ get platform() {
19
+ return 'telegram';
20
+ }
21
+ sendText(text, options) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ if (!this._session) {
24
+ (0, warning_1.default)(false, 'sendText: should not be called in context without session');
25
+ return null;
26
+ }
27
+ const chatId = this._getChatId();
28
+ if (chatId === null) {
29
+ (0, warning_1.default)(false, 'sendText: should not be called in context without chatId');
30
+ return null;
31
+ }
32
+ return this._client.sendMessage(chatId, text, options);
33
+ });
34
+ }
35
+ sendMessage(text, options) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ return this.sendText(text, options);
38
+ });
39
+ }
40
+ _getChatId() {
41
+ if (this._event.isMessage) {
42
+ return this._event.message.chat.id;
43
+ }
44
+ if (this._event.isEditedMessage) {
45
+ return this._event.editedMessage.chat.id;
46
+ }
47
+ if (this._event.isChannelPost) {
48
+ return this._event.channelPost.chat.id;
49
+ }
50
+ if (this._event.isEditedChannelPost) {
51
+ return this._event.editedChannelPost.chat.id;
52
+ }
53
+ if (this._event.isInlineQuery) {
54
+ return this._event.inlineQuery.from.id;
55
+ }
56
+ if (this._event.isChosenInlineResult) {
57
+ return this._event.chosenInlineResult.from.id;
58
+ }
59
+ if (this._event.isCallbackQuery &&
60
+ this._event.callbackQuery.message) {
61
+ return this._event.callbackQuery.message.chat.id;
62
+ }
63
+ if (this._event.isShippingQuery) {
64
+ return this._event.shippingQuery.from.id;
65
+ }
66
+ if (this._event.isPreCheckoutQuery) {
67
+ return this._event.preCheckoutQuery.from.id;
68
+ }
69
+ if (this._session) {
70
+ return this._session.user.id;
71
+ }
72
+ return null;
73
+ }
74
+ answerShippingQuery(ok, options) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ if (!this._event.isShippingQuery) {
77
+ (0, warning_1.default)(false, 'answerShippingQuery: should only be called to answer ShippingQuery event');
78
+ return null;
79
+ }
80
+ const shippingQueryId = this._event.shippingQuery.id;
81
+ return this._client.answerShippingQuery(shippingQueryId, ok, options);
82
+ });
83
+ }
84
+ answerPreCheckoutQuery(ok, options) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ if (!this._event.isPreCheckoutQuery) {
87
+ (0, warning_1.default)(false, 'answerPreCheckoutQuery: should only be called to answer PreCheckoutQuery event');
88
+ return null;
89
+ }
90
+ const preCheckoutQueryId = this._event.preCheckoutQuery.id;
91
+ return this._client.answerPreCheckoutQuery(preCheckoutQueryId, ok, options);
92
+ });
93
+ }
94
+ answerInlineQuery(results, options) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ if (!this._event.isInlineQuery) {
97
+ (0, warning_1.default)(false, 'answerInlineQuery: should only be called to answer InlineQuery event');
98
+ return null;
99
+ }
100
+ const inlineQueryId = this._event.inlineQuery.id;
101
+ return this._client.answerInlineQuery(inlineQueryId, results, options);
102
+ });
103
+ }
104
+ answerCallbackQuery(options) {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ if (!this._event.isCallbackQuery) {
107
+ (0, warning_1.default)(false, 'answerCallbackQuery: should only be called to answer CallbackQuery event');
108
+ return null;
109
+ }
110
+ const callbackQueryId = this._event.callbackQuery.id;
111
+ return this._client.answerCallbackQuery(callbackQueryId, options);
112
+ });
113
+ }
114
+ getUserProfilePhotos(options) {
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ if (!this._session) {
117
+ (0, warning_1.default)(false, 'getUserProfilePhotos: should not be called in context without session');
118
+ return null;
119
+ }
120
+ return this._client.getUserProfilePhotos(this.session.user.id, options);
121
+ });
122
+ }
123
+ getChat() {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ if (!this._session) {
126
+ (0, warning_1.default)(false, 'getChat: should not be called in context without session');
127
+ return null;
128
+ }
129
+ const chatId = this._getChatId();
130
+ if (chatId === null) {
131
+ (0, warning_1.default)(false, 'getChat: should not be called in context without chatId');
132
+ return null;
133
+ }
134
+ return this._client.getChat(chatId);
135
+ });
136
+ }
137
+ getChatAdministrators() {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ if (!this._session) {
140
+ (0, warning_1.default)(false, 'getChatAdministrators: should not be called in context without session');
141
+ return null;
142
+ }
143
+ const chatId = this._getChatId();
144
+ if (chatId === null) {
145
+ (0, warning_1.default)(false, 'getChatAdministrators: should not be called in context without chatId');
146
+ return null;
147
+ }
148
+ return this._client.getChatAdministrators(chatId);
149
+ });
150
+ }
151
+ getChatMembersCount() {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ if (!this._session) {
154
+ (0, warning_1.default)(false, 'getChatMembersCount: should not be called in context without session');
155
+ return null;
156
+ }
157
+ const chatId = this._getChatId();
158
+ if (chatId === null) {
159
+ (0, warning_1.default)(false, 'getChatMembersCount: should not be called in context without chatId');
160
+ return null;
161
+ }
162
+ return this._client.getChatMembersCount(chatId);
163
+ });
164
+ }
165
+ getChatMember(userId) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ if (!this._session) {
168
+ (0, warning_1.default)(false, 'getChatMember: should not be called in context without session');
169
+ return null;
170
+ }
171
+ const chatId = this._getChatId();
172
+ if (chatId === null) {
173
+ (0, warning_1.default)(false, 'getChatMember: should not be called in context without chatId');
174
+ return null;
175
+ }
176
+ return this._client.getChatMember(chatId, userId);
177
+ });
178
+ }
179
+ getGameHighScores(options) {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ if (!this._session) {
182
+ (0, warning_1.default)(false, 'getGameHighScores: should not be called in context without session');
183
+ return null;
184
+ }
185
+ const chatId = this._getChatId();
186
+ if (chatId === null) {
187
+ (0, warning_1.default)(false, 'getGameHighScores: should not be called in context without chatId');
188
+ return null;
189
+ }
190
+ return this._client.getGameHighScores(chatId, options);
191
+ });
192
+ }
193
+ editMessageText(messageId, text, options) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ if (!this._session) {
196
+ (0, warning_1.default)(false, 'editMessageText: should not be called in context without session');
197
+ return null;
198
+ }
199
+ const chatId = this._getChatId();
200
+ if (chatId === null) {
201
+ (0, warning_1.default)(false, 'editMessageText: should not be called in context without chatId');
202
+ return null;
203
+ }
204
+ return this._client.editMessageText(text, Object.assign({ chatId,
205
+ messageId }, options));
206
+ });
207
+ }
208
+ editMessageCaption(messageId, caption, options) {
209
+ return __awaiter(this, void 0, void 0, function* () {
210
+ if (!this._session) {
211
+ (0, warning_1.default)(false, 'editMessageCaption: should not be called in context without session');
212
+ return null;
213
+ }
214
+ const chatId = this._getChatId();
215
+ if (chatId === null) {
216
+ (0, warning_1.default)(false, 'editMessageCaption: should not be called in context without chatId');
217
+ return null;
218
+ }
219
+ return this._client.editMessageCaption(caption, Object.assign({ chatId,
220
+ messageId }, options));
221
+ });
222
+ }
223
+ editMessageMedia(messageId, media, options) {
224
+ return __awaiter(this, void 0, void 0, function* () {
225
+ if (!this._session) {
226
+ (0, warning_1.default)(false, 'editMessageMedia: should not be called in context without session');
227
+ return null;
228
+ }
229
+ const chatId = this._getChatId();
230
+ if (chatId === null) {
231
+ (0, warning_1.default)(false, 'editMessageMedia: should not be called in context without chatId');
232
+ return null;
233
+ }
234
+ return this._client.editMessageMedia(media, Object.assign({ chatId,
235
+ messageId }, options));
236
+ });
237
+ }
238
+ editMessageReplyMarkup(messageId, replyMarkup, options) {
239
+ return __awaiter(this, void 0, void 0, function* () {
240
+ if (!this._session) {
241
+ (0, warning_1.default)(false, 'editMessageReplyMarkup: should not be called in context without session');
242
+ return null;
243
+ }
244
+ const chatId = this._getChatId();
245
+ if (chatId === null) {
246
+ (0, warning_1.default)(false, 'editMessageReplyMarkup: should not be called in context without chatId');
247
+ return null;
248
+ }
249
+ return this._client.editMessageReplyMarkup(replyMarkup, Object.assign({ chatId,
250
+ messageId }, options));
251
+ });
252
+ }
253
+ deleteMessage(messageId) {
254
+ return __awaiter(this, void 0, void 0, function* () {
255
+ if (!this._session) {
256
+ (0, warning_1.default)(false, 'deleteMessage: should not be called in context without session');
257
+ return null;
258
+ }
259
+ const chatId = this._getChatId();
260
+ if (chatId === null) {
261
+ (0, warning_1.default)(false, 'deleteMessage: should not be called in context without chatId');
262
+ return null;
263
+ }
264
+ return this._client.deleteMessage(chatId, messageId);
265
+ });
266
+ }
267
+ editMessageLiveLocation(messageId, location, options) {
268
+ return __awaiter(this, void 0, void 0, function* () {
269
+ if (!this._session) {
270
+ (0, warning_1.default)(false, 'editMessageLiveLocation: should not be called in context without session');
271
+ return null;
272
+ }
273
+ const chatId = this._getChatId();
274
+ if (chatId === null) {
275
+ (0, warning_1.default)(false, 'editMessageLiveLocation: should not be called in context without chatId');
276
+ return null;
277
+ }
278
+ return this._client.editMessageLiveLocation(location, Object.assign({ chatId,
279
+ messageId }, options));
280
+ });
281
+ }
282
+ stopMessageLiveLocation(messageId, options) {
283
+ return __awaiter(this, void 0, void 0, function* () {
284
+ if (!this._session) {
285
+ (0, warning_1.default)(false, 'stopMessageLiveLocation: should not be called in context without session');
286
+ return null;
287
+ }
288
+ const chatId = this._getChatId();
289
+ if (chatId === null) {
290
+ (0, warning_1.default)(false, 'stopMessageLiveLocation: should not be called in context without chatId');
291
+ return null;
292
+ }
293
+ return this._client.stopMessageLiveLocation(Object.assign({ chatId,
294
+ messageId }, options));
295
+ });
296
+ }
297
+ forwardMessageFrom(fromChatId, messageId, options) {
298
+ return __awaiter(this, void 0, void 0, function* () {
299
+ if (!this._session) {
300
+ (0, warning_1.default)(false, 'forwardMessageFrom: should not be called in context without session');
301
+ return null;
302
+ }
303
+ const chatId = this._getChatId();
304
+ if (chatId === null) {
305
+ (0, warning_1.default)(false, 'forwardMessageFrom: should not be called in context without chatId');
306
+ return null;
307
+ }
308
+ return this._client.forwardMessage(chatId, fromChatId, messageId, options);
309
+ });
310
+ }
311
+ forwardMessageTo(toChatId, messageId, options) {
312
+ return __awaiter(this, void 0, void 0, function* () {
313
+ if (!this._session) {
314
+ (0, warning_1.default)(false, 'forwardMessageTo: should not be called in context without session');
315
+ return null;
316
+ }
317
+ const chatId = this._getChatId();
318
+ if (chatId === null) {
319
+ (0, warning_1.default)(false, 'forwardMessageTo: should not be called in context without chatId');
320
+ return null;
321
+ }
322
+ return this._client.forwardMessage(toChatId, chatId, messageId, options);
323
+ });
324
+ }
325
+ sendPhoto(photo, options) {
326
+ return __awaiter(this, void 0, void 0, function* () {
327
+ if (!this._session) {
328
+ (0, warning_1.default)(false, 'sendPhoto: should not be called in context without session');
329
+ return null;
330
+ }
331
+ const chatId = this._getChatId();
332
+ if (chatId === null) {
333
+ (0, warning_1.default)(false, 'sendPhoto: should not be called in context without chatId');
334
+ return null;
335
+ }
336
+ return this._client.sendPhoto(chatId, photo, options);
337
+ });
338
+ }
339
+ sendAudio(audio, options) {
340
+ return __awaiter(this, void 0, void 0, function* () {
341
+ if (!this._session) {
342
+ (0, warning_1.default)(false, 'sendAudio: should not be called in context without session');
343
+ return null;
344
+ }
345
+ const chatId = this._getChatId();
346
+ if (chatId === null) {
347
+ (0, warning_1.default)(false, 'sendAudio: should not be called in context without chatId');
348
+ return null;
349
+ }
350
+ return this._client.sendAudio(chatId, audio, options);
351
+ });
352
+ }
353
+ sendDocument(document, options) {
354
+ return __awaiter(this, void 0, void 0, function* () {
355
+ if (!this._session) {
356
+ (0, warning_1.default)(false, 'sendDocument: should not be called in context without session');
357
+ return null;
358
+ }
359
+ const chatId = this._getChatId();
360
+ if (chatId === null) {
361
+ (0, warning_1.default)(false, 'sendDocument: should not be called in context without chatId');
362
+ return null;
363
+ }
364
+ return this._client.sendDocument(chatId, document, options);
365
+ });
366
+ }
367
+ sendSticker(sticker, options) {
368
+ return __awaiter(this, void 0, void 0, function* () {
369
+ if (!this._session) {
370
+ (0, warning_1.default)(false, 'sendSticker: should not be called in context without session');
371
+ return null;
372
+ }
373
+ const chatId = this._getChatId();
374
+ if (chatId === null) {
375
+ (0, warning_1.default)(false, 'sendSticker: should not be called in context without chatId');
376
+ return null;
377
+ }
378
+ return this._client.sendSticker(chatId, sticker, options);
379
+ });
380
+ }
381
+ sendVideo(video, options) {
382
+ return __awaiter(this, void 0, void 0, function* () {
383
+ if (!this._session) {
384
+ (0, warning_1.default)(false, 'sendVideo: should not be called in context without session');
385
+ return null;
386
+ }
387
+ const chatId = this._getChatId();
388
+ if (chatId === null) {
389
+ (0, warning_1.default)(false, 'sendVideo: should not be called in context without chatId');
390
+ return null;
391
+ }
392
+ return this._client.sendVideo(chatId, video, options);
393
+ });
394
+ }
395
+ sendAnimation(animation, options) {
396
+ return __awaiter(this, void 0, void 0, function* () {
397
+ if (!this._session) {
398
+ (0, warning_1.default)(false, 'sendAnimation: should not be called in context without session');
399
+ return null;
400
+ }
401
+ const chatId = this._getChatId();
402
+ if (chatId === null) {
403
+ (0, warning_1.default)(false, 'sendAnimation: should not be called in context without chatId');
404
+ return null;
405
+ }
406
+ return this._client.sendAnimation(chatId, animation, options);
407
+ });
408
+ }
409
+ sendVoice(voice, options) {
410
+ return __awaiter(this, void 0, void 0, function* () {
411
+ if (!this._session) {
412
+ (0, warning_1.default)(false, 'sendVoice: should not be called in context without session');
413
+ return null;
414
+ }
415
+ const chatId = this._getChatId();
416
+ if (chatId === null) {
417
+ (0, warning_1.default)(false, 'sendVoice: should not be called in context without chatId');
418
+ return null;
419
+ }
420
+ return this._client.sendVoice(chatId, voice, options);
421
+ });
422
+ }
423
+ sendVideoNote(videoNote, options) {
424
+ return __awaiter(this, void 0, void 0, function* () {
425
+ if (!this._session) {
426
+ (0, warning_1.default)(false, 'sendVideoNote: should not be called in context without session');
427
+ return null;
428
+ }
429
+ const chatId = this._getChatId();
430
+ if (chatId === null) {
431
+ (0, warning_1.default)(false, 'sendVideoNote: should not be called in context without chatId');
432
+ return null;
433
+ }
434
+ return this._client.sendVideoNote(chatId, videoNote, options);
435
+ });
436
+ }
437
+ sendMediaGroup(media, options) {
438
+ return __awaiter(this, void 0, void 0, function* () {
439
+ if (!this._session) {
440
+ (0, warning_1.default)(false, 'sendMediaGroup: should not be called in context without session');
441
+ return null;
442
+ }
443
+ const chatId = this._getChatId();
444
+ if (chatId === null) {
445
+ (0, warning_1.default)(false, 'sendMediaGroup: should not be called in context without chatId');
446
+ return null;
447
+ }
448
+ return this._client.sendMediaGroup(chatId, media, options);
449
+ });
450
+ }
451
+ sendLocation({ latitude, longitude }, options) {
452
+ return __awaiter(this, void 0, void 0, function* () {
453
+ if (!this._session) {
454
+ (0, warning_1.default)(false, 'sendLocation: should not be called in context without session');
455
+ return null;
456
+ }
457
+ const chatId = this._getChatId();
458
+ if (chatId === null) {
459
+ (0, warning_1.default)(false, 'sendLocation: should not be called in context without chatId');
460
+ return null;
461
+ }
462
+ return this._client.sendLocation(chatId, { latitude, longitude }, options);
463
+ });
464
+ }
465
+ sendVenue(venue, options) {
466
+ return __awaiter(this, void 0, void 0, function* () {
467
+ if (!this._session) {
468
+ (0, warning_1.default)(false, 'sendVenue: should not be called in context without session');
469
+ return null;
470
+ }
471
+ const chatId = this._getChatId();
472
+ if (chatId === null) {
473
+ (0, warning_1.default)(false, 'sendVenue: should not be called in context without chatId');
474
+ return null;
475
+ }
476
+ return this._client.sendVenue(chatId, venue, options);
477
+ });
478
+ }
479
+ sendContact(requiredOptions, options) {
480
+ return __awaiter(this, void 0, void 0, function* () {
481
+ if (!this._session) {
482
+ (0, warning_1.default)(false, 'sendContact: should not be called in context without session');
483
+ return null;
484
+ }
485
+ const chatId = this._getChatId();
486
+ if (chatId === null) {
487
+ (0, warning_1.default)(false, 'sendContact: should not be called in context without chatId');
488
+ return null;
489
+ }
490
+ return this._client.sendContact(chatId, requiredOptions, options);
491
+ });
492
+ }
493
+ sendPoll(question, options, otherOptions) {
494
+ return __awaiter(this, void 0, void 0, function* () {
495
+ if (!this._session) {
496
+ (0, warning_1.default)(false, 'sendPoll: should not be called in context without session');
497
+ return null;
498
+ }
499
+ const chatId = this._getChatId();
500
+ if (chatId === null) {
501
+ (0, warning_1.default)(false, 'sendPoll: should not be called in context without chatId');
502
+ return null;
503
+ }
504
+ return this._client.sendPoll(chatId, question, options, otherOptions);
505
+ });
506
+ }
507
+ sendChatAction(action) {
508
+ return __awaiter(this, void 0, void 0, function* () {
509
+ if (!this._session) {
510
+ (0, warning_1.default)(false, 'sendChatAction: should not be called in context without session');
511
+ return null;
512
+ }
513
+ const chatId = this._getChatId();
514
+ if (chatId === null) {
515
+ (0, warning_1.default)(false, 'sendChatAction: should not be called in context without chatId');
516
+ return null;
517
+ }
518
+ return this._client.sendChatAction(chatId, action);
519
+ });
520
+ }
521
+ kickChatMember(userId, options) {
522
+ return __awaiter(this, void 0, void 0, function* () {
523
+ if (!this._session) {
524
+ (0, warning_1.default)(false, 'kickChatMember: should not be called in context without session');
525
+ return null;
526
+ }
527
+ const chatId = this._getChatId();
528
+ if (chatId === null) {
529
+ (0, warning_1.default)(false, 'kickChatMember: should not be called in context without chatId');
530
+ return null;
531
+ }
532
+ return this._client.kickChatMember(chatId, userId, options);
533
+ });
534
+ }
535
+ unbanChatMember(userId) {
536
+ return __awaiter(this, void 0, void 0, function* () {
537
+ if (!this._session) {
538
+ (0, warning_1.default)(false, 'unbanChatMember: should not be called in context without session');
539
+ return null;
540
+ }
541
+ const chatId = this._getChatId();
542
+ if (chatId === null) {
543
+ (0, warning_1.default)(false, 'unbanChatMember: should not be called in context without chatId');
544
+ return null;
545
+ }
546
+ return this._client.unbanChatMember(chatId, userId);
547
+ });
548
+ }
549
+ restrictChatMember(userId, permissions, options) {
550
+ return __awaiter(this, void 0, void 0, function* () {
551
+ if (!this._session) {
552
+ (0, warning_1.default)(false, 'restrictChatMember: should not be called in context without session');
553
+ return null;
554
+ }
555
+ const chatId = this._getChatId();
556
+ if (chatId === null) {
557
+ (0, warning_1.default)(false, 'restrictChatMember: should not be called in context without chatId');
558
+ return null;
559
+ }
560
+ return this._client.restrictChatMember(chatId, userId, permissions, options);
561
+ });
562
+ }
563
+ promoteChatMember(userId, options) {
564
+ return __awaiter(this, void 0, void 0, function* () {
565
+ if (!this._session) {
566
+ (0, warning_1.default)(false, 'promoteChatMember: should not be called in context without session');
567
+ return null;
568
+ }
569
+ const chatId = this._getChatId();
570
+ if (chatId === null) {
571
+ (0, warning_1.default)(false, 'promoteChatMember: should not be called in context without chatId');
572
+ return null;
573
+ }
574
+ return this._client.promoteChatMember(chatId, userId, options);
575
+ });
576
+ }
577
+ exportChatInviteLink() {
578
+ return __awaiter(this, void 0, void 0, function* () {
579
+ if (!this._session) {
580
+ (0, warning_1.default)(false, 'exportChatInviteLink: should not be called in context without session');
581
+ return null;
582
+ }
583
+ const chatId = this._getChatId();
584
+ if (chatId === null) {
585
+ (0, warning_1.default)(false, 'exportChatInviteLink: should not be called in context without chatId');
586
+ return null;
587
+ }
588
+ return this._client.exportChatInviteLink(chatId);
589
+ });
590
+ }
591
+ deleteChatPhoto() {
592
+ return __awaiter(this, void 0, void 0, function* () {
593
+ if (!this._session) {
594
+ (0, warning_1.default)(false, 'deleteChatPhoto: should not be called in context without session');
595
+ return null;
596
+ }
597
+ const chatId = this._getChatId();
598
+ if (chatId === null) {
599
+ (0, warning_1.default)(false, 'deleteChatPhoto: should not be called in context without chatId');
600
+ return null;
601
+ }
602
+ return this._client.deleteChatPhoto(chatId);
603
+ });
604
+ }
605
+ setChatTitle(title) {
606
+ return __awaiter(this, void 0, void 0, function* () {
607
+ if (!this._session) {
608
+ (0, warning_1.default)(false, 'setChatTitle: should not be called in context without session');
609
+ return null;
610
+ }
611
+ const chatId = this._getChatId();
612
+ if (chatId === null) {
613
+ (0, warning_1.default)(false, 'setChatTitle: should not be called in context without chatId');
614
+ return null;
615
+ }
616
+ return this._client.setChatTitle(chatId, title);
617
+ });
618
+ }
619
+ setChatDescription(description) {
620
+ return __awaiter(this, void 0, void 0, function* () {
621
+ if (!this._session) {
622
+ (0, warning_1.default)(false, 'setChatDescription: should not be called in context without session');
623
+ return null;
624
+ }
625
+ const chatId = this._getChatId();
626
+ if (chatId === null) {
627
+ (0, warning_1.default)(false, 'setChatDescription: should not be called in context without chatId');
628
+ return null;
629
+ }
630
+ return this._client.setChatDescription(chatId, description);
631
+ });
632
+ }
633
+ setChatStickerSet(stickerSetName) {
634
+ return __awaiter(this, void 0, void 0, function* () {
635
+ if (!this._session) {
636
+ (0, warning_1.default)(false, 'setChatStickerSet: should not be called in context without session');
637
+ return null;
638
+ }
639
+ const chatId = this._getChatId();
640
+ if (chatId === null) {
641
+ (0, warning_1.default)(false, 'setChatStickerSet: should not be called in context without chatId');
642
+ return null;
643
+ }
644
+ return this._client.setChatStickerSet(chatId, stickerSetName);
645
+ });
646
+ }
647
+ deleteChatStickerSet() {
648
+ return __awaiter(this, void 0, void 0, function* () {
649
+ if (!this._session) {
650
+ (0, warning_1.default)(false, 'deleteChatStickerSet: should not be called in context without session');
651
+ return null;
652
+ }
653
+ const chatId = this._getChatId();
654
+ if (chatId === null) {
655
+ (0, warning_1.default)(false, 'deleteChatStickerSet: should not be called in context without chatId');
656
+ return null;
657
+ }
658
+ return this._client.deleteChatStickerSet(chatId);
659
+ });
660
+ }
661
+ pinChatMessage(messageId, options) {
662
+ return __awaiter(this, void 0, void 0, function* () {
663
+ if (!this._session) {
664
+ (0, warning_1.default)(false, 'pinChatMessage: should not be called in context without session');
665
+ return null;
666
+ }
667
+ const chatId = this._getChatId();
668
+ if (chatId === null) {
669
+ (0, warning_1.default)(false, 'pinChatMessage: should not be called in context without chatId');
670
+ return null;
671
+ }
672
+ return this._client.pinChatMessage(chatId, messageId, options);
673
+ });
674
+ }
675
+ unpinChatMessage() {
676
+ return __awaiter(this, void 0, void 0, function* () {
677
+ if (!this._session) {
678
+ (0, warning_1.default)(false, 'unpinChatMessage: should not be called in context without session');
679
+ return null;
680
+ }
681
+ const chatId = this._getChatId();
682
+ if (chatId === null) {
683
+ (0, warning_1.default)(false, 'unpinChatMessage: should not be called in context without chatId');
684
+ return null;
685
+ }
686
+ return this._client.unpinChatMessage(chatId);
687
+ });
688
+ }
689
+ leaveChat() {
690
+ return __awaiter(this, void 0, void 0, function* () {
691
+ if (!this._session) {
692
+ (0, warning_1.default)(false, 'leaveChat: should not be called in context without session');
693
+ return null;
694
+ }
695
+ const chatId = this._getChatId();
696
+ if (chatId === null) {
697
+ (0, warning_1.default)(false, 'leaveChat: should not be called in context without chatId');
698
+ return null;
699
+ }
700
+ return this._client.leaveChat(chatId);
701
+ });
702
+ }
703
+ sendInvoice(product, options) {
704
+ return __awaiter(this, void 0, void 0, function* () {
705
+ if (!this._session) {
706
+ (0, warning_1.default)(false, 'sendInvoice: should not be called in context without session');
707
+ return null;
708
+ }
709
+ const chatId = this._getChatId();
710
+ if (chatId === null) {
711
+ (0, warning_1.default)(false, 'sendInvoice: should not be called in context without chatId');
712
+ return null;
713
+ }
714
+ return this._client.sendInvoice(chatId, product, options);
715
+ });
716
+ }
717
+ sendGame(gameShortName, options) {
718
+ return __awaiter(this, void 0, void 0, function* () {
719
+ if (!this._session) {
720
+ (0, warning_1.default)(false, 'sendGame: should not be called in context without session');
721
+ return null;
722
+ }
723
+ const chatId = this._getChatId();
724
+ if (chatId === null) {
725
+ (0, warning_1.default)(false, 'sendGame: should not be called in context without chatId');
726
+ return null;
727
+ }
728
+ return this._client.sendGame(chatId, gameShortName, options);
729
+ });
730
+ }
731
+ setGameScore(userId, score, options) {
732
+ return __awaiter(this, void 0, void 0, function* () {
733
+ if (!this._session) {
734
+ (0, warning_1.default)(false, 'setGameScore: should not be called in context without session');
735
+ return null;
736
+ }
737
+ return this._client.setGameScore(userId, score, options);
738
+ });
739
+ }
740
+ }
741
+ exports.default = TelegramContext;
742
+ //# sourceMappingURL=TelegramContext.js.map