@mtcute/core 0.30.3 → 0.32.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 (313) hide show
  1. package/client.cjs +85 -0
  2. package/client.js +85 -0
  3. package/highlevel/client.d.cts +411 -116
  4. package/highlevel/client.d.ts +411 -116
  5. package/highlevel/methods/auth/sign-in-qr.cjs +2 -0
  6. package/highlevel/methods/auth/sign-in-qr.js +2 -0
  7. package/highlevel/methods/auth/sign-in-qr.test.d.cts +1 -0
  8. package/highlevel/methods/auth/sign-in-qr.test.d.ts +1 -0
  9. package/highlevel/methods/chats/build-peers-index.cjs +45 -0
  10. package/highlevel/methods/chats/build-peers-index.d.cts +13 -0
  11. package/highlevel/methods/chats/build-peers-index.d.ts +13 -0
  12. package/highlevel/methods/chats/build-peers-index.js +40 -0
  13. package/highlevel/methods/chats/join-chat.cjs +1 -1
  14. package/highlevel/methods/chats/join-chat.d.cts +2 -1
  15. package/highlevel/methods/chats/join-chat.d.ts +2 -1
  16. package/highlevel/methods/chats/join-chat.js +1 -1
  17. package/highlevel/methods/chats/transfer-chat-ownership.cjs +6 -17
  18. package/highlevel/methods/chats/transfer-chat-ownership.js +6 -17
  19. package/highlevel/methods/communities/ban-community-participant.cjs +30 -0
  20. package/highlevel/methods/communities/ban-community-participant.d.cts +20 -0
  21. package/highlevel/methods/communities/ban-community-participant.d.ts +20 -0
  22. package/highlevel/methods/communities/ban-community-participant.js +25 -0
  23. package/highlevel/methods/communities/create-community.cjs +29 -0
  24. package/highlevel/methods/communities/create-community.d.cts +22 -0
  25. package/highlevel/methods/communities/create-community.d.ts +22 -0
  26. package/highlevel/methods/communities/create-community.js +24 -0
  27. package/highlevel/methods/communities/get-community-link-requests.cjs +27 -0
  28. package/highlevel/methods/communities/get-community-link-requests.d.cts +17 -0
  29. package/highlevel/methods/communities/get-community-link-requests.d.ts +17 -0
  30. package/highlevel/methods/communities/get-community-link-requests.js +22 -0
  31. package/highlevel/methods/communities/get-community-participant-chats.cjs +24 -0
  32. package/highlevel/methods/communities/get-community-participant-chats.d.cts +17 -0
  33. package/highlevel/methods/communities/get-community-participant-chats.d.ts +17 -0
  34. package/highlevel/methods/communities/get-community-participant-chats.js +19 -0
  35. package/highlevel/methods/communities/get-joined-communities.cjs +21 -0
  36. package/highlevel/methods/communities/get-joined-communities.d.cts +6 -0
  37. package/highlevel/methods/communities/get-joined-communities.d.ts +6 -0
  38. package/highlevel/methods/communities/get-joined-communities.js +16 -0
  39. package/highlevel/methods/communities/hide-community-link-request.cjs +30 -0
  40. package/highlevel/methods/communities/hide-community-link-request.d.cts +22 -0
  41. package/highlevel/methods/communities/hide-community-link-request.d.ts +22 -0
  42. package/highlevel/methods/communities/hide-community-link-request.js +25 -0
  43. package/highlevel/methods/communities/link-community-peer.cjs +32 -0
  44. package/highlevel/methods/communities/link-community-peer.d.cts +22 -0
  45. package/highlevel/methods/communities/link-community-peer.d.ts +22 -0
  46. package/highlevel/methods/communities/link-community-peer.js +27 -0
  47. package/highlevel/methods/communities/toggle-community-collapsed.cjs +18 -0
  48. package/highlevel/methods/communities/toggle-community-collapsed.d.cts +16 -0
  49. package/highlevel/methods/communities/toggle-community-collapsed.d.ts +16 -0
  50. package/highlevel/methods/communities/toggle-community-collapsed.js +13 -0
  51. package/highlevel/methods/ephemeral/delete-all-welcome-messages.cjs +17 -0
  52. package/highlevel/methods/ephemeral/delete-all-welcome-messages.d.cts +8 -0
  53. package/highlevel/methods/ephemeral/delete-all-welcome-messages.d.ts +8 -0
  54. package/highlevel/methods/ephemeral/delete-all-welcome-messages.js +12 -0
  55. package/highlevel/methods/ephemeral/delete-ephemeral-message.cjs +20 -0
  56. package/highlevel/methods/ephemeral/delete-ephemeral-message.d.cts +13 -0
  57. package/highlevel/methods/ephemeral/delete-ephemeral-message.d.ts +13 -0
  58. package/highlevel/methods/ephemeral/delete-ephemeral-message.js +15 -0
  59. package/highlevel/methods/ephemeral/delete-welcome-message.cjs +18 -0
  60. package/highlevel/methods/ephemeral/delete-welcome-message.d.cts +9 -0
  61. package/highlevel/methods/ephemeral/delete-welcome-message.d.ts +9 -0
  62. package/highlevel/methods/ephemeral/delete-welcome-message.js +13 -0
  63. package/highlevel/methods/ephemeral/edit-ephemeral-message.cjs +41 -0
  64. package/highlevel/methods/ephemeral/edit-ephemeral-message.d.cts +39 -0
  65. package/highlevel/methods/ephemeral/edit-ephemeral-message.d.ts +39 -0
  66. package/highlevel/methods/ephemeral/edit-ephemeral-message.js +36 -0
  67. package/highlevel/methods/ephemeral/find-in-update.cjs +27 -0
  68. package/highlevel/methods/ephemeral/find-in-update.d.cts +8 -0
  69. package/highlevel/methods/ephemeral/find-in-update.d.ts +8 -0
  70. package/highlevel/methods/ephemeral/find-in-update.js +22 -0
  71. package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.cjs +31 -0
  72. package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.d.cts +29 -0
  73. package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.d.ts +29 -0
  74. package/highlevel/methods/ephemeral/get-ephemeral-callback-answer.js +26 -0
  75. package/highlevel/methods/ephemeral/get-welcome-messages.cjs +29 -0
  76. package/highlevel/methods/ephemeral/get-welcome-messages.d.cts +8 -0
  77. package/highlevel/methods/ephemeral/get-welcome-messages.d.ts +8 -0
  78. package/highlevel/methods/ephemeral/get-welcome-messages.js +24 -0
  79. package/highlevel/methods/ephemeral/send-ephemeral-message.cjs +48 -0
  80. package/highlevel/methods/ephemeral/send-ephemeral-message.d.cts +47 -0
  81. package/highlevel/methods/ephemeral/send-ephemeral-message.d.ts +47 -0
  82. package/highlevel/methods/ephemeral/send-ephemeral-message.js +43 -0
  83. package/highlevel/methods/files/download-iterable.cjs +7 -2
  84. package/highlevel/methods/files/download-iterable.js +7 -2
  85. package/highlevel/methods/files/download-iterable.test.d.cts +1 -0
  86. package/highlevel/methods/files/download-iterable.test.d.ts +1 -0
  87. package/highlevel/methods/files/download-stream.cjs +5 -6
  88. package/highlevel/methods/files/download-stream.js +5 -6
  89. package/highlevel/methods/files/normalize-input-media.cjs +25 -4
  90. package/highlevel/methods/files/normalize-input-media.js +25 -4
  91. package/highlevel/methods/forums/create-forum-topic.d.cts +7 -0
  92. package/highlevel/methods/forums/create-forum-topic.d.ts +7 -0
  93. package/highlevel/methods/forums/delete-forum-topic-history.d.cts +1 -1
  94. package/highlevel/methods/forums/delete-forum-topic-history.d.ts +1 -1
  95. package/highlevel/methods/forums/edit-forum-topic.cjs +2 -2
  96. package/highlevel/methods/forums/edit-forum-topic.d.cts +2 -2
  97. package/highlevel/methods/forums/edit-forum-topic.d.ts +2 -2
  98. package/highlevel/methods/forums/edit-forum-topic.js +2 -2
  99. package/highlevel/methods/forums/get-forum-topics-by-id.cjs +5 -1
  100. package/highlevel/methods/forums/get-forum-topics-by-id.d.cts +9 -1
  101. package/highlevel/methods/forums/get-forum-topics-by-id.d.ts +9 -1
  102. package/highlevel/methods/forums/get-forum-topics-by-id.js +5 -1
  103. package/highlevel/methods/forums/get-forum-topics-by-id.test.d.cts +1 -0
  104. package/highlevel/methods/forums/get-forum-topics-by-id.test.d.ts +1 -0
  105. package/highlevel/methods/forums/get-forum-topics.cjs +1 -1
  106. package/highlevel/methods/forums/get-forum-topics.js +1 -1
  107. package/highlevel/methods/forums/toggle-forum-topic-closed.cjs +1 -1
  108. package/highlevel/methods/forums/toggle-forum-topic-closed.d.cts +1 -1
  109. package/highlevel/methods/forums/toggle-forum-topic-closed.d.ts +1 -1
  110. package/highlevel/methods/forums/toggle-forum-topic-closed.js +1 -1
  111. package/highlevel/methods/forums/toggle-forum-topic-pinned.d.cts +1 -1
  112. package/highlevel/methods/forums/toggle-forum-topic-pinned.d.ts +1 -1
  113. package/highlevel/methods/forums/toggle-general-topic-hidden.cjs +3 -3
  114. package/highlevel/methods/forums/toggle-general-topic-hidden.js +4 -4
  115. package/highlevel/methods/gifts/buy-resale-gift.cjs +5 -2
  116. package/highlevel/methods/gifts/buy-resale-gift.d.cts +11 -1
  117. package/highlevel/methods/gifts/buy-resale-gift.d.ts +11 -1
  118. package/highlevel/methods/gifts/buy-resale-gift.js +5 -2
  119. package/highlevel/methods/messages/forward-messages.cjs +1 -0
  120. package/highlevel/methods/messages/forward-messages.d.cts +2 -0
  121. package/highlevel/methods/messages/forward-messages.d.ts +2 -0
  122. package/highlevel/methods/messages/forward-messages.js +1 -0
  123. package/highlevel/methods/messages/normalize-rich-message.cjs +3 -0
  124. package/highlevel/methods/messages/normalize-rich-message.js +3 -0
  125. package/highlevel/methods/messages/send-common.d.cts +7 -1
  126. package/highlevel/methods/messages/send-common.d.ts +7 -1
  127. package/highlevel/methods/messages/send-text.cjs +70 -35
  128. package/highlevel/methods/messages/send-text.js +70 -35
  129. package/highlevel/methods/messages/send-typing.d.cts +3 -3
  130. package/highlevel/methods/messages/send-typing.d.ts +3 -3
  131. package/highlevel/methods/messages/set-typing.cjs +1 -1
  132. package/highlevel/methods/messages/set-typing.d.cts +2 -2
  133. package/highlevel/methods/messages/set-typing.d.ts +2 -2
  134. package/highlevel/methods/messages/set-typing.js +1 -1
  135. package/highlevel/methods/users/resolve-peer.cjs +11 -1
  136. package/highlevel/methods/users/resolve-peer.js +11 -1
  137. package/highlevel/methods.d.cts +19 -0
  138. package/highlevel/methods.d.ts +19 -0
  139. package/highlevel/storage/service/peers.cjs +25 -0
  140. package/highlevel/storage/service/peers.js +25 -0
  141. package/highlevel/storage/service/peers.test.d.cts +1 -0
  142. package/highlevel/storage/service/peers.test.d.ts +1 -0
  143. package/highlevel/types/bots/keyboards/builder.cjs +5 -5
  144. package/highlevel/types/bots/keyboards/builder.d.cts +8 -9
  145. package/highlevel/types/bots/keyboards/builder.d.ts +8 -9
  146. package/highlevel/types/bots/keyboards/builder.js +5 -5
  147. package/highlevel/types/bots/keyboards/factories.cjs +51 -103
  148. package/highlevel/types/bots/keyboards/factories.d.cts +58 -89
  149. package/highlevel/types/bots/keyboards/factories.d.ts +58 -89
  150. package/highlevel/types/bots/keyboards/factories.js +51 -103
  151. package/highlevel/types/bots/keyboards/index.d.cts +3 -3
  152. package/highlevel/types/bots/keyboards/index.d.ts +3 -3
  153. package/highlevel/types/bots/keyboards/normalize.cjs +131 -0
  154. package/highlevel/types/bots/keyboards/normalize.d.cts +10 -0
  155. package/highlevel/types/bots/keyboards/normalize.d.ts +10 -0
  156. package/highlevel/types/bots/keyboards/normalize.js +126 -0
  157. package/highlevel/types/bots/keyboards/types.d.cts +160 -4
  158. package/highlevel/types/bots/keyboards/types.d.ts +160 -4
  159. package/highlevel/types/conversation.cjs +8 -0
  160. package/highlevel/types/conversation.d.cts +1 -0
  161. package/highlevel/types/conversation.d.ts +1 -0
  162. package/highlevel/types/conversation.js +10 -2
  163. package/highlevel/types/conversation.test.d.cts +1 -0
  164. package/highlevel/types/conversation.test.d.ts +1 -0
  165. package/highlevel/types/messages/dialog.cjs +8 -1
  166. package/highlevel/types/messages/dialog.d.cts +3 -0
  167. package/highlevel/types/messages/dialog.d.ts +3 -0
  168. package/highlevel/types/messages/dialog.js +8 -1
  169. package/highlevel/types/messages/dialog.test.d.cts +1 -0
  170. package/highlevel/types/messages/dialog.test.d.ts +1 -0
  171. package/highlevel/types/messages/ephemeral-message.cjs +135 -0
  172. package/highlevel/types/messages/ephemeral-message.d.cts +75 -0
  173. package/highlevel/types/messages/ephemeral-message.d.ts +75 -0
  174. package/highlevel/types/messages/ephemeral-message.js +130 -0
  175. package/highlevel/types/messages/index.d.cts +1 -0
  176. package/highlevel/types/messages/index.d.ts +1 -0
  177. package/highlevel/types/messages/message-action.cjs +14 -1
  178. package/highlevel/types/messages/message-action.d.cts +18 -1
  179. package/highlevel/types/messages/message-action.d.ts +18 -1
  180. package/highlevel/types/messages/message-action.js +14 -1
  181. package/highlevel/types/messages/message.cjs +7 -2
  182. package/highlevel/types/messages/message.d.cts +2 -2
  183. package/highlevel/types/messages/message.d.ts +2 -2
  184. package/highlevel/types/messages/message.js +8 -3
  185. package/highlevel/types/messages/replied-message.cjs +5 -1
  186. package/highlevel/types/messages/replied-message.d.cts +5 -1
  187. package/highlevel/types/messages/replied-message.d.ts +5 -1
  188. package/highlevel/types/messages/replied-message.js +5 -1
  189. package/highlevel/types/messages/rich/inner.cjs +37 -0
  190. package/highlevel/types/messages/rich/inner.d.cts +19 -0
  191. package/highlevel/types/messages/rich/inner.d.ts +19 -0
  192. package/highlevel/types/messages/rich/inner.js +37 -0
  193. package/highlevel/types/peers/chat.cjs +23 -3
  194. package/highlevel/types/peers/chat.d.cts +8 -3
  195. package/highlevel/types/peers/chat.d.ts +8 -3
  196. package/highlevel/types/peers/chat.js +24 -4
  197. package/highlevel/types/peers/community-peer.cjs +60 -0
  198. package/highlevel/types/peers/community-peer.d.cts +37 -0
  199. package/highlevel/types/peers/community-peer.d.ts +37 -0
  200. package/highlevel/types/peers/community-peer.js +55 -0
  201. package/highlevel/types/peers/full-chat.cjs +24 -5
  202. package/highlevel/types/peers/full-chat.d.cts +7 -0
  203. package/highlevel/types/peers/full-chat.d.ts +7 -0
  204. package/highlevel/types/peers/full-chat.js +24 -5
  205. package/highlevel/types/peers/index.d.cts +1 -0
  206. package/highlevel/types/peers/index.d.ts +1 -0
  207. package/highlevel/types/peers/peer.cjs +2 -0
  208. package/highlevel/types/peers/peer.js +2 -0
  209. package/highlevel/types/peers/typing-status.d.cts +4 -1
  210. package/highlevel/types/peers/typing-status.d.ts +4 -1
  211. package/highlevel/types/peers/user.cjs +6 -0
  212. package/highlevel/types/peers/user.d.cts +2 -0
  213. package/highlevel/types/peers/user.d.ts +2 -0
  214. package/highlevel/types/peers/user.js +6 -0
  215. package/highlevel/types/updates/delete-ephemeral-messages-update.cjs +27 -0
  216. package/highlevel/types/updates/delete-ephemeral-messages-update.d.cts +15 -0
  217. package/highlevel/types/updates/delete-ephemeral-messages-update.d.ts +15 -0
  218. package/highlevel/types/updates/delete-ephemeral-messages-update.js +22 -0
  219. package/highlevel/types/updates/ephemeral-callback-query.cjs +69 -0
  220. package/highlevel/types/updates/ephemeral-callback-query.d.cts +44 -0
  221. package/highlevel/types/updates/ephemeral-callback-query.d.ts +44 -0
  222. package/highlevel/types/updates/ephemeral-callback-query.js +64 -0
  223. package/highlevel/types/updates/index.d.cts +16 -2
  224. package/highlevel/types/updates/index.d.ts +16 -2
  225. package/highlevel/types/updates/parse-update.cjs +12 -1
  226. package/highlevel/types/updates/parse-update.js +12 -1
  227. package/highlevel/types/updates/user-typing-update.cjs +18 -0
  228. package/highlevel/types/updates/user-typing-update.d.cts +9 -0
  229. package/highlevel/types/updates/user-typing-update.d.ts +9 -0
  230. package/highlevel/types/updates/user-typing-update.js +18 -0
  231. package/highlevel/updates/manager.cjs +71 -41
  232. package/highlevel/updates/manager.d.cts +1 -0
  233. package/highlevel/updates/manager.d.ts +1 -0
  234. package/highlevel/updates/manager.js +71 -41
  235. package/highlevel/updates/manager.test.d.cts +1 -0
  236. package/highlevel/updates/manager.test.d.ts +1 -0
  237. package/highlevel/utils/stream-utils.cjs +8 -4
  238. package/highlevel/utils/stream-utils.js +8 -4
  239. package/highlevel/utils/stream-utils.test.d.cts +1 -0
  240. package/highlevel/utils/stream-utils.test.d.ts +1 -0
  241. package/highlevel/utils/walk-page-blocks.cjs +9 -0
  242. package/highlevel/utils/walk-page-blocks.js +9 -0
  243. package/index.cjs +10 -0
  244. package/index.js +11 -1
  245. package/methods.cjs +33 -0
  246. package/methods.js +33 -0
  247. package/network/client.cjs +4 -3
  248. package/network/client.d.cts +1 -0
  249. package/network/client.d.ts +1 -0
  250. package/network/client.js +4 -3
  251. package/network/middlewares/flood-waiter.cjs +2 -2
  252. package/network/middlewares/flood-waiter.js +2 -2
  253. package/network/middlewares/internal-errors.cjs +1 -1
  254. package/network/middlewares/internal-errors.js +1 -1
  255. package/network/middlewares/media-throttle.cjs +1 -1
  256. package/network/middlewares/media-throttle.js +1 -1
  257. package/network/mtproto-session.cjs +9 -2
  258. package/network/mtproto-session.d.cts +3 -1
  259. package/network/mtproto-session.d.ts +3 -1
  260. package/network/mtproto-session.js +9 -2
  261. package/network/mtproxy/index.cjs +4 -3
  262. package/network/mtproxy/index.d.cts +2 -2
  263. package/network/mtproxy/index.d.ts +2 -2
  264. package/network/mtproxy/index.js +4 -3
  265. package/network/network-manager.cjs +44 -16
  266. package/network/network-manager.d.cts +10 -3
  267. package/network/network-manager.d.ts +10 -3
  268. package/network/network-manager.js +45 -17
  269. package/network/network-manager.test.d.cts +1 -0
  270. package/network/network-manager.test.d.ts +1 -0
  271. package/network/persistent-connection.cjs +10 -2
  272. package/network/persistent-connection.js +10 -2
  273. package/network/session-connection.cjs +15 -6
  274. package/network/session-connection.js +15 -6
  275. package/network/session-connection.test.d.cts +1 -0
  276. package/network/session-connection.test.d.ts +1 -0
  277. package/network/transports/abstract.cjs +16 -0
  278. package/network/transports/abstract.d.cts +8 -2
  279. package/network/transports/abstract.d.ts +8 -2
  280. package/network/transports/abstract.js +17 -1
  281. package/network/transports/obfuscated.cjs +3 -1
  282. package/network/transports/obfuscated.js +3 -1
  283. package/package.json +6 -6
  284. package/tl/api-schema.json +1 -1
  285. package/tl/binary/reader.cjs +221 -103
  286. package/tl/binary/reader.js +221 -103
  287. package/tl/binary/writer.cjs +693 -277
  288. package/tl/binary/writer.js +693 -277
  289. package/tl/compat/reader.cjs +93 -0
  290. package/tl/compat/reader.js +93 -0
  291. package/tl/index.d.cts +12529 -4762
  292. package/tl/index.d.ts +12529 -4762
  293. package/tl/inner-tl.cjs +90 -24
  294. package/tl/inner-tl.js +90 -24
  295. package/tl/raw-errors.json +1 -1
  296. package/tl/rpc-error.test.d.cts +1 -0
  297. package/tl/rpc-error.test.d.ts +1 -0
  298. package/utils/abort-signal.cjs +1 -12
  299. package/utils/abort-signal.js +1 -12
  300. package/utils/abort-signal.test.d.cts +1 -0
  301. package/utils/abort-signal.test.d.ts +1 -0
  302. package/utils/binary/compat.cjs +189 -29
  303. package/utils/binary/compat.js +189 -29
  304. package/utils/early-timer.cjs +3 -11
  305. package/utils/early-timer.js +3 -11
  306. package/utils/early-timer.test.d.cts +1 -0
  307. package/utils/early-timer.test.d.ts +1 -0
  308. package/utils/function-utils.cjs +9 -4
  309. package/utils/function-utils.js +9 -4
  310. package/utils/links/bots.cjs +10 -2
  311. package/utils/links/bots.js +10 -2
  312. package/utils/peer-utils.cjs +8 -0
  313. package/utils/peer-utils.js +8 -0
@@ -0,0 +1,135 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const memoize = require("../../utils/memoize.cjs");
9
+ const peer = require("../peers/peer.cjs");
10
+ const user = require("../peers/user.cjs");
11
+ const messageEntity = require("./message-entity.cjs");
12
+ const messageMedia = require("./message-media.cjs");
13
+ const richMessage = require("./rich/rich-message.cjs");
14
+ const inspectable = require("../../utils/inspectable.cjs");
15
+ class EphemeralMessage {
16
+ constructor(raw, _peers) {
17
+ this.raw = raw;
18
+ this._peers = _peers;
19
+ }
20
+ /** ID of this message (unique within the chat and receiver) */
21
+ get id() {
22
+ return this.raw.id;
23
+ }
24
+ /** Whether this message is outgoing */
25
+ get isOutgoing() {
26
+ return this.raw.out;
27
+ }
28
+ /** Sender of this message (usually the bot) */
29
+ get sender() {
30
+ return peer.parsePeer(this.raw.fromId, this._peers);
31
+ }
32
+ /**
33
+ * Chat where this message was sent.
34
+ *
35
+ * `null` if not available (e.g. welcome message templates)
36
+ */
37
+ get chat() {
38
+ return this.raw.peerId ? peer.parsePeer(this.raw.peerId, this._peers) : null;
39
+ }
40
+ /** Whether this message is a welcome message template */
41
+ get isWelcomeTemplate() {
42
+ return this.raw.welcomeTemplate;
43
+ }
44
+ /**
45
+ * If set, any eventual webpage preview should be shown on top of
46
+ * the message instead of at the bottom.
47
+ */
48
+ get invertMedia() {
49
+ return this.raw.invertMedia;
50
+ }
51
+ /** Whether this message can't be forwarded */
52
+ get isContentProtected() {
53
+ return this.raw.noforwards;
54
+ }
55
+ /** ID of the user this message is visible to */
56
+ get receiverId() {
57
+ return this.raw.receiverId;
58
+ }
59
+ /**
60
+ * User this message is visible to.
61
+ *
62
+ * Might not be available in some cases (e.g. in the message
63
+ * returned from {@link TelegramClient.sendEphemeralMessage},
64
+ * since the server does not send the receiver entity there) —
65
+ * use {@link receiverId} instead.
66
+ */
67
+ get receiver() {
68
+ const user$1 = this._peers.users.get(this.raw.receiverId);
69
+ if (!user$1 || user$1._ === "userEmpty") return null;
70
+ return new user.User(user$1);
71
+ }
72
+ /** ID of the topic this message was sent to, if any */
73
+ get topicId() {
74
+ return this.raw.topMsgId ?? null;
75
+ }
76
+ /** Date when this message was sent */
77
+ get date() {
78
+ return new Date(this.raw.date * 1e3);
79
+ }
80
+ /** Message text */
81
+ get text() {
82
+ return this.raw.message;
83
+ }
84
+ /** Message text/caption entities (may be empty) */
85
+ get entities() {
86
+ const entities = [];
87
+ if (this.raw.entities?.length) {
88
+ for (const ent of this.raw.entities) {
89
+ entities.push(new messageEntity.MessageEntity(ent, this.raw.message));
90
+ }
91
+ }
92
+ return entities;
93
+ }
94
+ get textWithEntities() {
95
+ return {
96
+ text: this.raw.message,
97
+ entities: this.raw.entities
98
+ };
99
+ }
100
+ /**
101
+ * Message media. `null` for text-only messages
102
+ * and for unsupported media types.
103
+ *
104
+ * For unsupported media types, use `.raw.media` directly.
105
+ */
106
+ get media() {
107
+ if (!this.raw.media || this.raw.media._ === "messageMediaEmpty") {
108
+ return null;
109
+ }
110
+ return messageMedia._messageMediaFromTl(this._peers, this.raw.media);
111
+ }
112
+ /** Reply markup attached to this message, if any */
113
+ get replyMarkup() {
114
+ return this.raw.replyMarkup ?? null;
115
+ }
116
+ /** Information about the message this message is a reply to, if any */
117
+ get replyTo() {
118
+ return this.raw.replyTo ?? null;
119
+ }
120
+ /** Rich message content, if any */
121
+ get richMessage() {
122
+ return this.raw.richMessage ? new richMessage.RichMessage(this.raw.richMessage) : null;
123
+ }
124
+ /** Identifier uniquely corresponding to the chat this message was sent to, if any */
125
+ get chatInstance() {
126
+ return this.raw.chatInstance ?? null;
127
+ }
128
+ /** ID of the message this message is anchored to, if any */
129
+ get anchorMessageId() {
130
+ return this.raw.anchorMsgId ?? null;
131
+ }
132
+ }
133
+ const EphemeralMessage$1 = /* @__PURE__ */ memoize.memoizeGetters(EphemeralMessage, ["sender", "chat", "receiver", "entities", "media", "richMessage"]);
134
+ const EphemeralMessage$2 = /* @__PURE__ */ inspectable.makeInspectable(EphemeralMessage$1);
135
+ exports.EphemeralMessage = EphemeralMessage$2;
@@ -0,0 +1,75 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { TextWithEntities } from '../misc/index.js';
3
+ import { Peer } from '../peers/peer.js';
4
+ import { PeersIndex } from '../peers/peers-index.js';
5
+ import { MessageMedia } from './message-media.js';
6
+ import { User } from '../peers/user.js';
7
+ import { MessageEntity } from './message-entity.js';
8
+ import { RichMessage } from './rich/rich-message.js';
9
+ /**
10
+ * An ephemeral message — a message sent by a bot that is only visible
11
+ * to a single user in a chat and is not persisted in the chat history.
12
+ */
13
+ export declare class EphemeralMessage {
14
+ readonly raw: tl.RawEphemeralMessage;
15
+ readonly _peers: PeersIndex;
16
+ constructor(raw: tl.RawEphemeralMessage, _peers: PeersIndex);
17
+ /** ID of this message (unique within the chat and receiver) */
18
+ get id(): number;
19
+ /** Whether this message is outgoing */
20
+ get isOutgoing(): boolean;
21
+ /** Sender of this message (usually the bot) */
22
+ get sender(): Peer;
23
+ /**
24
+ * Chat where this message was sent.
25
+ *
26
+ * `null` if not available (e.g. welcome message templates)
27
+ */
28
+ get chat(): Peer | null;
29
+ /** Whether this message is a welcome message template */
30
+ get isWelcomeTemplate(): boolean;
31
+ /**
32
+ * If set, any eventual webpage preview should be shown on top of
33
+ * the message instead of at the bottom.
34
+ */
35
+ get invertMedia(): boolean;
36
+ /** Whether this message can't be forwarded */
37
+ get isContentProtected(): boolean;
38
+ /** ID of the user this message is visible to */
39
+ get receiverId(): number;
40
+ /**
41
+ * User this message is visible to.
42
+ *
43
+ * Might not be available in some cases (e.g. in the message
44
+ * returned from {@link TelegramClient.sendEphemeralMessage},
45
+ * since the server does not send the receiver entity there) —
46
+ * use {@link receiverId} instead.
47
+ */
48
+ get receiver(): User | null;
49
+ /** ID of the topic this message was sent to, if any */
50
+ get topicId(): number | null;
51
+ /** Date when this message was sent */
52
+ get date(): Date;
53
+ /** Message text */
54
+ get text(): string;
55
+ /** Message text/caption entities (may be empty) */
56
+ get entities(): ReadonlyArray<MessageEntity>;
57
+ get textWithEntities(): TextWithEntities;
58
+ /**
59
+ * Message media. `null` for text-only messages
60
+ * and for unsupported media types.
61
+ *
62
+ * For unsupported media types, use `.raw.media` directly.
63
+ */
64
+ get media(): MessageMedia;
65
+ /** Reply markup attached to this message, if any */
66
+ get replyMarkup(): tl.TypeReplyMarkup | null;
67
+ /** Information about the message this message is a reply to, if any */
68
+ get replyTo(): tl.TypeMessageReplyHeader | null;
69
+ /** Rich message content, if any */
70
+ get richMessage(): RichMessage | null;
71
+ /** Identifier uniquely corresponding to the chat this message was sent to, if any */
72
+ get chatInstance(): tl.Long | null;
73
+ /** ID of the message this message is anchored to, if any */
74
+ get anchorMessageId(): number | null;
75
+ }
@@ -0,0 +1,75 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { TextWithEntities } from '../misc/index.js';
3
+ import { Peer } from '../peers/peer.js';
4
+ import { PeersIndex } from '../peers/peers-index.js';
5
+ import { MessageMedia } from './message-media.js';
6
+ import { User } from '../peers/user.js';
7
+ import { MessageEntity } from './message-entity.js';
8
+ import { RichMessage } from './rich/rich-message.js';
9
+ /**
10
+ * An ephemeral message — a message sent by a bot that is only visible
11
+ * to a single user in a chat and is not persisted in the chat history.
12
+ */
13
+ export declare class EphemeralMessage {
14
+ readonly raw: tl.RawEphemeralMessage;
15
+ readonly _peers: PeersIndex;
16
+ constructor(raw: tl.RawEphemeralMessage, _peers: PeersIndex);
17
+ /** ID of this message (unique within the chat and receiver) */
18
+ get id(): number;
19
+ /** Whether this message is outgoing */
20
+ get isOutgoing(): boolean;
21
+ /** Sender of this message (usually the bot) */
22
+ get sender(): Peer;
23
+ /**
24
+ * Chat where this message was sent.
25
+ *
26
+ * `null` if not available (e.g. welcome message templates)
27
+ */
28
+ get chat(): Peer | null;
29
+ /** Whether this message is a welcome message template */
30
+ get isWelcomeTemplate(): boolean;
31
+ /**
32
+ * If set, any eventual webpage preview should be shown on top of
33
+ * the message instead of at the bottom.
34
+ */
35
+ get invertMedia(): boolean;
36
+ /** Whether this message can't be forwarded */
37
+ get isContentProtected(): boolean;
38
+ /** ID of the user this message is visible to */
39
+ get receiverId(): number;
40
+ /**
41
+ * User this message is visible to.
42
+ *
43
+ * Might not be available in some cases (e.g. in the message
44
+ * returned from {@link TelegramClient.sendEphemeralMessage},
45
+ * since the server does not send the receiver entity there) —
46
+ * use {@link receiverId} instead.
47
+ */
48
+ get receiver(): User | null;
49
+ /** ID of the topic this message was sent to, if any */
50
+ get topicId(): number | null;
51
+ /** Date when this message was sent */
52
+ get date(): Date;
53
+ /** Message text */
54
+ get text(): string;
55
+ /** Message text/caption entities (may be empty) */
56
+ get entities(): ReadonlyArray<MessageEntity>;
57
+ get textWithEntities(): TextWithEntities;
58
+ /**
59
+ * Message media. `null` for text-only messages
60
+ * and for unsupported media types.
61
+ *
62
+ * For unsupported media types, use `.raw.media` directly.
63
+ */
64
+ get media(): MessageMedia;
65
+ /** Reply markup attached to this message, if any */
66
+ get replyMarkup(): tl.TypeReplyMarkup | null;
67
+ /** Information about the message this message is a reply to, if any */
68
+ get replyTo(): tl.TypeMessageReplyHeader | null;
69
+ /** Rich message content, if any */
70
+ get richMessage(): RichMessage | null;
71
+ /** Identifier uniquely corresponding to the chat this message was sent to, if any */
72
+ get chatInstance(): tl.Long | null;
73
+ /** ID of the message this message is anchored to, if any */
74
+ get anchorMessageId(): number | null;
75
+ }
@@ -0,0 +1,130 @@
1
+ import { memoizeGetters } from "../../utils/memoize.js";
2
+ import { parsePeer } from "../peers/peer.js";
3
+ import { User as User$2 } from "../peers/user.js";
4
+ import { MessageEntity as MessageEntity$2 } from "./message-entity.js";
5
+ import { _messageMediaFromTl } from "./message-media.js";
6
+ import { RichMessage as RichMessage$2 } from "./rich/rich-message.js";
7
+ import { makeInspectable } from "../../utils/inspectable.js";
8
+ class EphemeralMessage {
9
+ constructor(raw, _peers) {
10
+ this.raw = raw;
11
+ this._peers = _peers;
12
+ }
13
+ /** ID of this message (unique within the chat and receiver) */
14
+ get id() {
15
+ return this.raw.id;
16
+ }
17
+ /** Whether this message is outgoing */
18
+ get isOutgoing() {
19
+ return this.raw.out;
20
+ }
21
+ /** Sender of this message (usually the bot) */
22
+ get sender() {
23
+ return parsePeer(this.raw.fromId, this._peers);
24
+ }
25
+ /**
26
+ * Chat where this message was sent.
27
+ *
28
+ * `null` if not available (e.g. welcome message templates)
29
+ */
30
+ get chat() {
31
+ return this.raw.peerId ? parsePeer(this.raw.peerId, this._peers) : null;
32
+ }
33
+ /** Whether this message is a welcome message template */
34
+ get isWelcomeTemplate() {
35
+ return this.raw.welcomeTemplate;
36
+ }
37
+ /**
38
+ * If set, any eventual webpage preview should be shown on top of
39
+ * the message instead of at the bottom.
40
+ */
41
+ get invertMedia() {
42
+ return this.raw.invertMedia;
43
+ }
44
+ /** Whether this message can't be forwarded */
45
+ get isContentProtected() {
46
+ return this.raw.noforwards;
47
+ }
48
+ /** ID of the user this message is visible to */
49
+ get receiverId() {
50
+ return this.raw.receiverId;
51
+ }
52
+ /**
53
+ * User this message is visible to.
54
+ *
55
+ * Might not be available in some cases (e.g. in the message
56
+ * returned from {@link TelegramClient.sendEphemeralMessage},
57
+ * since the server does not send the receiver entity there) —
58
+ * use {@link receiverId} instead.
59
+ */
60
+ get receiver() {
61
+ const user = this._peers.users.get(this.raw.receiverId);
62
+ if (!user || user._ === "userEmpty") return null;
63
+ return new User$2(user);
64
+ }
65
+ /** ID of the topic this message was sent to, if any */
66
+ get topicId() {
67
+ return this.raw.topMsgId ?? null;
68
+ }
69
+ /** Date when this message was sent */
70
+ get date() {
71
+ return new Date(this.raw.date * 1e3);
72
+ }
73
+ /** Message text */
74
+ get text() {
75
+ return this.raw.message;
76
+ }
77
+ /** Message text/caption entities (may be empty) */
78
+ get entities() {
79
+ const entities = [];
80
+ if (this.raw.entities?.length) {
81
+ for (const ent of this.raw.entities) {
82
+ entities.push(new MessageEntity$2(ent, this.raw.message));
83
+ }
84
+ }
85
+ return entities;
86
+ }
87
+ get textWithEntities() {
88
+ return {
89
+ text: this.raw.message,
90
+ entities: this.raw.entities
91
+ };
92
+ }
93
+ /**
94
+ * Message media. `null` for text-only messages
95
+ * and for unsupported media types.
96
+ *
97
+ * For unsupported media types, use `.raw.media` directly.
98
+ */
99
+ get media() {
100
+ if (!this.raw.media || this.raw.media._ === "messageMediaEmpty") {
101
+ return null;
102
+ }
103
+ return _messageMediaFromTl(this._peers, this.raw.media);
104
+ }
105
+ /** Reply markup attached to this message, if any */
106
+ get replyMarkup() {
107
+ return this.raw.replyMarkup ?? null;
108
+ }
109
+ /** Information about the message this message is a reply to, if any */
110
+ get replyTo() {
111
+ return this.raw.replyTo ?? null;
112
+ }
113
+ /** Rich message content, if any */
114
+ get richMessage() {
115
+ return this.raw.richMessage ? new RichMessage$2(this.raw.richMessage) : null;
116
+ }
117
+ /** Identifier uniquely corresponding to the chat this message was sent to, if any */
118
+ get chatInstance() {
119
+ return this.raw.chatInstance ?? null;
120
+ }
121
+ /** ID of the message this message is anchored to, if any */
122
+ get anchorMessageId() {
123
+ return this.raw.anchorMsgId ?? null;
124
+ }
125
+ }
126
+ const EphemeralMessage$1 = /* @__PURE__ */ memoizeGetters(EphemeralMessage, ["sender", "chat", "receiver", "entities", "media", "richMessage"]);
127
+ const EphemeralMessage$2 = /* @__PURE__ */ makeInspectable(EphemeralMessage$1);
128
+ export {
129
+ EphemeralMessage$2 as EphemeralMessage
130
+ };
@@ -1,5 +1,6 @@
1
1
  export * from './dialog.js';
2
2
  export * from './draft-message.js';
3
+ export * from './ephemeral-message.js';
3
4
  export * from './fact-check.js';
4
5
  export * from './input-message-id.js';
5
6
  export * from './message-action.js';
@@ -1,5 +1,6 @@
1
1
  export * from './dialog.js';
2
2
  export * from './draft-message.js';
3
+ export * from './ephemeral-message.js';
3
4
  export * from './fact-check.js';
4
5
  export * from './input-message-id.js';
5
6
  export * from './message-action.js';
@@ -9,6 +9,7 @@ const Long = require("long");
9
9
  const peerUtils = require("../../../utils/peer-utils.cjs");
10
10
  const typeAssertions = require("../../../utils/type-assertions.cjs");
11
11
  const photo = require("../media/photo.cjs");
12
+ const chat = require("../peers/chat.cjs");
12
13
  const peer = require("../peers/peer.cjs");
13
14
  const user = require("../peers/user.cjs");
14
15
  const starGiftUnique = require("../premium/star-gift-unique.cjs");
@@ -204,6 +205,11 @@ function _messageActionFromTl(act) {
204
205
  return {
205
206
  type: "user_joined_approved"
206
207
  };
208
+ case "messageActionChatJoinedViaCommunity":
209
+ return {
210
+ type: "user_joined_community",
211
+ community: new chat.Chat(this._peers.chat(act.communityId))
212
+ };
207
213
  case "messageActionWebViewDataSent":
208
214
  return {
209
215
  type: "webview_sent",
@@ -340,7 +346,9 @@ function _messageActionFromTl(act) {
340
346
  canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
341
347
  canCraftAt: act.canCraftAt ? new Date(act.canCraftAt * 1e3) : void 0,
342
348
  savedId: act.savedId,
343
- dropDetailsStars: act.dropOriginalDetailsStars
349
+ dropDetailsStars: act.dropOriginalDetailsStars,
350
+ nameHidden: act.nameHidden,
351
+ message: act.message
344
352
  };
345
353
  if (act.assigned) {
346
354
  return {
@@ -471,6 +479,11 @@ function _messageActionFromTl(act) {
471
479
  type: "managed_bot_created",
472
480
  botId: act.botId
473
481
  };
482
+ case "messageActionChangeCommunity":
483
+ return {
484
+ type: "change_community",
485
+ community: act.communityId ? new chat.Chat(this._peers.chat(act.communityId)) : null
486
+ };
474
487
  default:
475
488
  return null;
476
489
  }
@@ -3,6 +3,7 @@ import { TextWithEntities } from '../misc/entities.js';
3
3
  import { Peer } from '../peers/peer.js';
4
4
  import { Message } from './message.js';
5
5
  import { Photo } from '../media/photo.js';
6
+ import { Chat } from '../peers/chat.js';
6
7
  import { User } from '../peers/user.js';
7
8
  import { StarGiftUnique } from '../premium/star-gift-unique.js';
8
9
  import { StarGift } from '../premium/star-gift.js';
@@ -103,6 +104,12 @@ export interface ActionUserJoinedLink {
103
104
  export interface ActionUserJoinedApproved {
104
105
  readonly type: 'user_joined_approved';
105
106
  }
107
+ /** User has joined the group because they are a member of a community */
108
+ export interface ActionUserJoinedViaCommunity {
109
+ readonly type: 'user_joined_community';
110
+ /** Community the user has joined via */
111
+ readonly community: Chat;
112
+ }
106
113
  /** A payment was received from a user (bot) */
107
114
  export interface ActionPaymentReceived {
108
115
  readonly type: 'payment_received';
@@ -476,6 +483,10 @@ interface StarGiftUniqueCommon {
476
483
  dropDetailsStars?: tl.Long;
477
484
  /** ID of the related saved profile gift */
478
485
  savedId?: tl.Long;
486
+ /** Whether the name of the sender/buyer is hidden */
487
+ nameHidden: boolean;
488
+ /** Message attached to the gift, if any */
489
+ message?: TextWithEntities;
479
490
  }
480
491
  /** A star gift was upgraded to a unique one */
481
492
  export interface ActionStarGiftUpgraded extends StarGiftUniqueCommon {
@@ -609,6 +620,12 @@ export interface ActionManagedBotCreated {
609
620
  /** ID of the created bot */
610
621
  readonly botId: number;
611
622
  }
623
+ /** Community linked to the chat was changed */
624
+ export interface ActionChangeCommunity {
625
+ readonly type: 'change_community';
626
+ /** The new community, or `null` if the chat was unlinked from a community */
627
+ readonly community: Chat | null;
628
+ }
612
629
  /** Group creator has left the group, and a new creator has been assigned but not yet made one */
613
630
  export interface ActionNewCreatorPending {
614
631
  readonly type: 'new_creator_pending';
@@ -621,7 +638,7 @@ export interface ActionChangeCreator {
621
638
  /** New creator */
622
639
  newCreator: User;
623
640
  }
624
- export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | ActionPollAppendAnswer | ActionPollDeleteAnswer | ActionManagedBotCreated | null;
641
+ export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionUserJoinedViaCommunity | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | ActionPollAppendAnswer | ActionPollDeleteAnswer | ActionManagedBotCreated | ActionChangeCommunity | null;
625
642
  /** @internal */
626
643
  export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
627
644
  export {};
@@ -3,6 +3,7 @@ import { TextWithEntities } from '../misc/entities.js';
3
3
  import { Peer } from '../peers/peer.js';
4
4
  import { Message } from './message.js';
5
5
  import { Photo } from '../media/photo.js';
6
+ import { Chat } from '../peers/chat.js';
6
7
  import { User } from '../peers/user.js';
7
8
  import { StarGiftUnique } from '../premium/star-gift-unique.js';
8
9
  import { StarGift } from '../premium/star-gift.js';
@@ -103,6 +104,12 @@ export interface ActionUserJoinedLink {
103
104
  export interface ActionUserJoinedApproved {
104
105
  readonly type: 'user_joined_approved';
105
106
  }
107
+ /** User has joined the group because they are a member of a community */
108
+ export interface ActionUserJoinedViaCommunity {
109
+ readonly type: 'user_joined_community';
110
+ /** Community the user has joined via */
111
+ readonly community: Chat;
112
+ }
106
113
  /** A payment was received from a user (bot) */
107
114
  export interface ActionPaymentReceived {
108
115
  readonly type: 'payment_received';
@@ -476,6 +483,10 @@ interface StarGiftUniqueCommon {
476
483
  dropDetailsStars?: tl.Long;
477
484
  /** ID of the related saved profile gift */
478
485
  savedId?: tl.Long;
486
+ /** Whether the name of the sender/buyer is hidden */
487
+ nameHidden: boolean;
488
+ /** Message attached to the gift, if any */
489
+ message?: TextWithEntities;
479
490
  }
480
491
  /** A star gift was upgraded to a unique one */
481
492
  export interface ActionStarGiftUpgraded extends StarGiftUniqueCommon {
@@ -609,6 +620,12 @@ export interface ActionManagedBotCreated {
609
620
  /** ID of the created bot */
610
621
  readonly botId: number;
611
622
  }
623
+ /** Community linked to the chat was changed */
624
+ export interface ActionChangeCommunity {
625
+ readonly type: 'change_community';
626
+ /** The new community, or `null` if the chat was unlinked from a community */
627
+ readonly community: Chat | null;
628
+ }
612
629
  /** Group creator has left the group, and a new creator has been assigned but not yet made one */
613
630
  export interface ActionNewCreatorPending {
614
631
  readonly type: 'new_creator_pending';
@@ -621,7 +638,7 @@ export interface ActionChangeCreator {
621
638
  /** New creator */
622
639
  newCreator: User;
623
640
  }
624
- export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | ActionPollAppendAnswer | ActionPollDeleteAnswer | ActionManagedBotCreated | null;
641
+ export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionUserJoinedViaCommunity | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | ActionPollAppendAnswer | ActionPollDeleteAnswer | ActionManagedBotCreated | ActionChangeCommunity | null;
625
642
  /** @internal */
626
643
  export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
627
644
  export {};
@@ -2,6 +2,7 @@ import Long from "long";
2
2
  import { getMarkedPeerId } from "../../../utils/peer-utils.js";
3
3
  import { assertTypeIsNot } from "../../../utils/type-assertions.js";
4
4
  import { Photo as Photo$2 } from "../media/photo.js";
5
+ import { Chat as Chat$2 } from "../peers/chat.js";
5
6
  import { parsePeer } from "../peers/peer.js";
6
7
  import { User as User$2 } from "../peers/user.js";
7
8
  import { StarGiftUnique as StarGiftUnique$2 } from "../premium/star-gift-unique.js";
@@ -197,6 +198,11 @@ function _messageActionFromTl(act) {
197
198
  return {
198
199
  type: "user_joined_approved"
199
200
  };
201
+ case "messageActionChatJoinedViaCommunity":
202
+ return {
203
+ type: "user_joined_community",
204
+ community: new Chat$2(this._peers.chat(act.communityId))
205
+ };
200
206
  case "messageActionWebViewDataSent":
201
207
  return {
202
208
  type: "webview_sent",
@@ -333,7 +339,9 @@ function _messageActionFromTl(act) {
333
339
  canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
334
340
  canCraftAt: act.canCraftAt ? new Date(act.canCraftAt * 1e3) : void 0,
335
341
  savedId: act.savedId,
336
- dropDetailsStars: act.dropOriginalDetailsStars
342
+ dropDetailsStars: act.dropOriginalDetailsStars,
343
+ nameHidden: act.nameHidden,
344
+ message: act.message
337
345
  };
338
346
  if (act.assigned) {
339
347
  return {
@@ -464,6 +472,11 @@ function _messageActionFromTl(act) {
464
472
  type: "managed_bot_created",
465
473
  botId: act.botId
466
474
  };
475
+ case "messageActionChangeCommunity":
476
+ return {
477
+ type: "change_community",
478
+ community: act.communityId ? new Chat$2(this._peers.chat(act.communityId)) : null
479
+ };
467
480
  default:
468
481
  return null;
469
482
  }
@@ -379,7 +379,8 @@ class Message {
379
379
  return {
380
380
  type: "force_reply",
381
381
  singleUse: rm.singleUse,
382
- selective: rm.selective
382
+ selective: rm.selective,
383
+ placeholder: rm.placeholder
383
384
  };
384
385
  case "replyKeyboardMarkup":
385
386
  return {
@@ -387,12 +388,16 @@ class Message {
387
388
  resize: rm.resize,
388
389
  singleUse: rm.singleUse,
389
390
  selective: rm.selective,
391
+ persistent: rm.persistent,
392
+ forceReply: rm.forceReply,
393
+ placeholder: rm.placeholder,
390
394
  buttons: factories._rowsTo2d(rm.rows)
391
395
  };
392
396
  case "replyInlineMarkup":
393
397
  return {
394
398
  type: "inline",
395
- buttons: factories._rowsTo2d(rm.rows)
399
+ forceReply: rm.forceReply,
400
+ buttons: factories._inlineRowsTo2d(rm.rows)
396
401
  };
397
402
  default:
398
403
  utils.assertNever();
@@ -1,5 +1,5 @@
1
1
  import { tl } from '../../../tl/index.js';
2
- import { ReplyMarkup } from '../bots/keyboards/index.js';
2
+ import { ParsedReplyMarkup } from '../bots/keyboards/index.js';
3
3
  import { TextWithEntities } from '../misc/index.js';
4
4
  import { Peer } from '../peers/peer.js';
5
5
  import { PeersIndex } from '../peers/peers-index.js';
@@ -232,7 +232,7 @@ export declare class Message {
232
232
  /**
233
233
  * Reply markup provided with this message, if any.
234
234
  */
235
- get markup(): ReplyMarkup | null;
235
+ get markup(): ParsedReplyMarkup | null;
236
236
  /**
237
237
  * Whether this message can be forwarded
238
238
  *