@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,37 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { Peer } from './peer.js';
3
+ import { PeersIndex } from './peers-index.js';
4
+ import { User } from './user.js';
5
+ /**
6
+ * A chat or user linked to a community
7
+ */
8
+ export declare class CommunityPeer {
9
+ readonly raw: tl.RawCommunityPeer;
10
+ readonly _peers: PeersIndex;
11
+ constructor(raw: tl.RawCommunityPeer, _peers: PeersIndex);
12
+ /** The linked peer itself */
13
+ get peer(): Peer;
14
+ /**
15
+ * Whether this peer is visible in the community's peer list,
16
+ * or `null` if this information is not available
17
+ */
18
+ get isVisible(): boolean | null;
19
+ /** Whether the current user can view the history of this peer */
20
+ get canViewHistory(): boolean;
21
+ }
22
+ /**
23
+ * A pending request to link a peer to a community
24
+ */
25
+ export declare class CommunityPeerRequest {
26
+ readonly raw: tl.RawCommunityPeerRequest;
27
+ readonly _peers: PeersIndex;
28
+ constructor(raw: tl.RawCommunityPeerRequest, _peers: PeersIndex);
29
+ /** The peer that is requested to be linked */
30
+ get peer(): Peer;
31
+ /** User who has requested the link */
32
+ get requestedBy(): User;
33
+ /** Whether the peer is requested to be visible in the community's peer list */
34
+ get isVisible(): boolean;
35
+ /** Date when the request was sent */
36
+ get date(): Date;
37
+ }
@@ -0,0 +1,55 @@
1
+ import { memoizeGetters } from "../../utils/memoize.js";
2
+ import { parsePeer } from "./peer.js";
3
+ import { User as User$2 } from "./user.js";
4
+ import { makeInspectable } from "../../utils/inspectable.js";
5
+ class CommunityPeer {
6
+ constructor(raw, _peers) {
7
+ this.raw = raw;
8
+ this._peers = _peers;
9
+ }
10
+ /** The linked peer itself */
11
+ get peer() {
12
+ return parsePeer(this.raw.peer, this._peers);
13
+ }
14
+ /**
15
+ * Whether this peer is visible in the community's peer list,
16
+ * or `null` if this information is not available
17
+ */
18
+ get isVisible() {
19
+ return this.raw.visible ?? null;
20
+ }
21
+ /** Whether the current user can view the history of this peer */
22
+ get canViewHistory() {
23
+ return this.raw.canViewHistory;
24
+ }
25
+ }
26
+ const CommunityPeer$1 = /* @__PURE__ */ memoizeGetters(CommunityPeer, ["peer"]);
27
+ const CommunityPeer$2 = /* @__PURE__ */ makeInspectable(CommunityPeer$1);
28
+ class CommunityPeerRequest {
29
+ constructor(raw, _peers) {
30
+ this.raw = raw;
31
+ this._peers = _peers;
32
+ }
33
+ /** The peer that is requested to be linked */
34
+ get peer() {
35
+ return parsePeer(this.raw.peer, this._peers);
36
+ }
37
+ /** User who has requested the link */
38
+ get requestedBy() {
39
+ return new User$2(this._peers.user(this.raw.requestedBy));
40
+ }
41
+ /** Whether the peer is requested to be visible in the community's peer list */
42
+ get isVisible() {
43
+ return this.raw.visible;
44
+ }
45
+ /** Date when the request was sent */
46
+ get date() {
47
+ return new Date(this.raw.date * 1e3);
48
+ }
49
+ }
50
+ const CommunityPeerRequest$1 = /* @__PURE__ */ memoizeGetters(CommunityPeerRequest, ["peer", "requestedBy"]);
51
+ const CommunityPeerRequest$2 = /* @__PURE__ */ makeInspectable(CommunityPeerRequest$1);
52
+ export {
53
+ CommunityPeer$2 as CommunityPeer,
54
+ CommunityPeerRequest$2 as CommunityPeerRequest
55
+ };
@@ -14,6 +14,7 @@ const botInfo = require("./bot-info.cjs");
14
14
  const botVerification = require("./bot-verification.cjs");
15
15
  const chatInviteLink = require("./chat-invite-link.cjs");
16
16
  const chat = require("./chat.cjs");
17
+ const communityPeer = require("./community-peer.cjs");
17
18
  const peersIndex = require("./peers-index.cjs");
18
19
  const user = require("./user.cjs");
19
20
  class FullChat extends chat.Chat {
@@ -39,7 +40,7 @@ class FullChat extends chat.Chat {
39
40
  }
40
41
  /** Whether the current user can change the chat's username */
41
42
  get canSetUsername() {
42
- return this.full.canSetUsername;
43
+ return this.full._ !== "communityFull" && this.full.canSetUsername;
43
44
  }
44
45
  /** Whether the current user can change the chat's sticker set */
45
46
  get canSetStickers() {
@@ -68,6 +69,8 @@ class FullChat extends chat.Chat {
68
69
  return this.full.canDeleteChannel;
69
70
  case "chatFull":
70
71
  return this.raw._ === "chat" && this.raw.creator;
72
+ case "communityFull":
73
+ return this.raw._ === "community" && this.raw.creator;
71
74
  }
72
75
  }
73
76
  /**
@@ -127,6 +130,7 @@ class FullChat extends chat.Chat {
127
130
  * Chat's primary invite link, if available
128
131
  */
129
132
  get inviteLink() {
133
+ if (this.full._ === "communityFull") return null;
130
134
  switch (this.full.exportedInvite?._) {
131
135
  case "chatInvitePublicJoinRequests":
132
136
  return null;
@@ -183,11 +187,11 @@ class FullChat extends chat.Chat {
183
187
  }
184
188
  /** Number of admins in the chat (0 if not available) */
185
189
  get adminsCount() {
186
- return this.full._ === "channelFull" ? this.full.adminsCount ?? 0 : 0;
190
+ return this.full._ === "chatFull" ? 0 : this.full.adminsCount ?? 0;
187
191
  }
188
192
  /** Number of users kicked from the chat (if available) */
189
193
  get kickedCount() {
190
- return this.full._ === "channelFull" ? this.full.kickedCount ?? null : null;
194
+ return this.full._ === "chatFull" ? null : this.full.kickedCount ?? null;
191
195
  }
192
196
  /** Number of users kicked from the chat (if available) */
193
197
  get bannedCount() {
@@ -266,7 +270,8 @@ class FullChat extends chat.Chat {
266
270
  * TTL of all messages in this chat, in seconds
267
271
  */
268
272
  get ttlPeriod() {
269
- return this.full?.ttlPeriod ?? null;
273
+ if (this.full._ === "communityFull") return null;
274
+ return this.full.ttlPeriod ?? null;
270
275
  }
271
276
  /** Slowmode delay for this chat, if any */
272
277
  get slowmodeSeconds() {
@@ -307,6 +312,10 @@ class FullChat extends chat.Chat {
307
312
  if (this.full._ !== "channelFull" || !this.full.botVerification) return null;
308
313
  return new botVerification.BotVerification(this.full.botVerification);
309
314
  }
315
+ /** Whether this chat has welcome messages configured */
316
+ get hasWelcomeMessages() {
317
+ return this.full._ !== "communityFull" && this.full.hasWelcomeMessages;
318
+ }
310
319
  /** Whether star gifts are available in this chat */
311
320
  get starGiftsAvailable() {
312
321
  return this.full._ === "channelFull" && this.full.stargiftsAvailable;
@@ -319,6 +328,15 @@ class FullChat extends chat.Chat {
319
328
  get paidMessagesAvailable() {
320
329
  return this.full._ === "channelFull" && this.full.paidMessagesAvailable;
321
330
  }
331
+ /** For communities, list of peers linked to it */
332
+ get linkedPeers() {
333
+ if (this.full._ !== "communityFull") return [];
334
+ return this.full.linkedPeers.map((it) => new communityPeer.CommunityPeer(it, this.peers));
335
+ }
336
+ /** For communities, number of pending peer link requests (if available) */
337
+ get linkRequestsPending() {
338
+ return this.full._ === "communityFull" ? this.full.peerLinkRequestsPending ?? null : null;
339
+ }
322
340
  }
323
341
  const FullChat$1 = /* @__PURE__ */ memoize.memoizeGetters(FullChat, [
324
342
  "fullPhoto",
@@ -330,7 +348,8 @@ const FullChat$1 = /* @__PURE__ */ memoize.memoizeGetters(FullChat, [
330
348
  "linkedChat",
331
349
  "recentRequesters",
332
350
  "stories",
333
- "botVerification"
351
+ "botVerification",
352
+ "linkedPeers"
334
353
  ]);
335
354
  const FullChat$2 = /* @__PURE__ */ inspectable.makeInspectable(FullChat$1);
336
355
  exports.FullChat = FullChat$2;
@@ -6,6 +6,7 @@ import { BotInfo } from './bot-info.js';
6
6
  import { BotVerification } from './bot-verification.js';
7
7
  import { ChatInviteLink } from './chat-invite-link.js';
8
8
  import { Chat } from './chat.js';
9
+ import { CommunityPeer } from './community-peer.js';
9
10
  import { PeersIndex } from './peers-index.js';
10
11
  import { User } from './user.js';
11
12
  /**
@@ -166,10 +167,16 @@ export declare class FullChat extends Chat {
166
167
  get stories(): PeerStories | null;
167
168
  /** Information about a bot-issued verification (if any) */
168
169
  get botVerification(): BotVerification | null;
170
+ /** Whether this chat has welcome messages configured */
171
+ get hasWelcomeMessages(): boolean;
169
172
  /** Whether star gifts are available in this chat */
170
173
  get starGiftsAvailable(): boolean;
171
174
  /** Number of star gifts available in this chat */
172
175
  get starGiftsCount(): number;
173
176
  /** Whether you can enable paid messages in this chat */
174
177
  get paidMessagesAvailable(): boolean;
178
+ /** For communities, list of peers linked to it */
179
+ get linkedPeers(): CommunityPeer[];
180
+ /** For communities, number of pending peer link requests (if available) */
181
+ get linkRequestsPending(): number | null;
175
182
  }
@@ -6,6 +6,7 @@ import { BotInfo } from './bot-info.js';
6
6
  import { BotVerification } from './bot-verification.js';
7
7
  import { ChatInviteLink } from './chat-invite-link.js';
8
8
  import { Chat } from './chat.js';
9
+ import { CommunityPeer } from './community-peer.js';
9
10
  import { PeersIndex } from './peers-index.js';
10
11
  import { User } from './user.js';
11
12
  /**
@@ -166,10 +167,16 @@ export declare class FullChat extends Chat {
166
167
  get stories(): PeerStories | null;
167
168
  /** Information about a bot-issued verification (if any) */
168
169
  get botVerification(): BotVerification | null;
170
+ /** Whether this chat has welcome messages configured */
171
+ get hasWelcomeMessages(): boolean;
169
172
  /** Whether star gifts are available in this chat */
170
173
  get starGiftsAvailable(): boolean;
171
174
  /** Number of star gifts available in this chat */
172
175
  get starGiftsCount(): number;
173
176
  /** Whether you can enable paid messages in this chat */
174
177
  get paidMessagesAvailable(): boolean;
178
+ /** For communities, list of peers linked to it */
179
+ get linkedPeers(): CommunityPeer[];
180
+ /** For communities, number of pending peer link requests (if available) */
181
+ get linkRequestsPending(): number | null;
175
182
  }
@@ -7,6 +7,7 @@ import { BotInfo as BotInfo$2 } from "./bot-info.js";
7
7
  import { BotVerification as BotVerification$1 } from "./bot-verification.js";
8
8
  import { ChatInviteLink as ChatInviteLink$2 } from "./chat-invite-link.js";
9
9
  import { Chat as Chat$2 } from "./chat.js";
10
+ import { CommunityPeer as CommunityPeer$2 } from "./community-peer.js";
10
11
  import { PeersIndex } from "./peers-index.js";
11
12
  import { User as User$2 } from "./user.js";
12
13
  class FullChat extends Chat$2 {
@@ -32,7 +33,7 @@ class FullChat extends Chat$2 {
32
33
  }
33
34
  /** Whether the current user can change the chat's username */
34
35
  get canSetUsername() {
35
- return this.full.canSetUsername;
36
+ return this.full._ !== "communityFull" && this.full.canSetUsername;
36
37
  }
37
38
  /** Whether the current user can change the chat's sticker set */
38
39
  get canSetStickers() {
@@ -61,6 +62,8 @@ class FullChat extends Chat$2 {
61
62
  return this.full.canDeleteChannel;
62
63
  case "chatFull":
63
64
  return this.raw._ === "chat" && this.raw.creator;
65
+ case "communityFull":
66
+ return this.raw._ === "community" && this.raw.creator;
64
67
  }
65
68
  }
66
69
  /**
@@ -120,6 +123,7 @@ class FullChat extends Chat$2 {
120
123
  * Chat's primary invite link, if available
121
124
  */
122
125
  get inviteLink() {
126
+ if (this.full._ === "communityFull") return null;
123
127
  switch (this.full.exportedInvite?._) {
124
128
  case "chatInvitePublicJoinRequests":
125
129
  return null;
@@ -176,11 +180,11 @@ class FullChat extends Chat$2 {
176
180
  }
177
181
  /** Number of admins in the chat (0 if not available) */
178
182
  get adminsCount() {
179
- return this.full._ === "channelFull" ? this.full.adminsCount ?? 0 : 0;
183
+ return this.full._ === "chatFull" ? 0 : this.full.adminsCount ?? 0;
180
184
  }
181
185
  /** Number of users kicked from the chat (if available) */
182
186
  get kickedCount() {
183
- return this.full._ === "channelFull" ? this.full.kickedCount ?? null : null;
187
+ return this.full._ === "chatFull" ? null : this.full.kickedCount ?? null;
184
188
  }
185
189
  /** Number of users kicked from the chat (if available) */
186
190
  get bannedCount() {
@@ -259,7 +263,8 @@ class FullChat extends Chat$2 {
259
263
  * TTL of all messages in this chat, in seconds
260
264
  */
261
265
  get ttlPeriod() {
262
- return this.full?.ttlPeriod ?? null;
266
+ if (this.full._ === "communityFull") return null;
267
+ return this.full.ttlPeriod ?? null;
263
268
  }
264
269
  /** Slowmode delay for this chat, if any */
265
270
  get slowmodeSeconds() {
@@ -300,6 +305,10 @@ class FullChat extends Chat$2 {
300
305
  if (this.full._ !== "channelFull" || !this.full.botVerification) return null;
301
306
  return new BotVerification$1(this.full.botVerification);
302
307
  }
308
+ /** Whether this chat has welcome messages configured */
309
+ get hasWelcomeMessages() {
310
+ return this.full._ !== "communityFull" && this.full.hasWelcomeMessages;
311
+ }
303
312
  /** Whether star gifts are available in this chat */
304
313
  get starGiftsAvailable() {
305
314
  return this.full._ === "channelFull" && this.full.stargiftsAvailable;
@@ -312,6 +321,15 @@ class FullChat extends Chat$2 {
312
321
  get paidMessagesAvailable() {
313
322
  return this.full._ === "channelFull" && this.full.paidMessagesAvailable;
314
323
  }
324
+ /** For communities, list of peers linked to it */
325
+ get linkedPeers() {
326
+ if (this.full._ !== "communityFull") return [];
327
+ return this.full.linkedPeers.map((it) => new CommunityPeer$2(it, this.peers));
328
+ }
329
+ /** For communities, number of pending peer link requests (if available) */
330
+ get linkRequestsPending() {
331
+ return this.full._ === "communityFull" ? this.full.peerLinkRequestsPending ?? null : null;
332
+ }
315
333
  }
316
334
  const FullChat$1 = /* @__PURE__ */ memoizeGetters(FullChat, [
317
335
  "fullPhoto",
@@ -323,7 +341,8 @@ const FullChat$1 = /* @__PURE__ */ memoizeGetters(FullChat, [
323
341
  "linkedChat",
324
342
  "recentRequesters",
325
343
  "stories",
326
- "botVerification"
344
+ "botVerification",
345
+ "linkedPeers"
327
346
  ]);
328
347
  const FullChat$2 = /* @__PURE__ */ makeInspectable(FullChat$1);
329
348
  export {
@@ -10,6 +10,7 @@ export * from './chat-photo.js';
10
10
  export * from './chat-preview.js';
11
11
  export * from './chat.js';
12
12
  export * from './chatlist-preview.js';
13
+ export * from './community-peer.js';
13
14
  export * from './forum-topic.js';
14
15
  export * from './full-chat.js';
15
16
  export * from './full-user.js';
@@ -10,6 +10,7 @@ export * from './chat-photo.js';
10
10
  export * from './chat-preview.js';
11
11
  export * from './chat.js';
12
12
  export * from './chatlist-preview.js';
13
+ export * from './community-peer.js';
13
14
  export * from './forum-topic.js';
14
15
  export * from './full-chat.js';
15
16
  export * from './full-user.js';
@@ -20,6 +20,8 @@ function parsePeer(peer, index) {
20
20
  case "channelForbidden":
21
21
  case "chat":
22
22
  case "chatForbidden":
23
+ case "community":
24
+ case "communityForbidden":
23
25
  return new chat.Chat(peer);
24
26
  case "user":
25
27
  return new user.User(peer);
@@ -13,6 +13,8 @@ function parsePeer(peer, index) {
13
13
  case "channelForbidden":
14
14
  case "chat":
15
15
  case "chatForbidden":
16
+ case "community":
17
+ case "communityForbidden":
16
18
  return new Chat$2(peer);
17
19
  case "user":
18
20
  return new User$2(peer);
@@ -22,5 +22,8 @@
22
22
  * - `sticker`: User is choosing a sticker
23
23
  * - `interaction`: User has sent an emoji interaction
24
24
  * - `interaction_seen`: User is watching a previously sent emoji interaction
25
+ * - `stop_draft`: User has requested to stop the ongoing draft streaming
25
26
  */
26
- export type TypingStatus = 'typing' | 'cancel' | 'record_video' | 'upload_video' | 'record_voice' | 'upload_voice' | 'upload_photo' | 'upload_document' | 'geo' | 'contact' | 'game' | 'record_round' | 'upload_round' | 'speak_call' | 'history_import' | 'sticker' | 'interaction' | 'interaction_seen';
27
+ export type TypingStatus = 'typing' | 'cancel' | 'record_video' | 'upload_video' | 'record_voice' | 'upload_voice' | 'upload_photo' | 'upload_document' | 'geo' | 'contact' | 'game' | 'record_round' | 'upload_round' | 'speak_call' | 'history_import' | 'sticker' | 'interaction' | 'interaction_seen' | 'stop_draft';
28
+ /** {@link TypingStatus} values that can be sent by the client as-is */
29
+ export type SendableTypingStatus = Exclude<TypingStatus, 'interaction' | 'interaction_seen' | 'stop_draft'>;
@@ -22,5 +22,8 @@
22
22
  * - `sticker`: User is choosing a sticker
23
23
  * - `interaction`: User has sent an emoji interaction
24
24
  * - `interaction_seen`: User is watching a previously sent emoji interaction
25
+ * - `stop_draft`: User has requested to stop the ongoing draft streaming
25
26
  */
26
- export type TypingStatus = 'typing' | 'cancel' | 'record_video' | 'upload_video' | 'record_voice' | 'upload_voice' | 'upload_photo' | 'upload_document' | 'geo' | 'contact' | 'game' | 'record_round' | 'upload_round' | 'speak_call' | 'history_import' | 'sticker' | 'interaction' | 'interaction_seen';
27
+ export type TypingStatus = 'typing' | 'cancel' | 'record_video' | 'upload_video' | 'record_voice' | 'upload_voice' | 'upload_photo' | 'upload_document' | 'geo' | 'contact' | 'game' | 'record_round' | 'upload_round' | 'speak_call' | 'history_import' | 'sticker' | 'interaction' | 'interaction_seen' | 'stop_draft';
28
+ /** {@link TypingStatus} values that can be sent by the client as-is */
29
+ export type SendableTypingStatus = Exclude<TypingStatus, 'interaction' | 'interaction_seen' | 'stop_draft'>;
@@ -6,6 +6,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
6
6
  "use strict";
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const errors = require("../../../types/errors.cjs");
9
+ const peerUtils = require("../../../utils/peer-utils.cjs");
9
10
  const typeAssertions = require("../../../utils/type-assertions.cjs");
10
11
  const memoize = require("../../utils/memoize.cjs");
11
12
  const messageEntity = require("../messages/message-entity.cjs");
@@ -396,6 +397,11 @@ class User {
396
397
  get paidMessagePrice() {
397
398
  return this.raw.sendPaidMessagesStars ?? null;
398
399
  }
400
+ /** Marked ID of the community this user (bot) is linked to, if any */
401
+ get linkedCommunityId() {
402
+ if (!this.raw.linkedCommunityId) return null;
403
+ return peerUtils.toggleChannelIdMark(this.raw.linkedCommunityId);
404
+ }
399
405
  /**
400
406
  * Create a mention for the user.
401
407
  *
@@ -223,6 +223,8 @@ export declare class User {
223
223
  get profileColors(): ChatColors | null;
224
224
  /** If this user has paid messages enabled, price of one message in stars */
225
225
  get paidMessagePrice(): tl.Long | null;
226
+ /** Marked ID of the community this user (bot) is linked to, if any */
227
+ get linkedCommunityId(): number | null;
226
228
  /**
227
229
  * Create a mention for the user.
228
230
  *
@@ -223,6 +223,8 @@ export declare class User {
223
223
  get profileColors(): ChatColors | null;
224
224
  /** If this user has paid messages enabled, price of one message in stars */
225
225
  get paidMessagePrice(): tl.Long | null;
226
+ /** Marked ID of the community this user (bot) is linked to, if any */
227
+ get linkedCommunityId(): number | null;
226
228
  /**
227
229
  * Create a mention for the user.
228
230
  *
@@ -1,4 +1,5 @@
1
1
  import { MtArgumentError } from "../../../types/errors.js";
2
+ import { toggleChannelIdMark } from "../../../utils/peer-utils.js";
2
3
  import { assertTypeIs } from "../../../utils/type-assertions.js";
3
4
  import { memoizeGetters } from "../../utils/memoize.js";
4
5
  import { MessageEntity as MessageEntity$2 } from "../messages/message-entity.js";
@@ -389,6 +390,11 @@ class User {
389
390
  get paidMessagePrice() {
390
391
  return this.raw.sendPaidMessagesStars ?? null;
391
392
  }
393
+ /** Marked ID of the community this user (bot) is linked to, if any */
394
+ get linkedCommunityId() {
395
+ if (!this.raw.linkedCommunityId) return null;
396
+ return toggleChannelIdMark(this.raw.linkedCommunityId);
397
+ }
392
398
  /**
393
399
  * Create a mention for the user.
394
400
  *
@@ -0,0 +1,27 @@
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 inspectable = require("../../utils/inspectable.cjs");
11
+ class DeleteEphemeralMessagesUpdate {
12
+ constructor(raw, _peers) {
13
+ this.raw = raw;
14
+ this._peers = _peers;
15
+ }
16
+ /** Chat where the messages were deleted */
17
+ get chat() {
18
+ return peer.parsePeer(this.raw.peer, this._peers);
19
+ }
20
+ /** IDs of the messages which were deleted */
21
+ get messageIds() {
22
+ return this.raw.ids;
23
+ }
24
+ }
25
+ const DeleteEphemeralMessagesUpdate$1 = /* @__PURE__ */ memoize.memoizeGetters(DeleteEphemeralMessagesUpdate, ["chat"]);
26
+ const DeleteEphemeralMessagesUpdate$2 = /* @__PURE__ */ inspectable.makeInspectable(DeleteEphemeralMessagesUpdate$1);
27
+ exports.DeleteEphemeralMessagesUpdate = DeleteEphemeralMessagesUpdate$2;
@@ -0,0 +1,15 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { Peer } from '../peers/peer.js';
3
+ import { PeersIndex } from '../peers/peers-index.js';
4
+ /**
5
+ * One or more ephemeral messages were deleted
6
+ */
7
+ export declare class DeleteEphemeralMessagesUpdate {
8
+ readonly raw: tl.RawUpdateDeleteEphemeralMessages;
9
+ readonly _peers: PeersIndex;
10
+ constructor(raw: tl.RawUpdateDeleteEphemeralMessages, _peers: PeersIndex);
11
+ /** Chat where the messages were deleted */
12
+ get chat(): Peer;
13
+ /** IDs of the messages which were deleted */
14
+ get messageIds(): number[];
15
+ }
@@ -0,0 +1,15 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { Peer } from '../peers/peer.js';
3
+ import { PeersIndex } from '../peers/peers-index.js';
4
+ /**
5
+ * One or more ephemeral messages were deleted
6
+ */
7
+ export declare class DeleteEphemeralMessagesUpdate {
8
+ readonly raw: tl.RawUpdateDeleteEphemeralMessages;
9
+ readonly _peers: PeersIndex;
10
+ constructor(raw: tl.RawUpdateDeleteEphemeralMessages, _peers: PeersIndex);
11
+ /** Chat where the messages were deleted */
12
+ get chat(): Peer;
13
+ /** IDs of the messages which were deleted */
14
+ get messageIds(): number[];
15
+ }
@@ -0,0 +1,22 @@
1
+ import { memoizeGetters } from "../../utils/memoize.js";
2
+ import { parsePeer } from "../peers/peer.js";
3
+ import { makeInspectable } from "../../utils/inspectable.js";
4
+ class DeleteEphemeralMessagesUpdate {
5
+ constructor(raw, _peers) {
6
+ this.raw = raw;
7
+ this._peers = _peers;
8
+ }
9
+ /** Chat where the messages were deleted */
10
+ get chat() {
11
+ return parsePeer(this.raw.peer, this._peers);
12
+ }
13
+ /** IDs of the messages which were deleted */
14
+ get messageIds() {
15
+ return this.raw.ids;
16
+ }
17
+ }
18
+ const DeleteEphemeralMessagesUpdate$1 = /* @__PURE__ */ memoizeGetters(DeleteEphemeralMessagesUpdate, ["chat"]);
19
+ const DeleteEphemeralMessagesUpdate$2 = /* @__PURE__ */ makeInspectable(DeleteEphemeralMessagesUpdate$1);
20
+ export {
21
+ DeleteEphemeralMessagesUpdate$2 as DeleteEphemeralMessagesUpdate
22
+ };
@@ -0,0 +1,69 @@
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 utils = require("@fuman/utils");
9
+ const memoize = require("../../utils/memoize.cjs");
10
+ const ephemeralMessage = require("../messages/ephemeral-message.cjs");
11
+ const peer = require("../peers/peer.cjs");
12
+ const user = require("../peers/user.cjs");
13
+ const inspectable = require("../../utils/inspectable.cjs");
14
+ class EphemeralCallbackQuery {
15
+ constructor(raw, _peers) {
16
+ this.raw = raw;
17
+ this._peers = _peers;
18
+ }
19
+ /** ID of this callback query */
20
+ get id() {
21
+ return this.raw.queryId;
22
+ }
23
+ /** User who has pressed the button */
24
+ get user() {
25
+ return new user.User(this._peers.user(this.raw.userId));
26
+ }
27
+ /**
28
+ * Chat where the originating ephemeral message was sent.
29
+ *
30
+ * `null` if not available (see {@link chatInstance})
31
+ */
32
+ get chat() {
33
+ return this.raw.peer ? peer.parsePeer(this.raw.peer, this._peers) : null;
34
+ }
35
+ /** Identifier uniquely corresponding to the chat the message was sent to, if any */
36
+ get chatInstance() {
37
+ return this.raw.chatInstance ?? null;
38
+ }
39
+ /** Identifier of the ephemeral message containing the button which was clicked */
40
+ get messageId() {
41
+ return this.raw.msgId;
42
+ }
43
+ /** The originating ephemeral message */
44
+ get message() {
45
+ return new ephemeralMessage.EphemeralMessage(this.raw.message, this._peers);
46
+ }
47
+ /**
48
+ * Data that was contained in the callback button.
49
+ *
50
+ * Note that this field is defined by the client, and a bad
51
+ * client can send arbitrary data in this field.
52
+ */
53
+ get data() {
54
+ return this.raw.data;
55
+ }
56
+ /**
57
+ * Data that was contained in the callback button,
58
+ * parsed as a UTF8 string
59
+ *
60
+ * Note that this field is defined by the client, and a bad
61
+ * client can send arbitrary data in this field.
62
+ */
63
+ get dataStr() {
64
+ return utils.utf8.decoder.decode(this.raw.data);
65
+ }
66
+ }
67
+ const EphemeralCallbackQuery$1 = /* @__PURE__ */ memoize.memoizeGetters(EphemeralCallbackQuery, ["user", "chat", "message", "dataStr"]);
68
+ const EphemeralCallbackQuery$2 = /* @__PURE__ */ inspectable.makeInspectable(EphemeralCallbackQuery$1);
69
+ exports.EphemeralCallbackQuery = EphemeralCallbackQuery$2;
@@ -0,0 +1,44 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { Peer } from '../peers/peer.js';
3
+ import { PeersIndex } from '../peers/peers-index.js';
4
+ import { EphemeralMessage } from '../messages/ephemeral-message.js';
5
+ import { User } from '../peers/user.js';
6
+ /**
7
+ * A callback query originating from an ephemeral message sent by the bot.
8
+ */
9
+ export declare class EphemeralCallbackQuery {
10
+ readonly raw: tl.RawUpdateEphemeralBotCallbackQuery;
11
+ readonly _peers: PeersIndex;
12
+ constructor(raw: tl.RawUpdateEphemeralBotCallbackQuery, _peers: PeersIndex);
13
+ /** ID of this callback query */
14
+ get id(): tl.Long;
15
+ /** User who has pressed the button */
16
+ get user(): User;
17
+ /**
18
+ * Chat where the originating ephemeral message was sent.
19
+ *
20
+ * `null` if not available (see {@link chatInstance})
21
+ */
22
+ get chat(): Peer | null;
23
+ /** Identifier uniquely corresponding to the chat the message was sent to, if any */
24
+ get chatInstance(): tl.Long | null;
25
+ /** Identifier of the ephemeral message containing the button which was clicked */
26
+ get messageId(): number;
27
+ /** The originating ephemeral message */
28
+ get message(): EphemeralMessage;
29
+ /**
30
+ * Data that was contained in the callback button.
31
+ *
32
+ * Note that this field is defined by the client, and a bad
33
+ * client can send arbitrary data in this field.
34
+ */
35
+ get data(): Uint8Array;
36
+ /**
37
+ * Data that was contained in the callback button,
38
+ * parsed as a UTF8 string
39
+ *
40
+ * Note that this field is defined by the client, and a bad
41
+ * client can send arbitrary data in this field.
42
+ */
43
+ get dataStr(): string;
44
+ }