@mtkruto/node 0.14.0 → 0.15.1

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 (131) hide show
  1. package/esm/3_types.d.ts +4 -0
  2. package/esm/3_types.d.ts.map +1 -1
  3. package/esm/3_types.js +4 -0
  4. package/esm/client/0_params.d.ts +16 -2
  5. package/esm/client/0_params.d.ts.map +1 -1
  6. package/esm/client/0_update_processor.d.ts +7 -0
  7. package/esm/client/0_update_processor.d.ts.map +1 -0
  8. package/esm/client/0_update_processor.js +1 -0
  9. package/esm/client/2_business_connection_manager.d.ts +3 -2
  10. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  11. package/esm/client/2_business_connection_manager.js +1 -1
  12. package/esm/client/2_gift_manager.d.ts +29 -0
  13. package/esm/client/2_gift_manager.d.ts.map +1 -0
  14. package/esm/client/2_gift_manager.js +62 -0
  15. package/esm/client/2_payment_manager.d.ts +3 -2
  16. package/esm/client/2_payment_manager.d.ts.map +1 -1
  17. package/esm/client/2_payment_manager.js +1 -1
  18. package/esm/client/2_reaction_manager.d.ts +3 -2
  19. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  20. package/esm/client/2_reaction_manager.js +1 -1
  21. package/esm/client/2_translations_manager.d.ts +3 -2
  22. package/esm/client/2_translations_manager.d.ts.map +1 -1
  23. package/esm/client/2_translations_manager.js +1 -1
  24. package/esm/client/3_message_manager.d.ts +8 -25
  25. package/esm/client/3_message_manager.d.ts.map +1 -1
  26. package/esm/client/3_message_manager.js +26 -238
  27. package/esm/client/3_video_chat_manager.d.ts +3 -2
  28. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  29. package/esm/client/3_video_chat_manager.js +1 -1
  30. package/esm/client/4_callback_query_manager.d.ts +3 -2
  31. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  32. package/esm/client/4_callback_query_manager.js +1 -1
  33. package/esm/client/4_chat_list_manager.d.ts +4 -3
  34. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  35. package/esm/client/4_chat_list_manager.js +2 -1
  36. package/esm/client/4_chat_manager.d.ts +61 -0
  37. package/esm/client/4_chat_manager.d.ts.map +1 -0
  38. package/esm/client/4_chat_manager.js +293 -0
  39. package/esm/client/4_inline_query_manager.d.ts +3 -2
  40. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  41. package/esm/client/4_inline_query_manager.js +1 -1
  42. package/esm/client/4_poll_manager.d.ts +3 -2
  43. package/esm/client/4_poll_manager.d.ts.map +1 -1
  44. package/esm/client/4_poll_manager.js +1 -1
  45. package/esm/client/4_story_manager.d.ts +3 -2
  46. package/esm/client/4_story_manager.d.ts.map +1 -1
  47. package/esm/client/4_story_manager.js +1 -1
  48. package/esm/client/5_client.d.ts +33 -6
  49. package/esm/client/5_client.d.ts.map +1 -1
  50. package/esm/client/5_client.js +163 -71
  51. package/esm/types/1_sticker.d.ts +1 -0
  52. package/esm/types/1_sticker.d.ts.map +1 -1
  53. package/esm/types/1_sticker.js +6 -2
  54. package/esm/types/2_gift_upgraded_component.d.ts +95 -0
  55. package/esm/types/2_gift_upgraded_component.d.ts.map +1 -0
  56. package/esm/types/2_gift_upgraded_component.js +88 -0
  57. package/esm/types/3_gift.d.ts +84 -0
  58. package/esm/types/3_gift.d.ts.map +1 -0
  59. package/esm/types/3_gift.js +90 -0
  60. package/esm/types/4_user_gift.d.ts +44 -0
  61. package/esm/types/4_user_gift.d.ts.map +1 -0
  62. package/esm/types/4_user_gift.js +43 -0
  63. package/esm/types/5_user_gifts.d.ts +32 -0
  64. package/esm/types/5_user_gifts.d.ts.map +1 -0
  65. package/esm/types/5_user_gifts.js +29 -0
  66. package/package.json +1 -1
  67. package/script/3_types.d.ts +4 -0
  68. package/script/3_types.d.ts.map +1 -1
  69. package/script/3_types.js +4 -0
  70. package/script/client/0_params.d.ts +16 -2
  71. package/script/client/0_params.d.ts.map +1 -1
  72. package/script/client/0_update_processor.d.ts +7 -0
  73. package/script/client/0_update_processor.d.ts.map +1 -0
  74. package/script/client/0_update_processor.js +2 -0
  75. package/script/client/2_business_connection_manager.d.ts +3 -2
  76. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  77. package/script/client/2_business_connection_manager.js +1 -1
  78. package/script/client/2_gift_manager.d.ts +29 -0
  79. package/script/client/2_gift_manager.d.ts.map +1 -0
  80. package/script/client/2_gift_manager.js +66 -0
  81. package/script/client/2_payment_manager.d.ts +3 -2
  82. package/script/client/2_payment_manager.d.ts.map +1 -1
  83. package/script/client/2_payment_manager.js +1 -1
  84. package/script/client/2_reaction_manager.d.ts +3 -2
  85. package/script/client/2_reaction_manager.d.ts.map +1 -1
  86. package/script/client/2_reaction_manager.js +1 -1
  87. package/script/client/2_translations_manager.d.ts +3 -2
  88. package/script/client/2_translations_manager.d.ts.map +1 -1
  89. package/script/client/2_translations_manager.js +1 -1
  90. package/script/client/3_message_manager.d.ts +8 -25
  91. package/script/client/3_message_manager.d.ts.map +1 -1
  92. package/script/client/3_message_manager.js +23 -235
  93. package/script/client/3_video_chat_manager.d.ts +3 -2
  94. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  95. package/script/client/3_video_chat_manager.js +1 -1
  96. package/script/client/4_callback_query_manager.d.ts +3 -2
  97. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  98. package/script/client/4_callback_query_manager.js +1 -1
  99. package/script/client/4_chat_list_manager.d.ts +4 -3
  100. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  101. package/script/client/4_chat_list_manager.js +2 -1
  102. package/script/client/4_chat_manager.d.ts +61 -0
  103. package/script/client/4_chat_manager.d.ts.map +1 -0
  104. package/script/client/4_chat_manager.js +297 -0
  105. package/script/client/4_inline_query_manager.d.ts +3 -2
  106. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  107. package/script/client/4_inline_query_manager.js +1 -1
  108. package/script/client/4_poll_manager.d.ts +3 -2
  109. package/script/client/4_poll_manager.d.ts.map +1 -1
  110. package/script/client/4_poll_manager.js +1 -1
  111. package/script/client/4_story_manager.d.ts +3 -2
  112. package/script/client/4_story_manager.d.ts.map +1 -1
  113. package/script/client/4_story_manager.js +1 -1
  114. package/script/client/5_client.d.ts +33 -6
  115. package/script/client/5_client.d.ts.map +1 -1
  116. package/script/client/5_client.js +163 -71
  117. package/script/types/1_sticker.d.ts +1 -0
  118. package/script/types/1_sticker.d.ts.map +1 -1
  119. package/script/types/1_sticker.js +7 -2
  120. package/script/types/2_gift_upgraded_component.d.ts +95 -0
  121. package/script/types/2_gift_upgraded_component.d.ts.map +1 -0
  122. package/script/types/2_gift_upgraded_component.js +91 -0
  123. package/script/types/3_gift.d.ts +84 -0
  124. package/script/types/3_gift.d.ts.map +1 -0
  125. package/script/types/3_gift.js +95 -0
  126. package/script/types/4_user_gift.d.ts +44 -0
  127. package/script/types/4_user_gift.d.ts.map +1 -0
  128. package/script/types/4_user_gift.js +46 -0
  129. package/script/types/5_user_gifts.d.ts +32 -0
  130. package/script/types/5_user_gifts.d.ts.map +1 -0
  131. package/script/types/5_user_gifts.js +32 -0
@@ -0,0 +1,297 @@
1
+ "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2025 Roj <https://roj.im/>
5
+ *
6
+ * This file is part of MTKruto.
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU Lesser General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public License
19
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+ */
21
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
+ if (kind === "m") throw new TypeError("Private method is not writable");
23
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
+ };
27
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
29
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
+ };
32
+ var _ChatManager_instances, _ChatManager_c, _ChatManager_toggleJoinRequests;
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.ChatManager = void 0;
35
+ const _0_deps_js_1 = require("../0_deps.js");
36
+ const _0_errors_js_1 = require("../0_errors.js");
37
+ const _1_utilities_js_1 = require("../1_utilities.js");
38
+ const _2_tl_js_1 = require("../2_tl.js");
39
+ const _3_types_js_1 = require("../3_types.js");
40
+ const _3_types_js_2 = require("../3_types.js");
41
+ const _0_utilities_js_1 = require("./0_utilities.js");
42
+ const chatManagerUpdates = [
43
+ "updateChannelParticipant",
44
+ "updateChatParticipant",
45
+ "updateBotChatInviteRequester",
46
+ ];
47
+ class ChatManager {
48
+ constructor(c) {
49
+ _ChatManager_instances.add(this);
50
+ _ChatManager_c.set(this, void 0);
51
+ __classPrivateFieldSet(this, _ChatManager_c, c, "f");
52
+ }
53
+ canHandleUpdate(update) {
54
+ return (0, _2_tl_js_1.isOneOf)(chatManagerUpdates, update);
55
+ }
56
+ async handleUpdate(update) {
57
+ if ((0, _2_tl_js_1.is)("updateChannelParticipant", update) || (0, _2_tl_js_1.is)("updateChatParticipant", update)) {
58
+ const chatMember = await (0, _3_types_js_1.constructChatMemberUpdated)(update, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity);
59
+ const selfId = await __classPrivateFieldGet(this, _ChatManager_c, "f").getSelfId();
60
+ if (chatMember.oldChatMember.user.id == selfId) {
61
+ return { myChatMember: chatMember };
62
+ }
63
+ else {
64
+ return { chatMember };
65
+ }
66
+ }
67
+ if ((0, _2_tl_js_1.is)("updateBotChatInviteRequester", update)) {
68
+ const joinRequest = await (0, _3_types_js_1.constructJoinRequest)(update, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity);
69
+ return { joinRequest };
70
+ }
71
+ return null;
72
+ }
73
+ async approveJoinRequest(chatId, userId) {
74
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
75
+ _: "messages.hideChatJoinRequest",
76
+ peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
77
+ user_id: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId),
78
+ approved: true,
79
+ });
80
+ }
81
+ async declineJoinRequest(chatId, userId) {
82
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
83
+ _: "messages.hideChatJoinRequest",
84
+ peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
85
+ user_id: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId),
86
+ });
87
+ }
88
+ async approveJoinRequests(chatId, params) {
89
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("approveJoinRequests");
90
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
91
+ _: "messages.hideAllChatJoinRequests",
92
+ peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
93
+ approved: true,
94
+ link: params?.inviteLink,
95
+ });
96
+ }
97
+ async declineJoinRequests(chatId, params) {
98
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("declineJoinRequests");
99
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
100
+ _: "messages.hideAllChatJoinRequests",
101
+ peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId),
102
+ link: params?.inviteLink,
103
+ });
104
+ }
105
+ // INVITE LINKS //
106
+ async createInviteLink(chatId, params) {
107
+ if (params?.requireApproval && params?.limit) {
108
+ throw new _0_errors_js_1.InputError("requireApproval cannot be true while limit is specified.");
109
+ }
110
+ const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.exportChatInvite", peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId), title: params?.title, expire_date: params?.expireAt ? (0, _1_utilities_js_1.toUnixTimestamp)(params.expireAt) : undefined, request_needed: params?.requireApproval ? true : undefined, usage_limit: params?.limit });
111
+ return await (0, _3_types_js_1.constructInviteLink)((0, _2_tl_js_1.as)("chatInviteExported", result), __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity);
112
+ }
113
+ async getCreatedInviteLinks(chatId, params) {
114
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("getCreatedInviteLinks");
115
+ const { invites } = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.getExportedChatInvites", peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId), revoked: params?.revoked ? true : undefined, admin_id: params?.by ? await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(params.by) : { _: "inputUserEmpty" }, limit: params?.limit ?? 100, offset_date: params?.afterDate ? (0, _1_utilities_js_1.toUnixTimestamp)(params.afterDate) : undefined, offset_link: params?.afterInviteLink });
116
+ return await Promise.all(invites.map((v) => (0, _2_tl_js_1.as)("chatInviteExported", v)).map((v) => (0, _3_types_js_1.constructInviteLink)(v, __classPrivateFieldGet(this, _ChatManager_c, "f").getEntity)));
117
+ }
118
+ // JOINING AND LEAVING CHATS //
119
+ async joinChat(chatId) {
120
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("joinChat");
121
+ const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
122
+ if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
123
+ throw new _0_errors_js_1.InputError("Cannot join private chats.");
124
+ }
125
+ else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
126
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.joinChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
127
+ }
128
+ else if ((0, _2_tl_js_1.is)("inputPeerChat", peer)) {
129
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.addChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" }, fwd_limit: 0 }); // TODO: use potential high-level method for adding participants to chats
130
+ }
131
+ else {
132
+ (0, _0_deps_js_1.unreachable)();
133
+ }
134
+ }
135
+ async leaveChat(chatId) {
136
+ const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
137
+ if ((0, _0_utilities_js_1.canBeInputUser)(peer)) {
138
+ throw new _0_errors_js_1.InputError("Cannot leave private chats.");
139
+ }
140
+ else if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
141
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.leaveChannel", channel: (0, _0_utilities_js_1.toInputChannel)(peer) });
142
+ }
143
+ else if ((0, _2_tl_js_1.is)("inputPeerChat", peer)) {
144
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: peer.chat_id, user_id: { _: "inputUserSelf" } }); // TODO: use potential high-level method for adding participants to chats
145
+ }
146
+ else {
147
+ (0, _0_deps_js_1.unreachable)();
148
+ }
149
+ }
150
+ // RESTRICTING, BANNING, AND UNBANNING CHAT MEMBERS //
151
+ async banChatMember(chatId, memberId, params) {
152
+ const chat = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
153
+ if (!((0, _2_tl_js_1.is)("inputPeerChannel", chat)) && !((0, _2_tl_js_1.is)("inputPeerChat", chat))) {
154
+ throw new _0_errors_js_1.InputError("Expected a channel, supergroup, or group ID.");
155
+ }
156
+ const member = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(memberId);
157
+ if ((0, _2_tl_js_1.is)("inputPeerChannel", chat)) {
158
+ if (params?.deleteMessages) {
159
+ try {
160
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").messageManager.deleteChatMemberMessages(chatId, memberId);
161
+ }
162
+ catch {
163
+ //
164
+ }
165
+ }
166
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({
167
+ _: "channels.editBanned",
168
+ channel: { ...chat, _: "inputChannel" },
169
+ participant: member,
170
+ banned_rights: ({
171
+ _: "chatBannedRights",
172
+ until_date: params?.untilDate ? (0, _1_utilities_js_1.toUnixTimestamp)(params.untilDate) : 0,
173
+ view_messages: true,
174
+ send_messages: true,
175
+ send_media: true,
176
+ send_stickers: true,
177
+ send_gifs: true,
178
+ send_games: true,
179
+ send_inline: true,
180
+ embed_links: true,
181
+ }),
182
+ });
183
+ }
184
+ else if ((0, _2_tl_js_1.is)("inputPeerChat", chat)) {
185
+ if (!(0, _0_utilities_js_1.canBeInputUser)(member)) {
186
+ throw new _0_errors_js_1.InputError(`Invalid user ID: ${memberId}`);
187
+ }
188
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.deleteChatUser", chat_id: chat.chat_id, user_id: (0, _0_utilities_js_1.toInputUser)(member), revoke_history: params?.deleteMessages ? true : undefined });
189
+ }
190
+ }
191
+ async unbanChatMember(chatId, memberId) {
192
+ const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
193
+ const member = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(memberId);
194
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: ({ _: "chatBannedRights", until_date: 0 }) });
195
+ }
196
+ async setChatMemberRights(chatId, memberId, params) {
197
+ const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
198
+ const member = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(memberId);
199
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editBanned", channel, participant: member, banned_rights: (0, _3_types_js_2.chatMemberRightsToTlObject)(params?.rights, params?.untilDate) });
200
+ }
201
+ // CHAT SETTINGS //
202
+ async setAvailableReactions(chatId, availableReactions) {
203
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.setChatAvailableReactions", peer: await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId), available_reactions: availableReactions == "none" ? { _: "chatReactionsNone" } : availableReactions == "all" ? { _: "chatReactionsAll" } : Array.isArray(availableReactions) ? ({ _: "chatReactionsSome", reactions: availableReactions.map((v) => (0, _3_types_js_2.reactionToTlObject)(v)) }) : (0, _0_deps_js_1.unreachable)() });
204
+ }
205
+ async setBoostsRequiredToCircumventRestrictions(chatId, boosts) {
206
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("setBoostsRequiredToCircumventRestrictions");
207
+ const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
208
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setBoostsToUnblockRestrictions", channel, boosts });
209
+ }
210
+ async enableJoinRequests(chatId) {
211
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("enableJoinRequests");
212
+ await __classPrivateFieldGet(this, _ChatManager_instances, "m", _ChatManager_toggleJoinRequests).call(this, chatId, true);
213
+ }
214
+ async disableJoinRequests(chatId) {
215
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("disableJoinRequests");
216
+ await __classPrivateFieldGet(this, _ChatManager_instances, "m", _ChatManager_toggleJoinRequests).call(this, chatId, false);
217
+ }
218
+ async setChatStickerSet(chatId, setName) {
219
+ const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
220
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetShortName", short_name: setName } });
221
+ }
222
+ async deleteChatStickerSet(chatId) {
223
+ const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
224
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.setStickers", channel, stickerset: { _: "inputStickerSetEmpty" } });
225
+ }
226
+ // CHAT PHOTOS //
227
+ async deleteChatPhoto(chatId) {
228
+ const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
229
+ if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !((0, _2_tl_js_1.is)("inputPeerChat", peer))) {
230
+ (0, _0_deps_js_1.unreachable)();
231
+ }
232
+ if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
233
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: { _: "inputChatPhotoEmpty" } });
234
+ }
235
+ else if ((0, _2_tl_js_1.is)("inputPeerChat", peer)) {
236
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: { _: "inputChatPhotoEmpty" } });
237
+ }
238
+ }
239
+ async setChatPhoto(chatId, photo, params) {
240
+ const peer = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
241
+ if (!((0, _0_utilities_js_1.canBeInputChannel)(peer)) && !((0, _2_tl_js_1.is)("inputPeerChat", peer))) {
242
+ (0, _0_deps_js_1.unreachable)();
243
+ }
244
+ const file = await __classPrivateFieldGet(this, _ChatManager_c, "f").fileManager.upload(photo, params);
245
+ const photo_ = { _: "inputChatUploadedPhoto", file };
246
+ if ((0, _0_utilities_js_1.canBeInputChannel)(peer)) {
247
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.editPhoto", channel: (0, _0_utilities_js_1.toInputChannel)(peer), photo: photo_ });
248
+ }
249
+ else if ((0, _2_tl_js_1.is)("inputPeerChat", peer)) {
250
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.editChatPhoto", chat_id: peer.chat_id, photo: photo_ });
251
+ }
252
+ }
253
+ // INVITING MEMBERS //
254
+ async addChatMember(chatId, userId, params) {
255
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("addChatMember");
256
+ const chat = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
257
+ if ((0, _2_tl_js_1.isOneOf)(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
258
+ throw new _0_errors_js_1.InputError("Cannot add members to private chats");
259
+ }
260
+ const user = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId);
261
+ if ((0, _2_tl_js_1.is)("inputPeerChat", chat)) {
262
+ const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "messages.addChatUser", chat_id: chat.chat_id, user_id: user, fwd_limit: params?.historyLimit ?? 0 });
263
+ return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
264
+ }
265
+ else if ((0, _2_tl_js_1.is)("inputPeerChannel", chat)) {
266
+ const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.inviteToChannel", channel: { ...chat, _: "inputChannel" }, users: [user] });
267
+ return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
268
+ }
269
+ (0, _0_deps_js_1.unreachable)();
270
+ }
271
+ async addChatMembers(chatId, userIds) {
272
+ __classPrivateFieldGet(this, _ChatManager_c, "f").storage.assertUser("addChatMembers");
273
+ const chat = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputPeer(chatId);
274
+ if ((0, _2_tl_js_1.isOneOf)(["inputPeerEmpty", "inputPeerSelf", "inputPeerUser", "inputPeerUserFromMessage"], chat)) {
275
+ throw new _0_errors_js_1.InputError("Cannot add members to private chats");
276
+ }
277
+ const users = new Array();
278
+ for (const userId of userIds) {
279
+ users.push(await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputUser(userId));
280
+ }
281
+ if ((0, _2_tl_js_1.is)("inputPeerChat", chat)) {
282
+ throw new _0_errors_js_1.InputError("addChatMembers cannot be used with basic groups");
283
+ }
284
+ else if ((0, _0_utilities_js_1.canBeInputChannel)(chat)) {
285
+ const result = await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.inviteToChannel", channel: (0, _0_utilities_js_1.toInputChannel)(chat), users });
286
+ return result.missing_invitees.map(_3_types_js_1.constructFailedInvitation);
287
+ }
288
+ (0, _0_deps_js_1.unreachable)();
289
+ }
290
+ }
291
+ exports.ChatManager = ChatManager;
292
+ _ChatManager_c = new WeakMap(), _ChatManager_instances = new WeakSet(), _ChatManager_toggleJoinRequests =
293
+ // JOIN REQUESTS //
294
+ async function _ChatManager_toggleJoinRequests(chatId, enabled) {
295
+ const channel = await __classPrivateFieldGet(this, _ChatManager_c, "f").getInputChannel(chatId);
296
+ await __classPrivateFieldGet(this, _ChatManager_c, "f").invoke({ _: "channels.toggleJoinRequest", channel, enabled });
297
+ };
@@ -20,6 +20,7 @@
20
20
  import { Api } from "../2_tl.js";
21
21
  import { ID, InlineQueryResult, Update } from "../3_types.js";
22
22
  import { AnswerInlineQueryParams, SendInlineQueryParams } from "./0_params.js";
23
+ import { UpdateProcessor } from "./0_update_processor.js";
23
24
  import { C as C_ } from "./1_types.js";
24
25
  import { MessageManager } from "./3_message_manager.js";
25
26
  type C = C_ & {
@@ -27,11 +28,11 @@ type C = C_ & {
27
28
  };
28
29
  declare const inlineQueryManagerUpdates: readonly ["updateBotInlineQuery", "updateBotInlineSend"];
29
30
  type InlineQueryManagerUpdate = Api.Types[(typeof inlineQueryManagerUpdates)[number]];
30
- export declare class InlineQueryManager {
31
+ export declare class InlineQueryManager implements UpdateProcessor<InlineQueryManagerUpdate> {
31
32
  #private;
32
33
  constructor(c: C);
33
34
  answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
34
- static canHandleUpdate(update: Api.Update): update is InlineQueryManagerUpdate;
35
+ canHandleUpdate(update: Api.Update): update is InlineQueryManagerUpdate;
35
36
  handleUpdate(update: InlineQueryManagerUpdate): Promise<Update>;
36
37
  sendInlineQuery(userId: ID, chatId: ID, params?: SendInlineQueryParams): Promise<import("../3_types.js").InlineQueryAnswer>;
37
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"4_inline_query_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_inline_query_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAe,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAiF,EAAE,EAAE,iBAAiB,EAA+B,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1K,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,CAAC,GAAG,EAAE,GAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAEjD,QAAA,MAAM,yBAAyB,0DAGrB,CAAC;AAEX,KAAK,wBAAwB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEtF,qBAAa,kBAAkB;;gBAGjB,CAAC,EAAE,CAAC;IAIV,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,MAAM,CAAC,EAAE,uBAAuB;IAMlG,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,wBAAwB;IAIxE,YAAY,CAAC,MAAM,EAA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EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,qBAAqB;CAsB7E"}
@@ -50,7 +50,7 @@ class InlineQueryManager {
50
50
  (0, _0_utilities_js_1.checkInlineQueryId)(id);
51
51
  await __classPrivateFieldGet(this, _InlineQueryManager_c, "f").invoke({ _: "messages.setInlineBotResults", query_id: BigInt(id), results: await Promise.all(results.map((v) => (0, _3_types_js_1.inlineQueryResultToTlObject)(v, __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.parseText.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager), __classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager.usernameResolver.bind(__classPrivateFieldGet(this, _InlineQueryManager_c, "f").messageManager)))), cache_time: params?.cacheTime ?? 300, private: params?.isPersonal ? true : undefined, switch_webview: params?.button && params.button.miniApp ? ({ _: "inlineBotWebView", text: params.button.text, url: params.button.miniApp.url }) : undefined, switch_pm: params?.button && params.button.startParameter ? ({ _: "inlineBotSwitchPM", text: params.button.text, start_param: params.button.startParameter }) : undefined, gallery: params?.isGallery ? true : undefined, next_offset: params?.nextOffset });
52
52
  }
53
- static canHandleUpdate(update) {
53
+ canHandleUpdate(update) {
54
54
  return (0, _2_tl_js_1.isOneOf)(inlineQueryManagerUpdates, update);
55
55
  }
56
56
  async handleUpdate(update) {
@@ -19,6 +19,7 @@
19
19
  */
20
20
  import { Api } from "../2_tl.js";
21
21
  import { ID, Update } from "../3_types.js";
22
+ import { UpdateProcessor } from "./0_update_processor.js";
22
23
  import { C as C_ } from "./1_types.js";
23
24
  import { MessageManager } from "./3_message_manager.js";
24
25
  type C = C_ & {
@@ -26,12 +27,12 @@ type C = C_ & {
26
27
  };
27
28
  declare const pollManagerUpdates: readonly ["updateMessagePoll"];
28
29
  type PollManagerUpdate = Api.Types[(typeof pollManagerUpdates)[number]];
29
- export declare class PollManager {
30
+ export declare class PollManager implements UpdateProcessor<PollManagerUpdate> {
30
31
  #private;
31
32
  constructor(c: C);
32
33
  vote(chatId: ID, messageId: number, optionIndexes: number[]): Promise<void>;
33
34
  retractVote(chatId: ID, messageId: number): Promise<void>;
34
- static canHandleUpdate(update: Api.Update): update is PollManagerUpdate;
35
+ canHandleUpdate(update: Api.Update): update is PollManagerUpdate;
35
36
  handleUpdate(update: PollManagerUpdate): Promise<Update | null>;
36
37
  }
37
38
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"4_poll_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_poll_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAkD,MAAM,YAAY,CAAC;AACjF,OAAO,EAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,CAAC,GAAG,EAAE,GAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAEjD,QAAA,MAAM,kBAAkB,gCAEd,CAAC;AAEX,KAAK,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAExE,qBAAa,WAAW;;gBAGV,CAAC,EAAE,CAAC;IAIV,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE;IAQ3D,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM;IAwC/C,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,iBAAiB;IAIjE,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAgBtE"}
1
+ {"version":3,"file":"4_poll_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_poll_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,GAAG,EAAkD,MAAM,YAAY,CAAC;AACjF,OAAO,EAAiB,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,KAAK,CAAC,GAAG,EAAE,GAAG;IAAE,cAAc,EAAE,cAAc,CAAA;CAAE,CAAC;AAEjD,QAAA,MAAM,kBAAkB,gCAEd,CAAC;AAEX,KAAK,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAExE,qBAAa,WAAY,YAAW,eAAe,CAAC,iBAAiB,CAAC;;gBAGxD,CAAC,EAAE,CAAC;IAIV,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE;IAQ3D,WAAW,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM;IAwC/C,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,iBAAiB;IAI1D,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAgBtE"}
@@ -56,7 +56,7 @@ class PollManager {
56
56
  __classPrivateFieldGet(this, _PollManager_c, "f").storage.assertUser("retractVote");
57
57
  await __classPrivateFieldGet(this, _PollManager_instances, "m", _PollManager_voteInner).call(this, chatId, messageId, []);
58
58
  }
59
- static canHandleUpdate(update) {
59
+ canHandleUpdate(update) {
60
60
  return (0, _2_tl_js_1.isOneOf)(pollManagerUpdates, update);
61
61
  }
62
62
  async handleUpdate(update) {
@@ -21,6 +21,7 @@ import { Api } from "../2_tl.js";
21
21
  import { ID, Story, Update } from "../3_types.js";
22
22
  import { InputStoryContent } from "../types/1_input_story_content.js";
23
23
  import { CreateStoryParams } from "./0_params.js";
24
+ import { UpdateProcessor } from "./0_update_processor.js";
24
25
  import { C as C_ } from "./1_types.js";
25
26
  import { FileManager } from "./2_file_manager.js";
26
27
  import { MessageManager } from "./3_message_manager.js";
@@ -30,7 +31,7 @@ type C = C_ & {
30
31
  };
31
32
  declare const storyManagerUpdates: readonly ["updateStory"];
32
33
  type StoryManagerUpdate = Api.Types[(typeof storyManagerUpdates)[number]];
33
- export declare class StoryManager {
34
+ export declare class StoryManager implements UpdateProcessor<StoryManagerUpdate> {
34
35
  #private;
35
36
  constructor(c: C);
36
37
  createStory(chatId: ID, content: InputStoryContent, params?: CreateStoryParams): Promise<Story>;
@@ -42,7 +43,7 @@ export declare class StoryManager {
42
43
  addStoryToHighlights(chatId: ID, storyId: number): Promise<void>;
43
44
  removeStoriesFromHighlights(chatId: ID, storyIds: number[]): Promise<void>;
44
45
  removeStoryFromHighlights(chatId: ID, storyId: number): Promise<void>;
45
- static canHandleUpdate(update: Api.Update): update is StoryManagerUpdate;
46
+ canHandleUpdate(update: Api.Update): update is StoryManagerUpdate;
46
47
  handleUpdate(update: StoryManagerUpdate): Promise<Update | null>;
47
48
  }
48
49
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"4_story_manager.d.ts","sourceRoot":"","sources":["../../src/client/4_story_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAkD,MAAM,YAAY,CAAC;AACjF,OAAO,EAA4B,EAAE,EAAE,KAAK,EAA0D,MAAM,EAAE,MAAM,eAAe,CAAC;AACpI,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,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,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM;IAWvC,sBAAsB,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE;IAKrD,oBAAoB,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM;IAKhD,2BAA2B,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE;IAK1D,yBAAyB,CAAC,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM;IAK3D,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,kBAAkB;IAI3D,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAYvE"}
@@ -131,7 +131,7 @@ class StoryManager {
131
131
  __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("removeStoryFromHighlights");
132
132
  await this.removeStoriesFromHighlights(chatId, [storyId]);
133
133
  }
134
- static canHandleUpdate(update) {
134
+ canHandleUpdate(update) {
135
135
  return (0, _2_tl_js_1.isOneOf)(storyManagerUpdates, update);
136
136
  }
137
137
  async handleUpdate(update) {
@@ -21,9 +21,9 @@ import { MaybePromise } from "../1_utilities.js";
21
21
  import { Storage } from "../2_storage.js";
22
22
  import { Api } from "../2_tl.js";
23
23
  import { DC } from "../3_transport.js";
24
- import { BotCommand, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatListItem, ChatMember, ChatP, type ChatPChannel, type ChatPGroup, type ChatPSupergroup, FailedInvitation, FileSource, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageInvoice, MessageLocation, MessagePhoto, MessagePoll, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Poll, PriceTag, Reaction, Sticker, Story, Translation, Update, User, VideoChat, VideoChatActive, VideoChatScheduled } from "../3_types.js";
24
+ import { BotCommand, BusinessConnection, CallbackQueryAnswer, CallbackQueryQuestion, Chat, ChatAction, ChatListItem, ChatMember, ChatP, type ChatPChannel, type ChatPGroup, type ChatPSupergroup, FailedInvitation, FileSource, Gift, ID, InactiveChat, InlineQueryAnswer, InlineQueryResult, InputMedia, InputStoryContent, InviteLink, LiveStreamChannel, Message, MessageAnimation, MessageAudio, MessageContact, MessageDice, MessageDocument, MessageInvoice, MessageLocation, MessagePhoto, MessagePoll, MessageSticker, MessageText, MessageVenue, MessageVideo, MessageVideoNote, MessageVoice, NetworkStatistics, ParseMode, Poll, PriceTag, Reaction, Sticker, Story, Translation, Update, User, UserGifts, VideoChat, VideoChatActive, VideoChatScheduled } from "../3_types.js";
25
25
  import { Migrate } from "../4_errors.js";
26
- import { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, type CreateChannelParams, type CreateGroupParams, CreateInviteLinkParams, CreateStoryParams, type CreateSupergroupParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamChunkParams, DownloadParams, EditInlineMessageMediaParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageParams, EditMessageReplyMarkupParams, ForwardMessagesParams, GetChatMembersParams, GetChatsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, GetTranslationsParams, JoinVideoChatParams, PinMessageParams, ReplyParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetEmojiStatusParams, SetMyCommandsParams, SetReactionsParams, SignInParams, type StartBotParams, StartVideoChatParams, StopPollParams, UnpinMessageParams, UpdateProfileParams } from "./0_params.js";
26
+ import { AddChatMemberParams, AddContactParams, AddReactionParams, AnswerCallbackQueryParams, AnswerInlineQueryParams, AnswerPreCheckoutQueryParams, ApproveJoinRequestsParams, BanChatMemberParams, type CreateChannelParams, type CreateGroupParams, CreateInviteLinkParams, CreateStoryParams, type CreateSupergroupParams, DeclineJoinRequestsParams, DeleteMessageParams, DeleteMessagesParams, DownloadLiveStreamChunkParams, DownloadParams, EditInlineMessageCaptionParams, EditInlineMessageMediaParams, EditInlineMessageTextParams, EditMessageCaptionParams, EditMessageLiveLocationParams, EditMessageMediaParams, EditMessageReplyMarkupParams, EditMessageTextParams, ForwardMessagesParams, GetChatMembersParams, GetChatsParams, GetCommonChatsParams, GetCreatedInviteLinksParams, GetHistoryParams, GetMyCommandsParams, GetTranslationsParams, GetUserGiftsParams, JoinVideoChatParams, PinMessageParams, ReplyParams, ScheduleVideoChatParams, SearchMessagesParams, SendAnimationParams, SendAudioParams, SendContactParams, SendDiceParams, SendDocumentParams, SendInlineQueryParams, SendInvoiceParams, SendLocationParams, SendMediaGroupParams, SendMessageParams, SendPhotoParams, SendPollParams, SendStickerParams, SendVenueParams, SendVideoNoteParams, SendVideoParams, SendVoiceParams, SetChatMemberRightsParams, SetChatPhotoParams, SetEmojiStatusParams, SetMyCommandsParams, SetReactionsParams, SignInParams, type StartBotParams, StartVideoChatParams, StopPollParams, UnpinMessageParams, UpdateProfileParams } from "./0_params.js";
27
27
  import { StorageOperations } from "./0_storage_operations.js";
28
28
  import { ClientPlainParams } from "./1_client_plain.js";
29
29
  import { Composer as Composer_, Middleware, MiddlewareFn, MiddlewareObj, NextFunction } from "./1_composer.js";
@@ -96,13 +96,21 @@ export interface Context {
96
96
  messageThreadId?: number;
97
97
  }) => Promise<void>;
98
98
  /** Context-aware alias for `client.editInlineMessageText()`. */
99
- editInlineMessageText: (text: string, params?: EditMessageParams) => Promise<void>;
99
+ editInlineMessageText: (text: string, params?: EditInlineMessageTextParams) => Promise<void>;
100
+ /** Context-aware alias for `client.editInlineMessageCaption()`. */
101
+ editInlineMessageCaption: (params?: EditInlineMessageCaptionParams) => Promise<void>;
102
+ /** Context-aware alias for `client.editInlineMessageMedia()`. */
103
+ editInlineMessageMedia: (media: InputMedia, params?: EditInlineMessageMediaParams) => Promise<void>;
100
104
  /** Context-aware alias for `client.editInlineMessageLiveLocation()`. */
101
105
  editInlineMessageLiveLocation: (latitude: number, longitude: number, params?: EditMessageLiveLocationParams) => Promise<void>;
102
106
  /** Context-aware alias for `client.editInlineMessageReplyMarkup()`. */
103
107
  editInlineMessageReplyMarkup: (params?: EditMessageReplyMarkupParams) => Promise<void>;
104
108
  /** Context-aware alias for `client.editMessageText()`. */
105
- editMessageText: (messageId: number, text: string, params?: EditMessageParams) => Promise<MessageText>;
109
+ editMessageText: (messageId: number, text: string, params?: EditMessageTextParams) => Promise<MessageText>;
110
+ /** Context-aware alias for `client.editMessageCaption()`. */
111
+ editMessageCaption: (messageId: number, params?: EditMessageCaptionParams) => Promise<Message>;
112
+ /** Context-aware alias for `client.editMessageMedia()`. */
113
+ editMessageMedia: (messageId: number, media: InputMedia, params?: EditMessageMediaParams) => Promise<Message>;
106
114
  /** Context-aware alias for `client.editMessageLiveLocation()`. */
107
115
  editMessageLiveLocation: (messageId: number, latitude: number, longitude: number, params?: EditMessageLiveLocationParams) => Promise<MessageLocation>;
108
116
  /** Context-aware alias for `client.editMessageReplyMarkup()`. */
@@ -571,7 +579,7 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
571
579
  * @param text The new text of the message.
572
580
  * @returns The edited text message.
573
581
  */
574
- editMessageText(chatId: ID, messageId: number, text: string, params?: EditMessageParams): Promise<MessageText>;
582
+ editMessageText(chatId: ID, messageId: number, text: string, params?: EditMessageTextParams): Promise<MessageText>;
575
583
  /**
576
584
  * Edit a message's caption.
577
585
  *
@@ -607,7 +615,14 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
607
615
  * @param inlineMessageId The inline message's identifier.
608
616
  * @param text The new text of the message.
609
617
  */
610
- editInlineMessageText(inlineMessageId: string, text: string, params?: EditMessageParams): Promise<void>;
618
+ editInlineMessageText(inlineMessageId: string, text: string, params?: EditInlineMessageTextParams): Promise<void>;
619
+ /**
620
+ * Edit an inline message's caption. Bot-only.
621
+ *
622
+ * @method ms
623
+ * @param inlineMessageId The inline message's identifier.
624
+ */
625
+ editInlineMessageCaption(inlineMessageId: string, params?: EditInlineMessageCaptionParams): Promise<void>;
611
626
  /**
612
627
  * Edit a message's reply markup.
613
628
  *
@@ -1484,5 +1499,17 @@ export declare class Client<C extends Context = Context> extends Composer<C> {
1484
1499
  * @method ta
1485
1500
  */
1486
1501
  getTranslations(params?: GetTranslationsParams): Promise<Translation[]>;
1502
+ /**
1503
+ * Get available gifts.
1504
+ *
1505
+ * @method gf
1506
+ */
1507
+ getGifts(): Promise<Gift[]>;
1508
+ /**
1509
+ * Get gifts claimed by a specific user. User-only.
1510
+ *
1511
+ * @method gf
1512
+ */
1513
+ getUserGifts(userId: ID, params?: GetUserGiftsParams): Promise<UserGifts>;
1487
1514
  }
1488
1515
  //# sourceMappingURL=5_client.d.ts.map