@deffa5556/bail 1.0.6 → 1.0.7

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 (314) hide show
  1. package/cjs/WAProto/index.cjs +106053 -0
  2. package/cjs/deffa/config.cjs +14 -0
  3. package/cjs/deffa/plugins/ai/deepseekr1.cjs +35 -0
  4. package/cjs/deffa/plugins/ai/gita.cjs +26 -0
  5. package/cjs/deffa/plugins/ai/glm47flash.cjs +35 -0
  6. package/cjs/deffa/plugins/ai/gptoss120b.cjs +35 -0
  7. package/cjs/deffa/plugins/ai/qwq32b.cjs +35 -0
  8. package/cjs/deffa/plugins/berita/antara.cjs +25 -0
  9. package/cjs/deffa/plugins/berita/cnbcindonesia.cjs +25 -0
  10. package/cjs/deffa/plugins/berita/cnn.cjs +25 -0
  11. package/cjs/deffa/plugins/berita/kompas.cjs +25 -0
  12. package/cjs/deffa/plugins/berita/liputan6.cjs +25 -0
  13. package/cjs/deffa/plugins/berita/merdeka.cjs +25 -0
  14. package/cjs/deffa/plugins/berita/sindonews.cjs +25 -0
  15. package/cjs/deffa/plugins/berita/tribunnews.cjs +25 -0
  16. package/cjs/deffa/plugins/downloader/douyin.cjs +30 -0
  17. package/cjs/deffa/plugins/downloader/facebook.cjs +30 -0
  18. package/cjs/deffa/plugins/downloader/github.cjs +35 -0
  19. package/cjs/deffa/plugins/downloader/lahelu.cjs +30 -0
  20. package/cjs/deffa/plugins/downloader/snackvideo.cjs +30 -0
  21. package/cjs/deffa/plugins/downloader/soundcloud.cjs +30 -0
  22. package/cjs/deffa/plugins/downloader/tiktok.cjs +30 -0
  23. package/cjs/deffa/plugins/downloader/tiktokhd.cjs +30 -0
  24. package/cjs/deffa/plugins/downloader/twitter.cjs +30 -0
  25. package/cjs/deffa/plugins/downloader/ummy.cjs +36 -0
  26. package/cjs/deffa/plugins/index.cjs +213 -0
  27. package/cjs/deffa/plugins/info/bmkg.cjs +34 -0
  28. package/cjs/deffa/plugins/info/cuaca.cjs +31 -0
  29. package/cjs/deffa/plugins/info/jadwaltv.cjs +29 -0
  30. package/cjs/deffa/plugins/maker/brat.cjs +45 -0
  31. package/cjs/deffa/plugins/maker/bratvid.cjs +52 -0
  32. package/cjs/deffa/plugins/search/8font.cjs +28 -0
  33. package/cjs/deffa/plugins/search/applemusic.cjs +28 -0
  34. package/cjs/deffa/plugins/search/bimg.cjs +30 -0
  35. package/cjs/deffa/plugins/search/brave.cjs +34 -0
  36. package/cjs/deffa/plugins/search/duckduckgo.cjs +28 -0
  37. package/cjs/deffa/plugins/search/lahelu.cjs +28 -0
  38. package/cjs/deffa/plugins/search/mangatoon.cjs +28 -0
  39. package/cjs/deffa/plugins/search/mcpedl.cjs +28 -0
  40. package/cjs/deffa/plugins/search/myinstants.cjs +28 -0
  41. package/cjs/deffa/plugins/search/otakotaku.cjs +28 -0
  42. package/cjs/deffa/plugins/search/pinterest.cjs +30 -0
  43. package/cjs/deffa/plugins/search/resep.cjs +28 -0
  44. package/cjs/deffa/plugins/search/seegore.cjs +30 -0
  45. package/cjs/deffa/plugins/search/soundcloud.cjs +28 -0
  46. package/cjs/deffa/plugins/search/youtube.cjs +28 -0
  47. package/cjs/deffa/plugins/stalk/github.cjs +38 -0
  48. package/cjs/deffa/plugins/stalk/pinterest.cjs +37 -0
  49. package/cjs/deffa/plugins/stalk/threads.cjs +34 -0
  50. package/cjs/deffa/plugins/stalk/tiktok.cjs +37 -0
  51. package/cjs/deffa/plugins/stalk/twitter.cjs +37 -0
  52. package/cjs/deffa/plugins/stalk/youtube.cjs +37 -0
  53. package/cjs/lib/Defaults/index.cjs +158 -0
  54. package/cjs/lib/Discord/Client.cjs +263 -0
  55. package/cjs/lib/Discord/Constants.cjs +1842 -0
  56. package/cjs/lib/Discord/connect-dc.cjs +11 -0
  57. package/cjs/lib/Discord/esm-bridge.cjs +136 -0
  58. package/cjs/lib/Discord/gateway/Dispatcher.cjs +93 -0
  59. package/cjs/lib/Discord/gateway/Shard.cjs +695 -0
  60. package/cjs/lib/Discord/gateway/ShardManager.cjs +344 -0
  61. package/cjs/lib/Discord/gateway/compression/base.cjs +13 -0
  62. package/cjs/lib/Discord/gateway/compression/config.cjs +47 -0
  63. package/cjs/lib/Discord/gateway/compression/pako.cjs +44 -0
  64. package/cjs/lib/Discord/gateway/compression/zlib-native.cjs +47 -0
  65. package/cjs/lib/Discord/gateway/compression/zlib-sync.cjs +31 -0
  66. package/cjs/lib/Discord/gateway/compression/zstd-napi.cjs +80 -0
  67. package/cjs/lib/Discord/gateway/compression/zstd-native.cjs +46 -0
  68. package/cjs/lib/Discord/gateway/events.cjs +956 -0
  69. package/cjs/lib/Discord/index.cjs +238 -0
  70. package/cjs/lib/Discord/rest/Bucket.cjs +69 -0
  71. package/cjs/lib/Discord/rest/DiscordHTTPError.cjs +63 -0
  72. package/cjs/lib/Discord/rest/DiscordRESTError.cjs +84 -0
  73. package/cjs/lib/Discord/rest/OAuthHelper.cjs +226 -0
  74. package/cjs/lib/Discord/rest/RESTManager.cjs +116 -0
  75. package/cjs/lib/Discord/rest/RequestHandler.cjs +320 -0
  76. package/cjs/lib/Discord/rest/SequentialBucket.cjs +69 -0
  77. package/cjs/lib/Discord/routes/Applications.cjs +625 -0
  78. package/cjs/lib/Discord/routes/Channels.cjs +1199 -0
  79. package/cjs/lib/Discord/routes/Guilds.cjs +1792 -0
  80. package/cjs/lib/Discord/routes/Interactions.cjs +212 -0
  81. package/cjs/lib/Discord/routes/Lobbies.cjs +197 -0
  82. package/cjs/lib/Discord/routes/Miscellaneous.cjs +120 -0
  83. package/cjs/lib/Discord/routes/OAuth.cjs +350 -0
  84. package/cjs/lib/Discord/routes/Users.cjs +107 -0
  85. package/cjs/lib/Discord/routes/Webhooks.cjs +308 -0
  86. package/cjs/lib/Discord/structures/AnnouncementChannel.cjs +46 -0
  87. package/cjs/lib/Discord/structures/AnnouncementThreadChannel.cjs +28 -0
  88. package/cjs/lib/Discord/structures/Application.cjs +345 -0
  89. package/cjs/lib/Discord/structures/ApplicationCommand.cjs +109 -0
  90. package/cjs/lib/Discord/structures/Attachment.cjs +46 -0
  91. package/cjs/lib/Discord/structures/AuditLogEntry.cjs +41 -0
  92. package/cjs/lib/Discord/structures/AutoModerationRule.cjs +117 -0
  93. package/cjs/lib/Discord/structures/AutocompleteInteraction.cjs +90 -0
  94. package/cjs/lib/Discord/structures/Base.cjs +56 -0
  95. package/cjs/lib/Discord/structures/BaseEntitlement.cjs +40 -0
  96. package/cjs/lib/Discord/structures/CategoryChannel.cjs +102 -0
  97. package/cjs/lib/Discord/structures/Channel.cjs +89 -0
  98. package/cjs/lib/Discord/structures/ClientApplication.cjs +269 -0
  99. package/cjs/lib/Discord/structures/CommandInteraction.cjs +294 -0
  100. package/cjs/lib/Discord/structures/ComponentInteraction.cjs +306 -0
  101. package/cjs/lib/Discord/structures/Entitlement.cjs +24 -0
  102. package/cjs/lib/Discord/structures/ExtendedUser.cjs +48 -0
  103. package/cjs/lib/Discord/structures/ForumChannel.cjs +20 -0
  104. package/cjs/lib/Discord/structures/GroupChannel.cjs +160 -0
  105. package/cjs/lib/Discord/structures/Guild.cjs +1289 -0
  106. package/cjs/lib/Discord/structures/GuildChannel.cjs +82 -0
  107. package/cjs/lib/Discord/structures/GuildPreview.cjs +141 -0
  108. package/cjs/lib/Discord/structures/GuildScheduledEvent.cjs +166 -0
  109. package/cjs/lib/Discord/structures/GuildTemplate.cjs +96 -0
  110. package/cjs/lib/Discord/structures/Integration.cjs +123 -0
  111. package/cjs/lib/Discord/structures/Interaction.cjs +78 -0
  112. package/cjs/lib/Discord/structures/InteractionResolvedChannel.cjs +36 -0
  113. package/cjs/lib/Discord/structures/Invite.cjs +196 -0
  114. package/cjs/lib/Discord/structures/InviteGuild.cjs +117 -0
  115. package/cjs/lib/Discord/structures/InviteRole.cjs +88 -0
  116. package/cjs/lib/Discord/structures/Lobby.cjs +84 -0
  117. package/cjs/lib/Discord/structures/LobbyMember.cjs +30 -0
  118. package/cjs/lib/Discord/structures/MediaChannel.cjs +20 -0
  119. package/cjs/lib/Discord/structures/Member.cjs +300 -0
  120. package/cjs/lib/Discord/structures/Message.cjs +553 -0
  121. package/cjs/lib/Discord/structures/ModalSubmitInteraction.cjs +263 -0
  122. package/cjs/lib/Discord/structures/OAuthApplication.cjs +203 -0
  123. package/cjs/lib/Discord/structures/OAuthGuild.cjs +98 -0
  124. package/cjs/lib/Discord/structures/PartialApplication.cjs +97 -0
  125. package/cjs/lib/Discord/structures/Permission.cjs +61 -0
  126. package/cjs/lib/Discord/structures/PermissionOverwrite.cjs +46 -0
  127. package/cjs/lib/Discord/structures/PingInteraction.cjs +27 -0
  128. package/cjs/lib/Discord/structures/Poll.cjs +69 -0
  129. package/cjs/lib/Discord/structures/PrimaryGuild.cjs +93 -0
  130. package/cjs/lib/Discord/structures/PrivateChannel.cjs +131 -0
  131. package/cjs/lib/Discord/structures/PrivateThreadChannel.cjs +28 -0
  132. package/cjs/lib/Discord/structures/PublicThreadChannel.cjs +36 -0
  133. package/cjs/lib/Discord/structures/Role.cjs +126 -0
  134. package/cjs/lib/Discord/structures/SKU.cjs +58 -0
  135. package/cjs/lib/Discord/structures/Soundboard.cjs +58 -0
  136. package/cjs/lib/Discord/structures/StageChannel.cjs +45 -0
  137. package/cjs/lib/Discord/structures/StageInstance.cjs +80 -0
  138. package/cjs/lib/Discord/structures/Subscription.cjs +21 -0
  139. package/cjs/lib/Discord/structures/Team.cjs +70 -0
  140. package/cjs/lib/Discord/structures/TestEntitlement.cjs +22 -0
  141. package/cjs/lib/Discord/structures/TextChannel.cjs +48 -0
  142. package/cjs/lib/Discord/structures/TextableChannel.cjs +265 -0
  143. package/cjs/lib/Discord/structures/TextableVoiceChannel.cjs +70 -0
  144. package/cjs/lib/Discord/structures/ThreadChannel.cjs +276 -0
  145. package/cjs/lib/Discord/structures/ThreadOnlyChannel.cjs +205 -0
  146. package/cjs/lib/Discord/structures/ThreadableChannel.cjs +57 -0
  147. package/cjs/lib/Discord/structures/UnavailableGuild.cjs +21 -0
  148. package/cjs/lib/Discord/structures/User.cjs +223 -0
  149. package/cjs/lib/Discord/structures/VoiceChannel.cjs +34 -0
  150. package/cjs/lib/Discord/structures/VoiceState.cjs +113 -0
  151. package/cjs/lib/Discord/structures/Webhook.cjs +224 -0
  152. package/cjs/lib/Discord/util/Collection.cjs +77 -0
  153. package/cjs/lib/Discord/util/Errors.cjs +81 -0
  154. package/cjs/lib/Discord/util/QueryBuilder.cjs +20 -0
  155. package/cjs/lib/Discord/util/Routes.cjs +293 -0
  156. package/cjs/lib/Discord/util/SimpleCollection.cjs +78 -0
  157. package/cjs/lib/Discord/util/Time.cjs +92 -0
  158. package/cjs/lib/Discord/util/TypedCollection.cjs +78 -0
  159. package/cjs/lib/Discord/util/TypedEmitter.cjs +20 -0
  160. package/cjs/lib/Discord/util/Util.cjs +906 -0
  161. package/cjs/lib/Discord/util/interactions/InteractionOptionsWrapper.cjs +207 -0
  162. package/cjs/lib/Discord/util/interactions/MessageInteractionResponse.cjs +26 -0
  163. package/cjs/lib/Discord/util/interactions/ModalSubmitInteractionComponentsWrapper.cjs +98 -0
  164. package/cjs/lib/Discord/util/interactions/SelectMenuValuesWrapper.cjs +77 -0
  165. package/cjs/lib/Discord/util/interactions/shared.cjs +20 -0
  166. package/cjs/lib/Discord/util/warning.cjs +34 -0
  167. package/cjs/lib/Signal/Group/ciphertext-message.cjs +16 -0
  168. package/cjs/lib/Signal/Group/group-session-builder.cjs +67 -0
  169. package/cjs/lib/Signal/Group/group_cipher.cjs +86 -0
  170. package/cjs/lib/Signal/Group/index.cjs +58 -0
  171. package/cjs/lib/Signal/Group/keyhelper.cjs +56 -0
  172. package/cjs/lib/Signal/Group/sender-chain-key.cjs +30 -0
  173. package/cjs/lib/Signal/Group/sender-key-distribution-message.cjs +67 -0
  174. package/cjs/lib/Signal/Group/sender-key-message.cjs +70 -0
  175. package/cjs/lib/Signal/Group/sender-key-name.cjs +52 -0
  176. package/cjs/lib/Signal/Group/sender-key-record.cjs +45 -0
  177. package/cjs/lib/Signal/Group/sender-key-state.cjs +88 -0
  178. package/cjs/lib/Signal/Group/sender-message-key.cjs +30 -0
  179. package/cjs/lib/Signal/libsignal.cjs +467 -0
  180. package/cjs/lib/Signal/lid-mapping.cjs +281 -0
  181. package/cjs/lib/Socket/Client/index.cjs +19 -0
  182. package/cjs/lib/Socket/Client/types.cjs +15 -0
  183. package/cjs/lib/Socket/Client/websocket.cjs +61 -0
  184. package/cjs/lib/Socket/business.cjs +384 -0
  185. package/cjs/lib/Socket/chats.cjs +1221 -0
  186. package/cjs/lib/Socket/communities.cjs +440 -0
  187. package/cjs/lib/Socket/groups.cjs +353 -0
  188. package/cjs/lib/Socket/index.cjs +14 -0
  189. package/cjs/lib/Socket/messages-recv.cjs +1772 -0
  190. package/cjs/lib/Socket/messages-send.cjs +1376 -0
  191. package/cjs/lib/Socket/mex.cjs +46 -0
  192. package/cjs/lib/Socket/newsletter.cjs +230 -0
  193. package/cjs/lib/Socket/socket.cjs +976 -0
  194. package/cjs/lib/Store/index.cjs +20 -0
  195. package/cjs/lib/Store/make-in-memory-store.cjs +470 -0
  196. package/cjs/lib/Store/make-ordered-dictionary.cjs +82 -0
  197. package/cjs/lib/Store/object-repository.cjs +28 -0
  198. package/cjs/lib/Telegram/button.cjs +147 -0
  199. package/cjs/lib/Telegram/composer.cjs +582 -0
  200. package/cjs/lib/Telegram/context.cjs +853 -0
  201. package/cjs/lib/Telegram/core/helpers/args.cjs +57 -0
  202. package/cjs/lib/Telegram/core/helpers/check.cjs +55 -0
  203. package/cjs/lib/Telegram/core/helpers/compact.cjs +16 -0
  204. package/cjs/lib/Telegram/core/helpers/deunionize.cjs +12 -0
  205. package/cjs/lib/Telegram/core/helpers/formatting.cjs +91 -0
  206. package/cjs/lib/Telegram/core/helpers/util.cjs +50 -0
  207. package/cjs/lib/Telegram/core/network/client.cjs +338 -0
  208. package/cjs/lib/Telegram/core/network/error.cjs +21 -0
  209. package/cjs/lib/Telegram/core/network/multipart-stream.cjs +79 -0
  210. package/cjs/lib/Telegram/core/network/polling.cjs +87 -0
  211. package/cjs/lib/Telegram/core/network/webhook.cjs +54 -0
  212. package/cjs/lib/Telegram/core/types/typegram.cjs +31 -0
  213. package/cjs/lib/Telegram/deffa-telegraf.cjs +264 -0
  214. package/cjs/lib/Telegram/esm-bridge.cjs +20 -0
  215. package/cjs/lib/Telegram/filters.cjs +69 -0
  216. package/cjs/lib/Telegram/format.cjs +58 -0
  217. package/cjs/lib/Telegram/future.cjs +140 -0
  218. package/cjs/lib/Telegram/index.cjs +67 -0
  219. package/cjs/lib/Telegram/input.cjs +61 -0
  220. package/cjs/lib/Telegram/markup.cjs +129 -0
  221. package/cjs/lib/Telegram/middleware.cjs +2 -0
  222. package/cjs/lib/Telegram/reactions.cjs +84 -0
  223. package/cjs/lib/Telegram/router.cjs +46 -0
  224. package/cjs/lib/Telegram/scenes/base.cjs +39 -0
  225. package/cjs/lib/Telegram/scenes/context.cjs +104 -0
  226. package/cjs/lib/Telegram/scenes/index.cjs +21 -0
  227. package/cjs/lib/Telegram/scenes/stage.cjs +49 -0
  228. package/cjs/lib/Telegram/scenes/wizard/context.cjs +31 -0
  229. package/cjs/lib/Telegram/scenes/wizard/index.cjs +45 -0
  230. package/cjs/lib/Telegram/scenes.cjs +21 -0
  231. package/cjs/lib/Telegram/session.cjs +166 -0
  232. package/cjs/lib/Telegram/telegram-types.cjs +6 -0
  233. package/cjs/lib/Telegram/telegram.cjs +945 -0
  234. package/cjs/lib/Telegram/types.cjs +2 -0
  235. package/cjs/lib/Telegram/utils.cjs +5 -0
  236. package/cjs/lib/Types/Auth.cjs +3 -0
  237. package/cjs/lib/Types/Bussines.cjs +3 -0
  238. package/cjs/lib/Types/Call.cjs +3 -0
  239. package/cjs/lib/Types/Chat.cjs +11 -0
  240. package/cjs/lib/Types/Contact.cjs +3 -0
  241. package/cjs/lib/Types/Events.cjs +4 -0
  242. package/cjs/lib/Types/GroupMetadata.cjs +3 -0
  243. package/cjs/lib/Types/Label.cjs +26 -0
  244. package/cjs/lib/Types/LabelAssociation.cjs +8 -0
  245. package/cjs/lib/Types/Message.cjs +19 -0
  246. package/cjs/lib/Types/Mex.cjs +40 -0
  247. package/cjs/lib/Types/Product.cjs +3 -0
  248. package/cjs/lib/Types/RichType.cjs +24 -0
  249. package/cjs/lib/Types/Signal.cjs +4 -0
  250. package/cjs/lib/Types/Socket.cjs +4 -0
  251. package/cjs/lib/Types/State.cjs +54 -0
  252. package/cjs/lib/Types/USync.cjs +4 -0
  253. package/cjs/lib/Types/index.cjs +42 -0
  254. package/cjs/lib/Utils/auth-utils.cjs +312 -0
  255. package/cjs/lib/Utils/browser-utils.cjs +39 -0
  256. package/cjs/lib/Utils/business.cjs +241 -0
  257. package/cjs/lib/Utils/chat-utils.cjs +890 -0
  258. package/cjs/lib/Utils/companion-reg-client-utils.cjs +51 -0
  259. package/cjs/lib/Utils/crypto.cjs +170 -0
  260. package/cjs/lib/Utils/decode-wa-message.cjs +330 -0
  261. package/cjs/lib/Utils/event-buffer.cjs +629 -0
  262. package/cjs/lib/Utils/generics.cjs +427 -0
  263. package/cjs/lib/Utils/history.cjs +141 -0
  264. package/cjs/lib/Utils/identity-change-handler.cjs +56 -0
  265. package/cjs/lib/Utils/index.cjs +43 -0
  266. package/cjs/lib/Utils/link-preview.cjs +122 -0
  267. package/cjs/lib/Utils/logger.cjs +8 -0
  268. package/cjs/lib/Utils/lt-hash.cjs +11 -0
  269. package/cjs/lib/Utils/make-mutex.cjs +38 -0
  270. package/cjs/lib/Utils/message-retry-manager.cjs +267 -0
  271. package/cjs/lib/Utils/messages-media.cjs +906 -0
  272. package/cjs/lib/Utils/messages.cjs +1909 -0
  273. package/cjs/lib/Utils/noise-handler.cjs +205 -0
  274. package/cjs/lib/Utils/offline-node-processor.cjs +43 -0
  275. package/cjs/lib/Utils/pre-key-manager.cjs +113 -0
  276. package/cjs/lib/Utils/process-message.cjs +755 -0
  277. package/cjs/lib/Utils/reporting-utils.cjs +263 -0
  278. package/cjs/lib/Utils/rich-message-utils.cjs +434 -0
  279. package/cjs/lib/Utils/session-guard.cjs +163 -0
  280. package/cjs/lib/Utils/signal.cjs +214 -0
  281. package/cjs/lib/Utils/stanza-ack.cjs +41 -0
  282. package/cjs/lib/Utils/sync-action-utils.cjs +54 -0
  283. package/cjs/lib/Utils/tc-token-utils.cjs +174 -0
  284. package/cjs/lib/Utils/text-sticker.cjs +174 -0
  285. package/cjs/lib/Utils/use-multi-file-auth-state.cjs +125 -0
  286. package/cjs/lib/Utils/use-single-file-auth-state.cjs +113 -0
  287. package/cjs/lib/Utils/use-sqlite-auth-state.cjs +145 -0
  288. package/cjs/lib/Utils/validate-connection.cjs +210 -0
  289. package/cjs/lib/WABinary/constants.cjs +1470 -0
  290. package/cjs/lib/WABinary/decode.cjs +301 -0
  291. package/cjs/lib/WABinary/encode.cjs +257 -0
  292. package/cjs/lib/WABinary/generic-utils.cjs +240 -0
  293. package/cjs/lib/WABinary/index.cjs +22 -0
  294. package/cjs/lib/WABinary/jid-utils.cjs +114 -0
  295. package/cjs/lib/WABinary/types.cjs +37 -0
  296. package/cjs/lib/WAM/BinaryInfo.cjs +14 -0
  297. package/cjs/lib/WAM/constants.cjs +22856 -0
  298. package/cjs/lib/WAM/encode.cjs +154 -0
  299. package/cjs/lib/WAM/index.cjs +20 -0
  300. package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.cjs +56 -0
  301. package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.cjs +58 -0
  302. package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.cjs +31 -0
  303. package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.cjs +42 -0
  304. package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.cjs +29 -0
  305. package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.cjs +55 -0
  306. package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.cjs +33 -0
  307. package/cjs/lib/WAUSync/Protocols/index.cjs +22 -0
  308. package/cjs/lib/WAUSync/USyncQuery.cjs +102 -0
  309. package/cjs/lib/WAUSync/USyncUser.cjs +35 -0
  310. package/cjs/lib/WAUSync/index.cjs +20 -0
  311. package/cjs/lib/index.cjs +372 -0
  312. package/cjs/lib/plugins/loader.cjs +117 -0
  313. package/lib/Defaults/index.js +1 -1
  314. package/package.json +11 -6
@@ -0,0 +1,853 @@
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.Context = void 0;
7
+ const debug_1 = __importDefault(require("debug"));
8
+ const reactions_1 = require("./reactions");
9
+ const debug = (0, debug_1.default)('telegraf:context');
10
+ class Context {
11
+ constructor(update, telegram, botInfo) {
12
+ this.update = update;
13
+ this.telegram = telegram;
14
+ this.botInfo = botInfo;
15
+ this.state = {};
16
+ }
17
+ get updateType() {
18
+ for (const key in this.update) {
19
+ if (typeof this.update[key] === 'object')
20
+ return key;
21
+ }
22
+ throw new Error(`Cannot determine \`updateType\` of ${JSON.stringify(this.update)}`);
23
+ }
24
+ get me() {
25
+ var _a;
26
+ return (_a = this.botInfo) === null || _a === void 0 ? void 0 : _a.username;
27
+ }
28
+ get tg() {
29
+ return this.telegram;
30
+ }
31
+ get message() {
32
+ return this.update.message;
33
+ }
34
+ get editedMessage() {
35
+ return this.update.edited_message;
36
+ }
37
+ get inlineQuery() {
38
+ return this.update.inline_query;
39
+ }
40
+ get shippingQuery() {
41
+ return this.update.shipping_query;
42
+ }
43
+ get preCheckoutQuery() {
44
+ return this.update.pre_checkout_query;
45
+ }
46
+ get chosenInlineResult() {
47
+ return this.update.chosen_inline_result;
48
+ }
49
+ get channelPost() {
50
+ return this.update.channel_post;
51
+ }
52
+ get editedChannelPost() {
53
+ return this.update.edited_channel_post;
54
+ }
55
+ get messageReaction() {
56
+ return this.update.message_reaction;
57
+ }
58
+ get messageReactionCount() {
59
+ return this.update.message_reaction_count;
60
+ }
61
+ get callbackQuery() {
62
+ return this.update.callback_query;
63
+ }
64
+ get poll() {
65
+ return this.update.poll;
66
+ }
67
+ get pollAnswer() {
68
+ return this.update.poll_answer;
69
+ }
70
+ get myChatMember() {
71
+ return this.update.my_chat_member;
72
+ }
73
+ get chatMember() {
74
+ return this.update.chat_member;
75
+ }
76
+ get chatJoinRequest() {
77
+ return this.update.chat_join_request;
78
+ }
79
+ get chatBoost() {
80
+ return this.update.chat_boost;
81
+ }
82
+ get removedChatBoost() {
83
+ return this.update.removed_chat_boost;
84
+ }
85
+ get guestMessage() {
86
+ return this.update.guest_message;
87
+ }
88
+ get msg() {
89
+ return getMessageFromAnySource(this);
90
+ }
91
+ get msgId() {
92
+ return getMsgIdFromAnySource(this);
93
+ }
94
+ get chat() {
95
+ var _a, _b, _c, _d, _e, _f, _g;
96
+ return (_g = ((_f = (_e = (_d = (_c = (_b = (_a = this.msg) !== null && _a !== void 0 ? _a : this.messageReaction) !== null && _b !== void 0 ? _b : this.messageReactionCount) !== null && _c !== void 0 ? _c : this.chatJoinRequest) !== null && _d !== void 0 ? _d : this.chatMember) !== null && _e !== void 0 ? _e : this.myChatMember) !== null && _f !== void 0 ? _f : this.removedChatBoost)) === null || _g === void 0 ? void 0 : _g.chat;
97
+ }
98
+ get senderChat() {
99
+ const msg = this.msg;
100
+ return ((msg === null || msg === void 0 ? void 0 : msg.has('sender_chat')) && msg.sender_chat);
101
+ }
102
+ get from() {
103
+ return getUserFromAnySource(this);
104
+ }
105
+ get inlineMessageId() {
106
+ var _a, _b;
107
+ return (_b = ((_a = this.callbackQuery) !== null && _a !== void 0 ? _a : this.chosenInlineResult)) === null || _b === void 0 ? void 0 : _b.inline_message_id;
108
+ }
109
+ get passportData() {
110
+ var _a;
111
+ if (this.message == null)
112
+ return undefined;
113
+ if (!('passport_data' in this.message))
114
+ return undefined;
115
+ return (_a = this.message) === null || _a === void 0 ? void 0 : _a.passport_data;
116
+ }
117
+ get webAppData() {
118
+ if (!(this.message && 'web_app_data' in this.message))
119
+ return undefined;
120
+ const { data, button_text } = this.message.web_app_data;
121
+ return {
122
+ data: {
123
+ json() {
124
+ return JSON.parse(data);
125
+ },
126
+ text() {
127
+ return data;
128
+ },
129
+ },
130
+ button_text,
131
+ };
132
+ }
133
+ get webhookReply() {
134
+ return this.telegram.webhookReply;
135
+ }
136
+ set webhookReply(enable) {
137
+ this.telegram.webhookReply = enable;
138
+ }
139
+ get reactions() {
140
+ return reactions_1.MessageReactions.from(this);
141
+ }
142
+ assert(value, method) {
143
+ if (value === undefined) {
144
+ throw new TypeError(`Telegraf: "${method}" isn't available for "${this.updateType}"`);
145
+ }
146
+ }
147
+ has(filters) {
148
+ if (!Array.isArray(filters))
149
+ filters = [filters];
150
+ for (const filter of filters)
151
+ if (typeof filter !== 'string'
152
+ ?
153
+ filter(this.update)
154
+ :
155
+ filter in this.update)
156
+ return true;
157
+ return false;
158
+ }
159
+ get text() {
160
+ return getTextAndEntitiesFromAnySource(this)[0];
161
+ }
162
+ entities(...types) {
163
+ const [text = '', entities = []] = getTextAndEntitiesFromAnySource(this);
164
+ return (types.length
165
+ ? entities.filter((entity) => types.includes(entity.type))
166
+ : entities).map((entity) => ({
167
+ ...entity,
168
+ fragment: text.slice(entity.offset, entity.offset + entity.length),
169
+ }));
170
+ }
171
+ answerInlineQuery(...args) {
172
+ this.assert(this.inlineQuery, 'answerInlineQuery');
173
+ return this.telegram.answerInlineQuery(this.inlineQuery.id, ...args);
174
+ }
175
+ answerCbQuery(...args) {
176
+ this.assert(this.callbackQuery, 'answerCbQuery');
177
+ return this.telegram.answerCbQuery(this.callbackQuery.id, ...args);
178
+ }
179
+ answerGameQuery(...args) {
180
+ this.assert(this.callbackQuery, 'answerGameQuery');
181
+ return this.telegram.answerGameQuery(this.callbackQuery.id, ...args);
182
+ }
183
+ getUserChatBoosts() {
184
+ this.assert(this.chat, 'getUserChatBoosts');
185
+ this.assert(this.from, 'getUserChatBoosts');
186
+ return this.telegram.getUserChatBoosts(this.chat.id, this.from.id);
187
+ }
188
+ answerShippingQuery(...args) {
189
+ this.assert(this.shippingQuery, 'answerShippingQuery');
190
+ return this.telegram.answerShippingQuery(this.shippingQuery.id, ...args);
191
+ }
192
+ answerPreCheckoutQuery(...args) {
193
+ this.assert(this.preCheckoutQuery, 'answerPreCheckoutQuery');
194
+ return this.telegram.answerPreCheckoutQuery(this.preCheckoutQuery.id, ...args);
195
+ }
196
+ editMessageText(text, extra) {
197
+ var _a, _b;
198
+ this.assert((_a = this.msgId) !== null && _a !== void 0 ? _a : this.inlineMessageId, 'editMessageText');
199
+ return this.telegram.editMessageText((_b = this.chat) === null || _b === void 0 ? void 0 : _b.id, this.msgId, this.inlineMessageId, text, extra);
200
+ }
201
+ editMessageCaption(caption, extra) {
202
+ var _a, _b;
203
+ this.assert((_a = this.msgId) !== null && _a !== void 0 ? _a : this.inlineMessageId, 'editMessageCaption');
204
+ return this.telegram.editMessageCaption((_b = this.chat) === null || _b === void 0 ? void 0 : _b.id, this.msgId, this.inlineMessageId, caption, extra);
205
+ }
206
+ editMessageMedia(media, extra) {
207
+ var _a, _b;
208
+ this.assert((_a = this.msgId) !== null && _a !== void 0 ? _a : this.inlineMessageId, 'editMessageMedia');
209
+ return this.telegram.editMessageMedia((_b = this.chat) === null || _b === void 0 ? void 0 : _b.id, this.msgId, this.inlineMessageId, media, extra);
210
+ }
211
+ editMessageReplyMarkup(markup) {
212
+ var _a, _b;
213
+ this.assert((_a = this.msgId) !== null && _a !== void 0 ? _a : this.inlineMessageId, 'editMessageReplyMarkup');
214
+ return this.telegram.editMessageReplyMarkup((_b = this.chat) === null || _b === void 0 ? void 0 : _b.id, this.msgId, this.inlineMessageId, markup);
215
+ }
216
+ editMessageLiveLocation(latitude, longitude, extra) {
217
+ var _a, _b;
218
+ this.assert((_a = this.msgId) !== null && _a !== void 0 ? _a : this.inlineMessageId, 'editMessageLiveLocation');
219
+ return this.telegram.editMessageLiveLocation((_b = this.chat) === null || _b === void 0 ? void 0 : _b.id, this.msgId, this.inlineMessageId, latitude, longitude, extra);
220
+ }
221
+ stopMessageLiveLocation(markup) {
222
+ var _a, _b;
223
+ this.assert((_a = this.msgId) !== null && _a !== void 0 ? _a : this.inlineMessageId, 'stopMessageLiveLocation');
224
+ return this.telegram.stopMessageLiveLocation((_b = this.chat) === null || _b === void 0 ? void 0 : _b.id, this.msgId, this.inlineMessageId, markup);
225
+ }
226
+ sendMessage(text, extra) {
227
+ this.assert(this.chat, 'sendMessage');
228
+ return this.telegram.sendMessage(this.chat.id, text, {
229
+ message_thread_id: getThreadId(this),
230
+ ...extra,
231
+ });
232
+ }
233
+ reply(...args) {
234
+ return this.sendMessage(...args);
235
+ }
236
+ getChat(...args) {
237
+ this.assert(this.chat, 'getChat');
238
+ return this.telegram.getChat(this.chat.id, ...args);
239
+ }
240
+ exportChatInviteLink(...args) {
241
+ this.assert(this.chat, 'exportChatInviteLink');
242
+ return this.telegram.exportChatInviteLink(this.chat.id, ...args);
243
+ }
244
+ createChatInviteLink(...args) {
245
+ this.assert(this.chat, 'createChatInviteLink');
246
+ return this.telegram.createChatInviteLink(this.chat.id, ...args);
247
+ }
248
+ editChatInviteLink(...args) {
249
+ this.assert(this.chat, 'editChatInviteLink');
250
+ return this.telegram.editChatInviteLink(this.chat.id, ...args);
251
+ }
252
+ revokeChatInviteLink(...args) {
253
+ this.assert(this.chat, 'revokeChatInviteLink');
254
+ return this.telegram.revokeChatInviteLink(this.chat.id, ...args);
255
+ }
256
+ banChatMember(...args) {
257
+ this.assert(this.chat, 'banChatMember');
258
+ return this.telegram.banChatMember(this.chat.id, ...args);
259
+ }
260
+ get kickChatMember() {
261
+ return this.banChatMember;
262
+ }
263
+ unbanChatMember(...args) {
264
+ this.assert(this.chat, 'unbanChatMember');
265
+ return this.telegram.unbanChatMember(this.chat.id, ...args);
266
+ }
267
+ restrictChatMember(...args) {
268
+ this.assert(this.chat, 'restrictChatMember');
269
+ return this.telegram.restrictChatMember(this.chat.id, ...args);
270
+ }
271
+ promoteChatMember(...args) {
272
+ this.assert(this.chat, 'promoteChatMember');
273
+ return this.telegram.promoteChatMember(this.chat.id, ...args);
274
+ }
275
+ setChatAdministratorCustomTitle(...args) {
276
+ this.assert(this.chat, 'setChatAdministratorCustomTitle');
277
+ return this.telegram.setChatAdministratorCustomTitle(this.chat.id, ...args);
278
+ }
279
+ setChatPhoto(...args) {
280
+ this.assert(this.chat, 'setChatPhoto');
281
+ return this.telegram.setChatPhoto(this.chat.id, ...args);
282
+ }
283
+ deleteChatPhoto(...args) {
284
+ this.assert(this.chat, 'deleteChatPhoto');
285
+ return this.telegram.deleteChatPhoto(this.chat.id, ...args);
286
+ }
287
+ setChatTitle(...args) {
288
+ this.assert(this.chat, 'setChatTitle');
289
+ return this.telegram.setChatTitle(this.chat.id, ...args);
290
+ }
291
+ setChatDescription(...args) {
292
+ this.assert(this.chat, 'setChatDescription');
293
+ return this.telegram.setChatDescription(this.chat.id, ...args);
294
+ }
295
+ pinChatMessage(...args) {
296
+ this.assert(this.chat, 'pinChatMessage');
297
+ return this.telegram.pinChatMessage(this.chat.id, ...args);
298
+ }
299
+ unpinChatMessage(...args) {
300
+ this.assert(this.chat, 'unpinChatMessage');
301
+ return this.telegram.unpinChatMessage(this.chat.id, ...args);
302
+ }
303
+ unpinAllChatMessages(...args) {
304
+ this.assert(this.chat, 'unpinAllChatMessages');
305
+ return this.telegram.unpinAllChatMessages(this.chat.id, ...args);
306
+ }
307
+ leaveChat(...args) {
308
+ this.assert(this.chat, 'leaveChat');
309
+ return this.telegram.leaveChat(this.chat.id, ...args);
310
+ }
311
+ setChatPermissions(...args) {
312
+ this.assert(this.chat, 'setChatPermissions');
313
+ return this.telegram.setChatPermissions(this.chat.id, ...args);
314
+ }
315
+ getChatAdministrators(extra) {
316
+ this.assert(this.chat, 'getChatAdministrators');
317
+ return this.telegram.getChatAdministrators(this.chat.id, extra);
318
+ }
319
+ getChatMember(...args) {
320
+ this.assert(this.chat, 'getChatMember');
321
+ return this.telegram.getChatMember(this.chat.id, ...args);
322
+ }
323
+ getChatMembersCount(...args) {
324
+ this.assert(this.chat, 'getChatMembersCount');
325
+ return this.telegram.getChatMembersCount(this.chat.id, ...args);
326
+ }
327
+ setPassportDataErrors(errors) {
328
+ this.assert(this.from, 'setPassportDataErrors');
329
+ return this.telegram.setPassportDataErrors(this.from.id, errors);
330
+ }
331
+ sendPhoto(photo, extra) {
332
+ this.assert(this.chat, 'sendPhoto');
333
+ return this.telegram.sendPhoto(this.chat.id, photo, {
334
+ message_thread_id: getThreadId(this),
335
+ ...extra,
336
+ });
337
+ }
338
+ replyWithPhoto(...args) {
339
+ return this.sendPhoto(...args);
340
+ }
341
+ sendMediaGroup(media, extra) {
342
+ this.assert(this.chat, 'sendMediaGroup');
343
+ return this.telegram.sendMediaGroup(this.chat.id, media, {
344
+ message_thread_id: getThreadId(this),
345
+ ...extra,
346
+ });
347
+ }
348
+ replyWithMediaGroup(...args) {
349
+ return this.sendMediaGroup(...args);
350
+ }
351
+ sendAudio(audio, extra) {
352
+ this.assert(this.chat, 'sendAudio');
353
+ return this.telegram.sendAudio(this.chat.id, audio, {
354
+ message_thread_id: getThreadId(this),
355
+ ...extra,
356
+ });
357
+ }
358
+ replyWithAudio(...args) {
359
+ return this.sendAudio(...args);
360
+ }
361
+ sendDice(extra) {
362
+ this.assert(this.chat, 'sendDice');
363
+ return this.telegram.sendDice(this.chat.id, {
364
+ message_thread_id: getThreadId(this),
365
+ ...extra,
366
+ });
367
+ }
368
+ replyWithDice(...args) {
369
+ return this.sendDice(...args);
370
+ }
371
+ sendDocument(document, extra) {
372
+ this.assert(this.chat, 'sendDocument');
373
+ return this.telegram.sendDocument(this.chat.id, document, {
374
+ message_thread_id: getThreadId(this),
375
+ ...extra,
376
+ });
377
+ }
378
+ replyWithDocument(...args) {
379
+ return this.sendDocument(...args);
380
+ }
381
+ sendSticker(sticker, extra) {
382
+ this.assert(this.chat, 'sendSticker');
383
+ return this.telegram.sendSticker(this.chat.id, sticker, {
384
+ message_thread_id: getThreadId(this),
385
+ ...extra,
386
+ });
387
+ }
388
+ replyWithSticker(...args) {
389
+ return this.sendSticker(...args);
390
+ }
391
+ sendVideo(video, extra) {
392
+ this.assert(this.chat, 'sendVideo');
393
+ return this.telegram.sendVideo(this.chat.id, video, {
394
+ message_thread_id: getThreadId(this),
395
+ ...extra,
396
+ });
397
+ }
398
+ replyWithVideo(...args) {
399
+ return this.sendVideo(...args);
400
+ }
401
+ sendAnimation(animation, extra) {
402
+ this.assert(this.chat, 'sendAnimation');
403
+ return this.telegram.sendAnimation(this.chat.id, animation, {
404
+ message_thread_id: getThreadId(this),
405
+ ...extra,
406
+ });
407
+ }
408
+ replyWithAnimation(...args) {
409
+ return this.sendAnimation(...args);
410
+ }
411
+ sendVideoNote(videoNote, extra) {
412
+ this.assert(this.chat, 'sendVideoNote');
413
+ return this.telegram.sendVideoNote(this.chat.id, videoNote, {
414
+ message_thread_id: getThreadId(this),
415
+ ...extra,
416
+ });
417
+ }
418
+ replyWithVideoNote(...args) {
419
+ return this.sendVideoNote(...args);
420
+ }
421
+ sendInvoice(invoice, extra) {
422
+ this.assert(this.chat, 'sendInvoice');
423
+ return this.telegram.sendInvoice(this.chat.id, invoice, {
424
+ message_thread_id: getThreadId(this),
425
+ ...extra,
426
+ });
427
+ }
428
+ replyWithInvoice(...args) {
429
+ return this.sendInvoice(...args);
430
+ }
431
+ sendGame(game, extra) {
432
+ this.assert(this.chat, 'sendGame');
433
+ return this.telegram.sendGame(this.chat.id, game, {
434
+ message_thread_id: getThreadId(this),
435
+ ...extra,
436
+ });
437
+ }
438
+ replyWithGame(...args) {
439
+ return this.sendGame(...args);
440
+ }
441
+ sendVoice(voice, extra) {
442
+ this.assert(this.chat, 'sendVoice');
443
+ return this.telegram.sendVoice(this.chat.id, voice, {
444
+ message_thread_id: getThreadId(this),
445
+ ...extra,
446
+ });
447
+ }
448
+ replyWithVoice(...args) {
449
+ return this.sendVoice(...args);
450
+ }
451
+ sendPoll(poll, options, extra) {
452
+ this.assert(this.chat, 'sendPoll');
453
+ return this.telegram.sendPoll(this.chat.id, poll, options, {
454
+ message_thread_id: getThreadId(this),
455
+ ...extra,
456
+ });
457
+ }
458
+ replyWithPoll(...args) {
459
+ return this.sendPoll(...args);
460
+ }
461
+ sendQuiz(quiz, options, extra) {
462
+ this.assert(this.chat, 'sendQuiz');
463
+ return this.telegram.sendQuiz(this.chat.id, quiz, options, {
464
+ message_thread_id: getThreadId(this),
465
+ ...extra,
466
+ });
467
+ }
468
+ replyWithQuiz(...args) {
469
+ return this.sendQuiz(...args);
470
+ }
471
+ stopPoll(...args) {
472
+ this.assert(this.chat, 'stopPoll');
473
+ return this.telegram.stopPoll(this.chat.id, ...args);
474
+ }
475
+ sendChatAction(action, extra) {
476
+ this.assert(this.chat, 'sendChatAction');
477
+ return this.telegram.sendChatAction(this.chat.id, action, {
478
+ message_thread_id: getThreadId(this),
479
+ ...extra,
480
+ });
481
+ }
482
+ async persistentChatAction(action, callback, { intervalDuration, ...extra } = {}) {
483
+ await this.sendChatAction(action, { ...extra });
484
+ const timer = setInterval(() => this.sendChatAction(action, { ...extra }).catch((err) => {
485
+ debug('Ignored error while persisting sendChatAction:', err);
486
+ }), intervalDuration !== null && intervalDuration !== void 0 ? intervalDuration : 4000);
487
+ try {
488
+ await callback();
489
+ }
490
+ finally {
491
+ clearInterval(timer);
492
+ }
493
+ }
494
+ replyWithChatAction(...args) {
495
+ return this.sendChatAction(...args);
496
+ }
497
+ react(reaction, is_big) {
498
+ this.assert(this.chat, 'setMessageReaction');
499
+ this.assert(this.msgId, 'setMessageReaction');
500
+ const emojis = reaction
501
+ ? Array.isArray(reaction)
502
+ ? reaction
503
+ : [reaction]
504
+ : undefined;
505
+ const reactions = emojis === null || emojis === void 0 ? void 0 : emojis.map((emoji) => typeof emoji === 'string'
506
+ ? reactions_1.Digit.has(emoji[0])
507
+ ? { type: 'custom_emoji', custom_emoji_id: emoji }
508
+ : { type: 'emoji', emoji: emoji }
509
+ : emoji);
510
+ return this.telegram.setMessageReaction(this.chat.id, this.msgId, reactions, is_big);
511
+ }
512
+ sendLocation(latitude, longitude, extra) {
513
+ this.assert(this.chat, 'sendLocation');
514
+ return this.telegram.sendLocation(this.chat.id, latitude, longitude, {
515
+ message_thread_id: getThreadId(this),
516
+ ...extra,
517
+ });
518
+ }
519
+ replyWithLocation(...args) {
520
+ return this.sendLocation(...args);
521
+ }
522
+ sendVenue(latitude, longitude, title, address, extra) {
523
+ this.assert(this.chat, 'sendVenue');
524
+ return this.telegram.sendVenue(this.chat.id, latitude, longitude, title, address, { message_thread_id: getThreadId(this), ...extra });
525
+ }
526
+ replyWithVenue(...args) {
527
+ return this.sendVenue(...args);
528
+ }
529
+ sendContact(phoneNumber, firstName, extra) {
530
+ this.assert(this.chat, 'sendContact');
531
+ return this.telegram.sendContact(this.chat.id, phoneNumber, firstName, {
532
+ message_thread_id: getThreadId(this),
533
+ ...extra,
534
+ });
535
+ }
536
+ replyWithContact(...args) {
537
+ return this.sendContact(...args);
538
+ }
539
+ getStickerSet(setName) {
540
+ return this.telegram.getStickerSet(setName);
541
+ }
542
+ setChatStickerSet(setName) {
543
+ this.assert(this.chat, 'setChatStickerSet');
544
+ return this.telegram.setChatStickerSet(this.chat.id, setName);
545
+ }
546
+ deleteChatStickerSet() {
547
+ this.assert(this.chat, 'deleteChatStickerSet');
548
+ return this.telegram.deleteChatStickerSet(this.chat.id);
549
+ }
550
+ createForumTopic(...args) {
551
+ this.assert(this.chat, 'createForumTopic');
552
+ return this.telegram.createForumTopic(this.chat.id, ...args);
553
+ }
554
+ editForumTopic(extra) {
555
+ var _a;
556
+ this.assert(this.chat, 'editForumTopic');
557
+ this.assert((_a = this.message) === null || _a === void 0 ? void 0 : _a.message_thread_id, 'editForumTopic');
558
+ return this.telegram.editForumTopic(this.chat.id, this.message.message_thread_id, extra);
559
+ }
560
+ closeForumTopic() {
561
+ var _a;
562
+ this.assert(this.chat, 'closeForumTopic');
563
+ this.assert((_a = this.message) === null || _a === void 0 ? void 0 : _a.message_thread_id, 'closeForumTopic');
564
+ return this.telegram.closeForumTopic(this.chat.id, this.message.message_thread_id);
565
+ }
566
+ reopenForumTopic() {
567
+ var _a;
568
+ this.assert(this.chat, 'reopenForumTopic');
569
+ this.assert((_a = this.message) === null || _a === void 0 ? void 0 : _a.message_thread_id, 'reopenForumTopic');
570
+ return this.telegram.reopenForumTopic(this.chat.id, this.message.message_thread_id);
571
+ }
572
+ deleteForumTopic() {
573
+ var _a;
574
+ this.assert(this.chat, 'deleteForumTopic');
575
+ this.assert((_a = this.message) === null || _a === void 0 ? void 0 : _a.message_thread_id, 'deleteForumTopic');
576
+ return this.telegram.deleteForumTopic(this.chat.id, this.message.message_thread_id);
577
+ }
578
+ unpinAllForumTopicMessages() {
579
+ var _a;
580
+ this.assert(this.chat, 'unpinAllForumTopicMessages');
581
+ this.assert((_a = this.message) === null || _a === void 0 ? void 0 : _a.message_thread_id, 'unpinAllForumTopicMessages');
582
+ return this.telegram.unpinAllForumTopicMessages(this.chat.id, this.message.message_thread_id);
583
+ }
584
+ editGeneralForumTopic(name) {
585
+ this.assert(this.chat, 'editGeneralForumTopic');
586
+ return this.telegram.editGeneralForumTopic(this.chat.id, name);
587
+ }
588
+ closeGeneralForumTopic() {
589
+ this.assert(this.chat, 'closeGeneralForumTopic');
590
+ return this.telegram.closeGeneralForumTopic(this.chat.id);
591
+ }
592
+ reopenGeneralForumTopic() {
593
+ this.assert(this.chat, 'reopenGeneralForumTopic');
594
+ return this.telegram.reopenGeneralForumTopic(this.chat.id);
595
+ }
596
+ hideGeneralForumTopic() {
597
+ this.assert(this.chat, 'hideGeneralForumTopic');
598
+ return this.telegram.hideGeneralForumTopic(this.chat.id);
599
+ }
600
+ unhideGeneralForumTopic() {
601
+ this.assert(this.chat, 'unhideGeneralForumTopic');
602
+ return this.telegram.unhideGeneralForumTopic(this.chat.id);
603
+ }
604
+ unpinAllGeneralForumTopicMessages() {
605
+ this.assert(this.chat, 'unpinAllGeneralForumTopicMessages');
606
+ return this.telegram.unpinAllGeneralForumTopicMessages(this.chat.id);
607
+ }
608
+ setStickerPositionInSet(sticker, position) {
609
+ return this.telegram.setStickerPositionInSet(sticker, position);
610
+ }
611
+ setStickerSetThumb(...args) {
612
+ return this.telegram.setStickerSetThumbnail(...args);
613
+ }
614
+ setStickerSetThumbnail(...args) {
615
+ return this.telegram.setStickerSetThumbnail(...args);
616
+ }
617
+ setStickerMaskPosition(...args) {
618
+ return this.telegram.setStickerMaskPosition(...args);
619
+ }
620
+ setStickerKeywords(...args) {
621
+ return this.telegram.setStickerKeywords(...args);
622
+ }
623
+ setStickerEmojiList(...args) {
624
+ return this.telegram.setStickerEmojiList(...args);
625
+ }
626
+ deleteStickerSet(...args) {
627
+ return this.telegram.deleteStickerSet(...args);
628
+ }
629
+ setStickerSetTitle(...args) {
630
+ return this.telegram.setStickerSetTitle(...args);
631
+ }
632
+ setCustomEmojiStickerSetThumbnail(...args) {
633
+ return this.telegram.setCustomEmojiStickerSetThumbnail(...args);
634
+ }
635
+ deleteStickerFromSet(sticker) {
636
+ return this.telegram.deleteStickerFromSet(sticker);
637
+ }
638
+ uploadStickerFile(...args) {
639
+ this.assert(this.from, 'uploadStickerFile');
640
+ return this.telegram.uploadStickerFile(this.from.id, ...args);
641
+ }
642
+ createNewStickerSet(...args) {
643
+ this.assert(this.from, 'createNewStickerSet');
644
+ return this.telegram.createNewStickerSet(this.from.id, ...args);
645
+ }
646
+ addStickerToSet(...args) {
647
+ this.assert(this.from, 'addStickerToSet');
648
+ return this.telegram.addStickerToSet(this.from.id, ...args);
649
+ }
650
+ getMyCommands() {
651
+ return this.telegram.getMyCommands();
652
+ }
653
+ setMyCommands(commands) {
654
+ return this.telegram.setMyCommands(commands);
655
+ }
656
+ replyWithMarkdown(markdown, extra) {
657
+ return this.reply(markdown, { parse_mode: 'Markdown', ...extra });
658
+ }
659
+ replyWithMarkdownV2(markdown, extra) {
660
+ return this.reply(markdown, { parse_mode: 'MarkdownV2', ...extra });
661
+ }
662
+ replyWithHTML(html, extra) {
663
+ return this.reply(html, { parse_mode: 'HTML', ...extra });
664
+ }
665
+ deleteMessage(messageId) {
666
+ this.assert(this.chat, 'deleteMessage');
667
+ if (typeof messageId !== 'undefined')
668
+ return this.telegram.deleteMessage(this.chat.id, messageId);
669
+ this.assert(this.msgId, 'deleteMessage');
670
+ return this.telegram.deleteMessage(this.chat.id, this.msgId);
671
+ }
672
+ deleteMessages(messageIds) {
673
+ this.assert(this.chat, 'deleteMessages');
674
+ return this.telegram.deleteMessages(this.chat.id, messageIds);
675
+ }
676
+ forwardMessage(chatId, extra) {
677
+ this.assert(this.chat, 'forwardMessage');
678
+ this.assert(this.msgId, 'forwardMessage');
679
+ return this.telegram.forwardMessage(chatId, this.chat.id, this.msgId, extra);
680
+ }
681
+ forwardMessages(chatId, messageIds, extra) {
682
+ this.assert(this.chat, 'forwardMessages');
683
+ return this.telegram.forwardMessages(chatId, this.chat.id, messageIds, extra);
684
+ }
685
+ copyMessage(chatId, extra) {
686
+ this.assert(this.chat, 'copyMessage');
687
+ this.assert(this.msgId, 'copyMessage');
688
+ return this.telegram.copyMessage(chatId, this.chat.id, this.msgId, extra);
689
+ }
690
+ copyMessages(chatId, messageIds, extra) {
691
+ var _a;
692
+ this.assert(this.chat, 'copyMessages');
693
+ return this.telegram.copyMessages(chatId, (_a = this.chat) === null || _a === void 0 ? void 0 : _a.id, messageIds, extra);
694
+ }
695
+ approveChatJoinRequest(userId) {
696
+ this.assert(this.chat, 'approveChatJoinRequest');
697
+ return this.telegram.approveChatJoinRequest(this.chat.id, userId);
698
+ }
699
+ declineChatJoinRequest(userId) {
700
+ this.assert(this.chat, 'declineChatJoinRequest');
701
+ return this.telegram.declineChatJoinRequest(this.chat.id, userId);
702
+ }
703
+ banChatSenderChat(senderChatId) {
704
+ this.assert(this.chat, 'banChatSenderChat');
705
+ return this.telegram.banChatSenderChat(this.chat.id, senderChatId);
706
+ }
707
+ unbanChatSenderChat(senderChatId) {
708
+ this.assert(this.chat, 'unbanChatSenderChat');
709
+ return this.telegram.unbanChatSenderChat(this.chat.id, senderChatId);
710
+ }
711
+ setChatMenuButton(menuButton) {
712
+ this.assert(this.chat, 'setChatMenuButton');
713
+ return this.telegram.setChatMenuButton({ chatId: this.chat.id, menuButton });
714
+ }
715
+ getChatMenuButton() {
716
+ this.assert(this.chat, 'getChatMenuButton');
717
+ return this.telegram.getChatMenuButton({ chatId: this.chat.id });
718
+ }
719
+ setMyDefaultAdministratorRights(extra) {
720
+ return this.telegram.setMyDefaultAdministratorRights(extra);
721
+ }
722
+ getMyDefaultAdministratorRights(extra) {
723
+ return this.telegram.getMyDefaultAdministratorRights(extra);
724
+ }
725
+ sendGift(giftId, extra) {
726
+ this.assert(this.from, 'sendGift');
727
+ return this.telegram.sendGift({ userId: this.from.id, giftId, ...extra });
728
+ }
729
+ giftPremiumSubscription(monthCount, starCount, extra) {
730
+ this.assert(this.from, 'giftPremiumSubscription');
731
+ return this.telegram.giftPremiumSubscription(this.from.id, monthCount, starCount, extra);
732
+ }
733
+ getBusinessConnection() {
734
+ this.assert(this.update.business_connection, 'getBusinessConnection');
735
+ return this.telegram.getBusinessConnection(this.update.business_connection.id);
736
+ }
737
+ sendMessageDraft(textOrExtra, extra) {
738
+ this.assert(this.chat, 'sendMessageDraft');
739
+ return this.telegram.sendMessageDraft(this.chat.id, textOrExtra, extra);
740
+ }
741
+ setMyProfilePhoto(photo, extra) {
742
+ return this.telegram.setMyProfilePhoto(photo, extra);
743
+ }
744
+ removeMyProfilePhoto(extra) {
745
+ return this.telegram.removeMyProfilePhoto(extra);
746
+ }
747
+ setChatMemberTag(userId, tag) {
748
+ this.assert(this.chat, 'setChatMemberTag');
749
+ return this.telegram.setChatMemberTag(this.chat.id, userId, tag);
750
+ }
751
+ answerGuestQuery(result, extra) {
752
+ this.assert(this.guestMessage, 'answerGuestQuery');
753
+ return this.telegram.answerGuestQuery(this.guestMessage.guest_query_id, result, extra);
754
+ }
755
+ deleteMessageReaction(reaction) {
756
+ this.assert(this.chat, 'deleteMessageReaction');
757
+ this.assert(this.msgId, 'deleteMessageReaction');
758
+ return this.telegram.deleteMessageReaction(this.chat.id, this.msgId, reaction);
759
+ }
760
+ deleteAllMessageReactions() {
761
+ this.assert(this.chat, 'deleteAllMessageReactions');
762
+ this.assert(this.msgId, 'deleteAllMessageReactions');
763
+ return this.telegram.deleteAllMessageReactions(this.chat.id, this.msgId);
764
+ }
765
+ sendLivePhoto(photo, extra) {
766
+ this.assert(this.chat, 'sendLivePhoto');
767
+ return this.telegram.sendLivePhoto(this.chat.id, photo, {
768
+ message_thread_id: getThreadId(this),
769
+ ...extra,
770
+ });
771
+ }
772
+ answerChatJoinRequestQuery(extra) {
773
+ this.assert(this.chatJoinRequest, 'answerChatJoinRequestQuery');
774
+ return this.telegram.answerChatJoinRequestQuery(this.chatJoinRequest.query_id, extra);
775
+ }
776
+ sendChatJoinRequestWebApp(webAppUrl, extra) {
777
+ this.assert(this.chatJoinRequest, 'sendChatJoinRequestWebApp');
778
+ return this.telegram.sendChatJoinRequestWebApp(this.chatJoinRequest.query_id, webAppUrl, extra);
779
+ }
780
+ sendRichMessage(richMessage, extra) {
781
+ this.assert(this.chat, 'sendRichMessage');
782
+ return this.telegram.sendRichMessage(this.chat.id, richMessage, {
783
+ message_thread_id: getThreadId(this),
784
+ ...extra,
785
+ });
786
+ }
787
+ sendRichMessageDraft(richMessage, extra) {
788
+ this.assert(this.chat, 'sendRichMessageDraft');
789
+ return this.telegram.sendRichMessageDraft(this.chat.id, richMessage, {
790
+ message_thread_id: getThreadId(this),
791
+ ...extra,
792
+ });
793
+ }
794
+ getManagedBotAccessSettings(botUserId) {
795
+ return this.telegram.getManagedBotAccessSettings(botUserId);
796
+ }
797
+ getUserPersonalChatMessages(userId, extra) {
798
+ return this.telegram.getUserPersonalChatMessages(userId, extra);
799
+ }
800
+ }
801
+ exports.Context = Context;
802
+ exports.default = Context;
803
+ const Msg = {
804
+ isAccessible() {
805
+ return 'date' in this && this.date !== 0;
806
+ },
807
+ has(...keys) {
808
+ return keys.some((key) => this[key] != undefined);
809
+ },
810
+ };
811
+ function getMessageFromAnySource(ctx) {
812
+ var _a, _b, _c, _d, _e;
813
+ const msg = (_e = (_d = (_b = (_a = ctx.message) !== null && _a !== void 0 ? _a : ctx.editedMessage) !== null && _b !== void 0 ? _b : (_c = ctx.callbackQuery) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : ctx.channelPost) !== null && _e !== void 0 ? _e : ctx.editedChannelPost;
814
+ if (msg)
815
+ return Object.assign(Object.create(Msg), msg);
816
+ }
817
+ function getUserFromAnySource(ctx) {
818
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
819
+ if (ctx.callbackQuery)
820
+ return ctx.callbackQuery.from;
821
+ const msg = ctx.msg;
822
+ if (msg === null || msg === void 0 ? void 0 : msg.has('from'))
823
+ return msg.from;
824
+ return ((_h = (_g = ((_f = (_e = (_d = (_c = (_b = (_a = ctx.inlineQuery) !== null && _a !== void 0 ? _a : ctx.shippingQuery) !== null && _b !== void 0 ? _b : ctx.preCheckoutQuery) !== null && _c !== void 0 ? _c : ctx.chosenInlineResult) !== null && _d !== void 0 ? _d : ctx.chatMember) !== null && _e !== void 0 ? _e : ctx.myChatMember) !== null && _f !== void 0 ? _f : ctx.chatJoinRequest)) === null || _g === void 0 ? void 0 : _g.from) !== null && _h !== void 0 ? _h : (_m = ((_k = (_j = ctx.messageReaction) !== null && _j !== void 0 ? _j : ctx.pollAnswer) !== null && _k !== void 0 ? _k : (_l = ctx.chatBoost) === null || _l === void 0 ? void 0 : _l.boost.source)) === null || _m === void 0 ? void 0 : _m.user);
825
+ }
826
+ function getMsgIdFromAnySource(ctx) {
827
+ var _a, _b;
828
+ const msg = getMessageFromAnySource(ctx);
829
+ return (_b = ((_a = msg !== null && msg !== void 0 ? msg : ctx.messageReaction) !== null && _a !== void 0 ? _a : ctx.messageReactionCount)) === null || _b === void 0 ? void 0 : _b.message_id;
830
+ }
831
+ function getTextAndEntitiesFromAnySource(ctx) {
832
+ const msg = ctx.msg;
833
+ let text, entities;
834
+ if (msg) {
835
+ if ('text' in msg)
836
+ (text = msg.text), (entities = msg.entities);
837
+ else if ('caption' in msg)
838
+ (text = msg.caption), (entities = msg.caption_entities);
839
+ else if ('game' in msg)
840
+ (text = msg.game.text), (entities = msg.game.text_entities);
841
+ }
842
+ else if (ctx.poll)
843
+ (text = ctx.poll.explanation), (entities = ctx.poll.explanation_entities);
844
+ return [text, entities];
845
+ }
846
+ const getThreadId = (ctx) => {
847
+ const msg = ctx.msg;
848
+ return (msg === null || msg === void 0 ? void 0 : msg.isAccessible())
849
+ ? msg.is_topic_message
850
+ ? msg.message_thread_id
851
+ : undefined
852
+ : undefined;
853
+ };