@mtcute/core 0.29.6 → 0.30.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.
- package/client.cjs +8 -0
- package/client.js +8 -0
- package/highlevel/client.d.cts +23 -7
- package/highlevel/client.d.ts +23 -7
- package/highlevel/methods/bots/answer-bot-guest-chat-query.cjs +26 -0
- package/highlevel/methods/bots/answer-bot-guest-chat-query.d.cts +12 -0
- package/highlevel/methods/bots/answer-bot-guest-chat-query.d.ts +12 -0
- package/highlevel/methods/bots/answer-bot-guest-chat-query.js +21 -0
- package/highlevel/methods/chats/join-chat.cjs +38 -16
- package/highlevel/methods/chats/join-chat.d.cts +20 -6
- package/highlevel/methods/chats/join-chat.d.ts +20 -6
- package/highlevel/methods/chats/join-chat.js +38 -16
- package/highlevel/methods/chats/save-draft.d.cts +4 -1
- package/highlevel/methods/chats/save-draft.d.ts +4 -1
- package/highlevel/methods/messages/send-copy-group.cjs +5 -9
- package/highlevel/methods/messages/send-copy-group.js +5 -9
- package/highlevel/methods.d.cts +3 -0
- package/highlevel/methods.d.ts +3 -0
- package/highlevel/storage/service/peers.cjs +2 -0
- package/highlevel/storage/service/peers.js +2 -0
- package/highlevel/types/files/utils.d.cts +1 -1
- package/highlevel/types/files/utils.d.ts +1 -1
- package/highlevel/types/media/poll.cjs +14 -0
- package/highlevel/types/media/poll.d.cts +6 -0
- package/highlevel/types/media/poll.d.ts +6 -0
- package/highlevel/types/media/poll.js +14 -0
- package/highlevel/types/messages/index.d.cts +1 -0
- package/highlevel/types/messages/index.d.ts +1 -0
- package/highlevel/types/messages/message.cjs +15 -1
- package/highlevel/types/messages/message.d.cts +8 -0
- package/highlevel/types/messages/message.d.ts +8 -0
- package/highlevel/types/messages/message.js +15 -1
- package/highlevel/types/messages/rich-message.cjs +50 -0
- package/highlevel/types/messages/rich-message.d.cts +18 -0
- package/highlevel/types/messages/rich-message.d.ts +18 -0
- package/highlevel/types/messages/rich-message.js +45 -0
- package/highlevel/types/peers/chat-permissions.cjs +6 -0
- package/highlevel/types/peers/chat-permissions.d.cts +4 -0
- package/highlevel/types/peers/chat-permissions.d.ts +4 -0
- package/highlevel/types/peers/chat-permissions.js +6 -0
- package/highlevel/types/peers/full-chat.cjs +6 -0
- package/highlevel/types/peers/full-chat.d.cts +2 -0
- package/highlevel/types/peers/full-chat.d.ts +2 -0
- package/highlevel/types/peers/full-chat.js +6 -0
- package/highlevel/types/peers/user.cjs +8 -0
- package/highlevel/types/peers/user.d.cts +4 -0
- package/highlevel/types/peers/user.d.ts +4 -0
- package/highlevel/types/peers/user.js +8 -0
- package/highlevel/types/updates/bot-guest-chat-query.cjs +39 -0
- package/highlevel/types/updates/bot-guest-chat-query.d.cts +21 -0
- package/highlevel/types/updates/bot-guest-chat-query.d.ts +21 -0
- package/highlevel/types/updates/bot-guest-chat-query.js +34 -0
- package/highlevel/types/updates/index.d.cts +5 -1
- package/highlevel/types/updates/index.d.ts +5 -1
- package/highlevel/types/updates/parse-update.cjs +3 -0
- package/highlevel/types/updates/parse-update.js +3 -0
- package/highlevel/types/updates/user-typing-update.cjs +2 -0
- package/highlevel/types/updates/user-typing-update.js +2 -0
- package/highlevel/updates/manager.cjs +214 -3
- package/highlevel/updates/manager.d.cts +1 -0
- package/highlevel/updates/manager.d.ts +1 -0
- package/highlevel/updates/manager.js +214 -3
- package/highlevel/utils/inspectable.cjs +1 -0
- package/highlevel/utils/inspectable.d.cts +1 -0
- package/highlevel/utils/inspectable.d.ts +1 -0
- package/highlevel/utils/inspectable.js +1 -0
- package/index.cjs +4 -0
- package/index.js +4 -0
- package/methods.cjs +2 -0
- package/methods.js +2 -0
- package/network/flood-control.cjs +149 -0
- package/network/flood-control.d.cts +79 -0
- package/network/flood-control.d.ts +79 -0
- package/network/flood-control.js +144 -0
- package/network/flood-control.test.d.cts +1 -0
- package/network/flood-control.test.d.ts +1 -0
- package/network/mtproto-session.cjs +1 -21
- package/network/mtproto-session.d.cts +1 -5
- package/network/mtproto-session.d.ts +1 -5
- package/network/mtproto-session.js +2 -22
- package/network/multi-session-connection.cjs +26 -16
- package/network/multi-session-connection.d.cts +1 -1
- package/network/multi-session-connection.d.ts +1 -1
- package/network/multi-session-connection.js +26 -16
- package/network/multi-session-connection.test.d.cts +1 -0
- package/network/multi-session-connection.test.d.ts +1 -0
- package/network/network-manager.cjs +3 -2
- package/network/network-manager.d.cts +12 -0
- package/network/network-manager.d.ts +12 -0
- package/network/network-manager.js +3 -2
- package/network/persistent-connection.cjs +25 -1
- package/network/persistent-connection.d.cts +5 -0
- package/network/persistent-connection.d.ts +5 -0
- package/network/persistent-connection.js +25 -1
- package/network/session-connection.cjs +5 -10
- package/network/session-connection.d.cts +0 -2
- package/network/session-connection.d.ts +0 -2
- package/network/session-connection.js +5 -10
- package/package.json +1 -1
- package/tl/api-schema.json +1 -1
- package/tl/binary/reader.cjs +257 -62
- package/tl/binary/reader.js +257 -62
- package/tl/binary/writer.cjs +837 -212
- package/tl/binary/writer.js +837 -212
- package/tl/compat/reader.cjs +31 -0
- package/tl/compat/reader.js +31 -0
- package/tl/index.d.cts +2478 -186
- package/tl/index.d.ts +2478 -186
- package/tl/inner-tl.cjs +34 -10
- package/tl/inner-tl.js +34 -10
- package/utils/binary/compat.cjs +84 -0
- package/utils/binary/compat.js +84 -0
- package/utils/index.d.cts +1 -0
- package/utils/index.d.ts +1 -0
- package/utils/long-utils.cjs +10 -0
- package/utils/long-utils.js +10 -0
- package/utils.cjs +7 -0
- package/utils.js +8 -1
package/highlevel/methods.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ export { signIn } from './methods/auth/sign-in.js';
|
|
|
12
12
|
export { startTest } from './methods/auth/start-test.js';
|
|
13
13
|
export { start } from './methods/auth/start.js';
|
|
14
14
|
export { isSelfPeer } from './methods/auth/utils.js';
|
|
15
|
+
export { answerBotGuestChatQuery } from './methods/bots/answer-bot-guest-chat-query.js';
|
|
15
16
|
export { answerCallbackQuery } from './methods/bots/answer-callback-query.js';
|
|
16
17
|
export { answerInlineQuery } from './methods/bots/answer-inline-query.js';
|
|
17
18
|
export { answerPreCheckoutQuery } from './methods/bots/answer-pre-checkout-query.js';
|
|
@@ -63,6 +64,7 @@ export { getUser } from './methods/chats/get-user.js';
|
|
|
63
64
|
export { iterChatEventLog } from './methods/chats/iter-chat-event-log.js';
|
|
64
65
|
export { iterChatMembers } from './methods/chats/iter-chat-members.js';
|
|
65
66
|
export { joinChat } from './methods/chats/join-chat.js';
|
|
67
|
+
export type { JoinChatResult } from './methods/chats/join-chat.js';
|
|
66
68
|
export { kickChatMember } from './methods/chats/kick-chat-member.js';
|
|
67
69
|
export { leaveChat } from './methods/chats/leave-chat.js';
|
|
68
70
|
export { markChatUnread } from './methods/chats/mark-chat-unread.js';
|
|
@@ -71,6 +73,7 @@ export { closeChat } from './methods/chats/open-chat.js';
|
|
|
71
73
|
export { reorderUsernames } from './methods/chats/reorder-usernames.js';
|
|
72
74
|
export { restrictChatMember } from './methods/chats/restrict-chat-member.js';
|
|
73
75
|
export { saveDraft } from './methods/chats/save-draft.js';
|
|
76
|
+
export type { DraftMessageInput } from './methods/chats/save-draft.js';
|
|
74
77
|
export { setChatColor } from './methods/chats/set-chat-color.js';
|
|
75
78
|
export { setChatDefaultPermissions } from './methods/chats/set-chat-default-permissions.js';
|
|
76
79
|
export { setChatDescription } from './methods/chats/set-chat-description.js';
|
package/highlevel/methods.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export { signIn } from './methods/auth/sign-in.js';
|
|
|
12
12
|
export { startTest } from './methods/auth/start-test.js';
|
|
13
13
|
export { start } from './methods/auth/start.js';
|
|
14
14
|
export { isSelfPeer } from './methods/auth/utils.js';
|
|
15
|
+
export { answerBotGuestChatQuery } from './methods/bots/answer-bot-guest-chat-query.js';
|
|
15
16
|
export { answerCallbackQuery } from './methods/bots/answer-callback-query.js';
|
|
16
17
|
export { answerInlineQuery } from './methods/bots/answer-inline-query.js';
|
|
17
18
|
export { answerPreCheckoutQuery } from './methods/bots/answer-pre-checkout-query.js';
|
|
@@ -63,6 +64,7 @@ export { getUser } from './methods/chats/get-user.js';
|
|
|
63
64
|
export { iterChatEventLog } from './methods/chats/iter-chat-event-log.js';
|
|
64
65
|
export { iterChatMembers } from './methods/chats/iter-chat-members.js';
|
|
65
66
|
export { joinChat } from './methods/chats/join-chat.js';
|
|
67
|
+
export type { JoinChatResult } from './methods/chats/join-chat.js';
|
|
66
68
|
export { kickChatMember } from './methods/chats/kick-chat-member.js';
|
|
67
69
|
export { leaveChat } from './methods/chats/leave-chat.js';
|
|
68
70
|
export { markChatUnread } from './methods/chats/mark-chat-unread.js';
|
|
@@ -71,6 +73,7 @@ export { closeChat } from './methods/chats/open-chat.js';
|
|
|
71
73
|
export { reorderUsernames } from './methods/chats/reorder-usernames.js';
|
|
72
74
|
export { restrictChatMember } from './methods/chats/restrict-chat-member.js';
|
|
73
75
|
export { saveDraft } from './methods/chats/save-draft.js';
|
|
76
|
+
export type { DraftMessageInput } from './methods/chats/save-draft.js';
|
|
74
77
|
export { setChatColor } from './methods/chats/set-chat-color.js';
|
|
75
78
|
export { setChatDefaultPermissions } from './methods/chats/set-chat-default-permissions.js';
|
|
76
79
|
export { setChatDescription } from './methods/chats/set-chat-description.js';
|
|
@@ -181,8 +181,10 @@ class PeersService extends base.BaseService {
|
|
|
181
181
|
storiesUnavailable: peer.storiesUnavailable,
|
|
182
182
|
contactRequirePremium: peer.contactRequirePremium,
|
|
183
183
|
botBusiness: peer.botBusiness,
|
|
184
|
+
botGuard: peer.botGuard,
|
|
184
185
|
botHasMainApp: peer.botHasMainApp,
|
|
185
186
|
botCanManageBots: peer.botCanManageBots,
|
|
187
|
+
botGuestchat: peer.botGuestchat,
|
|
186
188
|
photo: peer.applyMinPhoto ? peer.photo : existing.photo,
|
|
187
189
|
status: !existing.status || existing.status._ === "userStatusEmpty" ? peer.status : existing.status,
|
|
188
190
|
botInfoVersion: peer.botInfoVersion,
|
|
@@ -174,8 +174,10 @@ class PeersService extends BaseService {
|
|
|
174
174
|
storiesUnavailable: peer.storiesUnavailable,
|
|
175
175
|
contactRequirePremium: peer.contactRequirePremium,
|
|
176
176
|
botBusiness: peer.botBusiness,
|
|
177
|
+
botGuard: peer.botGuard,
|
|
177
178
|
botHasMainApp: peer.botHasMainApp,
|
|
178
179
|
botCanManageBots: peer.botCanManageBots,
|
|
180
|
+
botGuestchat: peer.botGuestchat,
|
|
179
181
|
photo: peer.applyMinPhoto ? peer.photo : existing.photo,
|
|
180
182
|
status: !existing.status || existing.status._ === "userStatusEmpty" ? peer.status : existing.status,
|
|
181
183
|
botInfoVersion: peer.botInfoVersion,
|
|
@@ -18,7 +18,7 @@ import { UploadedFile } from './uploaded-file.js';
|
|
|
18
18
|
* - `Readable` (Node.js/Bun readable stream)
|
|
19
19
|
* - `Response` (from `window.fetch`)
|
|
20
20
|
*/
|
|
21
|
-
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response>;
|
|
21
|
+
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response> | AnyToNever<Deno.FsFile>;
|
|
22
22
|
/**
|
|
23
23
|
* Describes types that can be used as an input
|
|
24
24
|
* to any methods that send media (like {@link TelegramClient.sendPhoto})
|
|
@@ -18,7 +18,7 @@ import { UploadedFile } from './uploaded-file.js';
|
|
|
18
18
|
* - `Readable` (Node.js/Bun readable stream)
|
|
19
19
|
* - `Response` (from `window.fetch`)
|
|
20
20
|
*/
|
|
21
|
-
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response>;
|
|
21
|
+
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response> | AnyToNever<Deno.FsFile>;
|
|
22
22
|
/**
|
|
23
23
|
* Describes types that can be used as an input
|
|
24
24
|
* to any methods that send media (like {@link TelegramClient.sendPhoto})
|
|
@@ -161,6 +161,18 @@ class Poll {
|
|
|
161
161
|
get hasUnreaVotes() {
|
|
162
162
|
return this.results?.hasUnreadVotes ?? false;
|
|
163
163
|
}
|
|
164
|
+
/** Whether voting in this poll is restricted to channel subscribers */
|
|
165
|
+
get isSubscribersOnly() {
|
|
166
|
+
return this.raw.subscribersOnly;
|
|
167
|
+
}
|
|
168
|
+
/** ISO2 country codes the poll is restricted to */
|
|
169
|
+
get countries() {
|
|
170
|
+
return this.raw.countriesIso2 ?? null;
|
|
171
|
+
}
|
|
172
|
+
/** Whether the current user can view extended statistics for this poll */
|
|
173
|
+
get canViewStats() {
|
|
174
|
+
return this.results?.canViewStats ?? false;
|
|
175
|
+
}
|
|
164
176
|
/**
|
|
165
177
|
* Solution for the quiz, only available
|
|
166
178
|
* in case you have already answered
|
|
@@ -220,6 +232,8 @@ class Poll {
|
|
|
220
232
|
revotingDisabled: this.raw.revotingDisabled,
|
|
221
233
|
shuffleAnswers: this.raw.shuffleAnswers,
|
|
222
234
|
hideResultsUntilClose: this.raw.hideResultsUntilClose,
|
|
235
|
+
subscribersOnly: this.raw.subscribersOnly,
|
|
236
|
+
countriesIso2: this.raw.countriesIso2,
|
|
223
237
|
hash: Long.ZERO
|
|
224
238
|
}
|
|
225
239
|
};
|
|
@@ -97,6 +97,12 @@ export declare class Poll {
|
|
|
97
97
|
get hideResultsUntilClose(): boolean;
|
|
98
98
|
/** Whether the poll has unread votes */
|
|
99
99
|
get hasUnreaVotes(): boolean;
|
|
100
|
+
/** Whether voting in this poll is restricted to channel subscribers */
|
|
101
|
+
get isSubscribersOnly(): boolean;
|
|
102
|
+
/** ISO2 country codes the poll is restricted to */
|
|
103
|
+
get countries(): ReadonlyArray<string> | null;
|
|
104
|
+
/** Whether the current user can view extended statistics for this poll */
|
|
105
|
+
get canViewStats(): boolean;
|
|
100
106
|
/**
|
|
101
107
|
* Solution for the quiz, only available
|
|
102
108
|
* in case you have already answered
|
|
@@ -97,6 +97,12 @@ export declare class Poll {
|
|
|
97
97
|
get hideResultsUntilClose(): boolean;
|
|
98
98
|
/** Whether the poll has unread votes */
|
|
99
99
|
get hasUnreaVotes(): boolean;
|
|
100
|
+
/** Whether voting in this poll is restricted to channel subscribers */
|
|
101
|
+
get isSubscribersOnly(): boolean;
|
|
102
|
+
/** ISO2 country codes the poll is restricted to */
|
|
103
|
+
get countries(): ReadonlyArray<string> | null;
|
|
104
|
+
/** Whether the current user can view extended statistics for this poll */
|
|
105
|
+
get canViewStats(): boolean;
|
|
100
106
|
/**
|
|
101
107
|
* Solution for the quiz, only available
|
|
102
108
|
* in case you have already answered
|
|
@@ -154,6 +154,18 @@ class Poll {
|
|
|
154
154
|
get hasUnreaVotes() {
|
|
155
155
|
return this.results?.hasUnreadVotes ?? false;
|
|
156
156
|
}
|
|
157
|
+
/** Whether voting in this poll is restricted to channel subscribers */
|
|
158
|
+
get isSubscribersOnly() {
|
|
159
|
+
return this.raw.subscribersOnly;
|
|
160
|
+
}
|
|
161
|
+
/** ISO2 country codes the poll is restricted to */
|
|
162
|
+
get countries() {
|
|
163
|
+
return this.raw.countriesIso2 ?? null;
|
|
164
|
+
}
|
|
165
|
+
/** Whether the current user can view extended statistics for this poll */
|
|
166
|
+
get canViewStats() {
|
|
167
|
+
return this.results?.canViewStats ?? false;
|
|
168
|
+
}
|
|
157
169
|
/**
|
|
158
170
|
* Solution for the quiz, only available
|
|
159
171
|
* in case you have already answered
|
|
@@ -213,6 +225,8 @@ class Poll {
|
|
|
213
225
|
revotingDisabled: this.raw.revotingDisabled,
|
|
214
226
|
shuffleAnswers: this.raw.shuffleAnswers,
|
|
215
227
|
hideResultsUntilClose: this.raw.hideResultsUntilClose,
|
|
228
|
+
subscribersOnly: this.raw.subscribersOnly,
|
|
229
|
+
countriesIso2: this.raw.countriesIso2,
|
|
216
230
|
hash: Long.ZERO
|
|
217
231
|
}
|
|
218
232
|
};
|
|
@@ -11,5 +11,6 @@ export * from './message-reactions.js';
|
|
|
11
11
|
export * from './message-replies.js';
|
|
12
12
|
export * from './message.js';
|
|
13
13
|
export * from './replied-message.js';
|
|
14
|
+
export * from './rich-message.js';
|
|
14
15
|
export * from './search-filters.js';
|
|
15
16
|
export * from './suggested-post.js';
|
|
@@ -11,5 +11,6 @@ export * from './message-reactions.js';
|
|
|
11
11
|
export * from './message-replies.js';
|
|
12
12
|
export * from './message.js';
|
|
13
13
|
export * from './replied-message.js';
|
|
14
|
+
export * from './rich-message.js';
|
|
14
15
|
export * from './search-filters.js';
|
|
15
16
|
export * from './suggested-post.js';
|
|
@@ -20,6 +20,7 @@ const messageMedia = require("./message-media.cjs");
|
|
|
20
20
|
const messageReactions = require("./message-reactions.cjs");
|
|
21
21
|
const messageReplies = require("./message-replies.cjs");
|
|
22
22
|
const repliedMessage = require("./replied-message.cjs");
|
|
23
|
+
const richMessage = require("./rich-message.cjs");
|
|
23
24
|
const suggestedPost = require("./suggested-post.cjs");
|
|
24
25
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
25
26
|
const factories = require("../bots/keyboards/factories.cjs");
|
|
@@ -282,6 +283,14 @@ class Message {
|
|
|
282
283
|
}
|
|
283
284
|
return new user.User(this._peers.user(this.raw.viaBusinessBotId));
|
|
284
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* For messages sent via a bot guest chat,
|
|
288
|
+
* the peer who initiated it
|
|
289
|
+
*/
|
|
290
|
+
get guestChatViaFrom() {
|
|
291
|
+
if (this.raw._ !== "message" || !this.raw.guestchatViaFrom) return null;
|
|
292
|
+
return peer.parsePeer(this.raw.guestchatViaFrom, this._peers);
|
|
293
|
+
}
|
|
285
294
|
/**
|
|
286
295
|
* Message text or media caption.
|
|
287
296
|
*
|
|
@@ -334,6 +343,10 @@ class Message {
|
|
|
334
343
|
}
|
|
335
344
|
return messageMedia._messageMediaFromTl(this._peers, this.raw.media);
|
|
336
345
|
}
|
|
346
|
+
/** If this message is a rich message, its contents. Mutually exclusive with {@link media} and {@link text} */
|
|
347
|
+
get richMessage() {
|
|
348
|
+
return this.raw._ === "message" && this.raw.richMessage !== void 0 ? new richMessage.RichMessage(this.raw.richMessage) : null;
|
|
349
|
+
}
|
|
337
350
|
/**
|
|
338
351
|
* Whether this is a premium media
|
|
339
352
|
* (e.g. >2gb file or fullscreen sticker)
|
|
@@ -478,7 +491,8 @@ const Message$1 = /* @__PURE__ */ memoize.memoizeGetters(Message, [
|
|
|
478
491
|
"markup",
|
|
479
492
|
"reactions",
|
|
480
493
|
"factCheck",
|
|
481
|
-
"suggestedPost"
|
|
494
|
+
"suggestedPost",
|
|
495
|
+
"guestChatViaFrom"
|
|
482
496
|
]);
|
|
483
497
|
const Message$2 = /* @__PURE__ */ inspectable.makeInspectable(Message$1, ["isScheduled"], ["link"]);
|
|
484
498
|
exports.Message = Message$2;
|
|
@@ -12,6 +12,7 @@ import { MessageForwardInfo } from './message-forward.js';
|
|
|
12
12
|
import { MessageReactions } from './message-reactions.js';
|
|
13
13
|
import { MessageRepliesInfo } from './message-replies.js';
|
|
14
14
|
import { RepliedMessageInfo } from './replied-message.js';
|
|
15
|
+
import { RichMessage } from './rich-message.js';
|
|
15
16
|
import { SuggestedPostInfo } from './suggested-post.js';
|
|
16
17
|
/**
|
|
17
18
|
* A Telegram message.
|
|
@@ -185,6 +186,11 @@ export declare class Message {
|
|
|
185
186
|
* **Note**: only available to the business account and the bot itself.
|
|
186
187
|
*/
|
|
187
188
|
get viaBusinessBot(): User | null;
|
|
189
|
+
/**
|
|
190
|
+
* For messages sent via a bot guest chat,
|
|
191
|
+
* the peer who initiated it
|
|
192
|
+
*/
|
|
193
|
+
get guestChatViaFrom(): Peer | null;
|
|
188
194
|
/**
|
|
189
195
|
* Message text or media caption.
|
|
190
196
|
*
|
|
@@ -211,6 +217,8 @@ export declare class Message {
|
|
|
211
217
|
* For unsupported media types, use `.raw.media` directly.
|
|
212
218
|
*/
|
|
213
219
|
get media(): MessageMedia;
|
|
220
|
+
/** If this message is a rich message, its contents. Mutually exclusive with {@link media} and {@link text} */
|
|
221
|
+
get richMessage(): RichMessage | null;
|
|
214
222
|
/**
|
|
215
223
|
* Whether this is a premium media
|
|
216
224
|
* (e.g. >2gb file or fullscreen sticker)
|
|
@@ -12,6 +12,7 @@ import { MessageForwardInfo } from './message-forward.js';
|
|
|
12
12
|
import { MessageReactions } from './message-reactions.js';
|
|
13
13
|
import { MessageRepliesInfo } from './message-replies.js';
|
|
14
14
|
import { RepliedMessageInfo } from './replied-message.js';
|
|
15
|
+
import { RichMessage } from './rich-message.js';
|
|
15
16
|
import { SuggestedPostInfo } from './suggested-post.js';
|
|
16
17
|
/**
|
|
17
18
|
* A Telegram message.
|
|
@@ -185,6 +186,11 @@ export declare class Message {
|
|
|
185
186
|
* **Note**: only available to the business account and the bot itself.
|
|
186
187
|
*/
|
|
187
188
|
get viaBusinessBot(): User | null;
|
|
189
|
+
/**
|
|
190
|
+
* For messages sent via a bot guest chat,
|
|
191
|
+
* the peer who initiated it
|
|
192
|
+
*/
|
|
193
|
+
get guestChatViaFrom(): Peer | null;
|
|
188
194
|
/**
|
|
189
195
|
* Message text or media caption.
|
|
190
196
|
*
|
|
@@ -211,6 +217,8 @@ export declare class Message {
|
|
|
211
217
|
* For unsupported media types, use `.raw.media` directly.
|
|
212
218
|
*/
|
|
213
219
|
get media(): MessageMedia;
|
|
220
|
+
/** If this message is a rich message, its contents. Mutually exclusive with {@link media} and {@link text} */
|
|
221
|
+
get richMessage(): RichMessage | null;
|
|
214
222
|
/**
|
|
215
223
|
* Whether this is a premium media
|
|
216
224
|
* (e.g. >2gb file or fullscreen sticker)
|
|
@@ -13,6 +13,7 @@ import { _messageMediaFromTl } from "./message-media.js";
|
|
|
13
13
|
import { MessageReactions as MessageReactions$2 } from "./message-reactions.js";
|
|
14
14
|
import { MessageRepliesInfo as MessageRepliesInfo$2 } from "./message-replies.js";
|
|
15
15
|
import { RepliedMessageInfo as RepliedMessageInfo$2 } from "./replied-message.js";
|
|
16
|
+
import { RichMessage as RichMessage$2 } from "./rich-message.js";
|
|
16
17
|
import { SuggestedPostInfo as SuggestedPostInfo$1 } from "./suggested-post.js";
|
|
17
18
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
18
19
|
import { _rowsTo2d } from "../bots/keyboards/factories.js";
|
|
@@ -275,6 +276,14 @@ class Message {
|
|
|
275
276
|
}
|
|
276
277
|
return new User$2(this._peers.user(this.raw.viaBusinessBotId));
|
|
277
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* For messages sent via a bot guest chat,
|
|
281
|
+
* the peer who initiated it
|
|
282
|
+
*/
|
|
283
|
+
get guestChatViaFrom() {
|
|
284
|
+
if (this.raw._ !== "message" || !this.raw.guestchatViaFrom) return null;
|
|
285
|
+
return parsePeer(this.raw.guestchatViaFrom, this._peers);
|
|
286
|
+
}
|
|
278
287
|
/**
|
|
279
288
|
* Message text or media caption.
|
|
280
289
|
*
|
|
@@ -327,6 +336,10 @@ class Message {
|
|
|
327
336
|
}
|
|
328
337
|
return _messageMediaFromTl(this._peers, this.raw.media);
|
|
329
338
|
}
|
|
339
|
+
/** If this message is a rich message, its contents. Mutually exclusive with {@link media} and {@link text} */
|
|
340
|
+
get richMessage() {
|
|
341
|
+
return this.raw._ === "message" && this.raw.richMessage !== void 0 ? new RichMessage$2(this.raw.richMessage) : null;
|
|
342
|
+
}
|
|
330
343
|
/**
|
|
331
344
|
* Whether this is a premium media
|
|
332
345
|
* (e.g. >2gb file or fullscreen sticker)
|
|
@@ -471,7 +484,8 @@ const Message$1 = /* @__PURE__ */ memoizeGetters(Message, [
|
|
|
471
484
|
"markup",
|
|
472
485
|
"reactions",
|
|
473
486
|
"factCheck",
|
|
474
|
-
"suggestedPost"
|
|
487
|
+
"suggestedPost",
|
|
488
|
+
"guestChatViaFrom"
|
|
475
489
|
]);
|
|
476
490
|
const Message$2 = /* @__PURE__ */ makeInspectable(Message$1, ["isScheduled"], ["link"]);
|
|
477
491
|
export {
|
|
@@ -0,0 +1,50 @@
|
|
|
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 longUtils = require("../../../utils/long-utils.cjs");
|
|
9
|
+
const inspectable = require("../../utils/inspectable.cjs");
|
|
10
|
+
const memoize = require("../../utils/memoize.cjs");
|
|
11
|
+
const documentUtils = require("../media/document-utils.cjs");
|
|
12
|
+
const photo = require("../media/photo.cjs");
|
|
13
|
+
class RichMessage {
|
|
14
|
+
constructor(raw) {
|
|
15
|
+
this.raw = raw;
|
|
16
|
+
}
|
|
17
|
+
/** Whether this message is RTL */
|
|
18
|
+
get isRtl() {
|
|
19
|
+
return this.raw.rtl;
|
|
20
|
+
}
|
|
21
|
+
/** Whether this message is partial */
|
|
22
|
+
get isPart() {
|
|
23
|
+
return this.raw.part;
|
|
24
|
+
}
|
|
25
|
+
/** Photos in this message */
|
|
26
|
+
get photos() {
|
|
27
|
+
const map = new longUtils.LongMap();
|
|
28
|
+
for (const photo$1 of this.raw.photos) {
|
|
29
|
+
if (photo$1._ === "photoEmpty") continue;
|
|
30
|
+
map.set(photo$1.id, new photo.Photo(photo$1));
|
|
31
|
+
}
|
|
32
|
+
return map;
|
|
33
|
+
}
|
|
34
|
+
/** Documents (usually videos) in this message */
|
|
35
|
+
get documents() {
|
|
36
|
+
const map = new longUtils.LongMap();
|
|
37
|
+
for (const photo2 of this.raw.documents) {
|
|
38
|
+
if (photo2._ === "documentEmpty") continue;
|
|
39
|
+
map.set(photo2.id, documentUtils.parseDocument(photo2));
|
|
40
|
+
}
|
|
41
|
+
return map;
|
|
42
|
+
}
|
|
43
|
+
/** Blocks in this message */
|
|
44
|
+
get blocks() {
|
|
45
|
+
return this.raw.blocks;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const RichMessage$1 = /* @__PURE__ */ inspectable.makeInspectable(RichMessage);
|
|
49
|
+
const RichMessage$2 = /* @__PURE__ */ memoize.memoizeGetters(RichMessage$1, ["documents", "blocks"]);
|
|
50
|
+
exports.RichMessage = RichMessage$2;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { ParsedDocument } from '../media/document-utils.js';
|
|
3
|
+
import { LongMap } from '../../../utils/long-utils.js';
|
|
4
|
+
import { Photo } from '../media/photo.js';
|
|
5
|
+
export declare class RichMessage {
|
|
6
|
+
readonly raw: tl.TypeRichMessage;
|
|
7
|
+
constructor(raw: tl.TypeRichMessage);
|
|
8
|
+
/** Whether this message is RTL */
|
|
9
|
+
get isRtl(): boolean;
|
|
10
|
+
/** Whether this message is partial */
|
|
11
|
+
get isPart(): boolean;
|
|
12
|
+
/** Photos in this message */
|
|
13
|
+
get photos(): LongMap<Photo>;
|
|
14
|
+
/** Documents (usually videos) in this message */
|
|
15
|
+
get documents(): LongMap<ParsedDocument>;
|
|
16
|
+
/** Blocks in this message */
|
|
17
|
+
get blocks(): tl.TypePageBlock[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { ParsedDocument } from '../media/document-utils.js';
|
|
3
|
+
import { LongMap } from '../../../utils/long-utils.js';
|
|
4
|
+
import { Photo } from '../media/photo.js';
|
|
5
|
+
export declare class RichMessage {
|
|
6
|
+
readonly raw: tl.TypeRichMessage;
|
|
7
|
+
constructor(raw: tl.TypeRichMessage);
|
|
8
|
+
/** Whether this message is RTL */
|
|
9
|
+
get isRtl(): boolean;
|
|
10
|
+
/** Whether this message is partial */
|
|
11
|
+
get isPart(): boolean;
|
|
12
|
+
/** Photos in this message */
|
|
13
|
+
get photos(): LongMap<Photo>;
|
|
14
|
+
/** Documents (usually videos) in this message */
|
|
15
|
+
get documents(): LongMap<ParsedDocument>;
|
|
16
|
+
/** Blocks in this message */
|
|
17
|
+
get blocks(): tl.TypePageBlock[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LongMap } from "../../../utils/long-utils.js";
|
|
2
|
+
import { makeInspectable } from "../../utils/inspectable.js";
|
|
3
|
+
import { memoizeGetters } from "../../utils/memoize.js";
|
|
4
|
+
import { parseDocument } from "../media/document-utils.js";
|
|
5
|
+
import { Photo as Photo$2 } from "../media/photo.js";
|
|
6
|
+
class RichMessage {
|
|
7
|
+
constructor(raw) {
|
|
8
|
+
this.raw = raw;
|
|
9
|
+
}
|
|
10
|
+
/** Whether this message is RTL */
|
|
11
|
+
get isRtl() {
|
|
12
|
+
return this.raw.rtl;
|
|
13
|
+
}
|
|
14
|
+
/** Whether this message is partial */
|
|
15
|
+
get isPart() {
|
|
16
|
+
return this.raw.part;
|
|
17
|
+
}
|
|
18
|
+
/** Photos in this message */
|
|
19
|
+
get photos() {
|
|
20
|
+
const map = new LongMap();
|
|
21
|
+
for (const photo of this.raw.photos) {
|
|
22
|
+
if (photo._ === "photoEmpty") continue;
|
|
23
|
+
map.set(photo.id, new Photo$2(photo));
|
|
24
|
+
}
|
|
25
|
+
return map;
|
|
26
|
+
}
|
|
27
|
+
/** Documents (usually videos) in this message */
|
|
28
|
+
get documents() {
|
|
29
|
+
const map = new LongMap();
|
|
30
|
+
for (const photo of this.raw.documents) {
|
|
31
|
+
if (photo._ === "documentEmpty") continue;
|
|
32
|
+
map.set(photo.id, parseDocument(photo));
|
|
33
|
+
}
|
|
34
|
+
return map;
|
|
35
|
+
}
|
|
36
|
+
/** Blocks in this message */
|
|
37
|
+
get blocks() {
|
|
38
|
+
return this.raw.blocks;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const RichMessage$1 = /* @__PURE__ */ makeInspectable(RichMessage);
|
|
42
|
+
const RichMessage$2 = /* @__PURE__ */ memoizeGetters(RichMessage$1, ["documents", "blocks"]);
|
|
43
|
+
export {
|
|
44
|
+
RichMessage$2 as RichMessage
|
|
45
|
+
};
|
|
@@ -137,6 +137,12 @@ class ChatPermissions {
|
|
|
137
137
|
get canSendPolls() {
|
|
138
138
|
return !this.raw.sendPolls;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Whether users can react to messages.
|
|
142
|
+
*/
|
|
143
|
+
get canSendReactions() {
|
|
144
|
+
return !this.raw.sendReactions;
|
|
145
|
+
}
|
|
140
146
|
/**
|
|
141
147
|
* Whether users can change the chat title,
|
|
142
148
|
* photo and other settings.
|
|
@@ -99,6 +99,10 @@ export declare class ChatPermissions {
|
|
|
99
99
|
* Implies {@link canSendMessages}
|
|
100
100
|
*/
|
|
101
101
|
get canSendPolls(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether users can react to messages.
|
|
104
|
+
*/
|
|
105
|
+
get canSendReactions(): boolean;
|
|
102
106
|
/**
|
|
103
107
|
* Whether users can change the chat title,
|
|
104
108
|
* photo and other settings.
|
|
@@ -99,6 +99,10 @@ export declare class ChatPermissions {
|
|
|
99
99
|
* Implies {@link canSendMessages}
|
|
100
100
|
*/
|
|
101
101
|
get canSendPolls(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether users can react to messages.
|
|
104
|
+
*/
|
|
105
|
+
get canSendReactions(): boolean;
|
|
102
106
|
/**
|
|
103
107
|
* Whether users can change the chat title,
|
|
104
108
|
* photo and other settings.
|
|
@@ -130,6 +130,12 @@ class ChatPermissions {
|
|
|
130
130
|
get canSendPolls() {
|
|
131
131
|
return !this.raw.sendPolls;
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Whether users can react to messages.
|
|
135
|
+
*/
|
|
136
|
+
get canSendReactions() {
|
|
137
|
+
return !this.raw.sendReactions;
|
|
138
|
+
}
|
|
133
139
|
/**
|
|
134
140
|
* Whether users can change the chat title,
|
|
135
141
|
* photo and other settings.
|
|
@@ -217,6 +217,11 @@ class FullChat extends chat.Chat {
|
|
|
217
217
|
get botInfo() {
|
|
218
218
|
return this.full._ === "channelFull" ? this.full.botInfo.map((it) => new botInfo.BotInfo(it)) : [];
|
|
219
219
|
}
|
|
220
|
+
/** Bot that approves join requests in this chat, if any */
|
|
221
|
+
get guardBot() {
|
|
222
|
+
if (this.full._ !== "channelFull" || !this.full.guardBotId) return null;
|
|
223
|
+
return new user.User(this.peers.user(this.full.guardBotId));
|
|
224
|
+
}
|
|
220
225
|
/**
|
|
221
226
|
* For supergroups, ID of the basic group from which this supergroup was upgraded,
|
|
222
227
|
* and the identifier of the last message from the original group.
|
|
@@ -321,6 +326,7 @@ const FullChat$1 = /* @__PURE__ */ memoize.memoizeGetters(FullChat, [
|
|
|
321
326
|
"stickerSet",
|
|
322
327
|
"emojiSet",
|
|
323
328
|
"botInfo",
|
|
329
|
+
"guardBot",
|
|
324
330
|
"linkedChat",
|
|
325
331
|
"recentRequesters",
|
|
326
332
|
"stories",
|
|
@@ -117,6 +117,8 @@ export declare class FullChat extends Chat {
|
|
|
117
117
|
get notificationsSettings(): tl.TypePeerNotifySettings | null;
|
|
118
118
|
/** Information about bots in this chat */
|
|
119
119
|
get botInfo(): BotInfo[];
|
|
120
|
+
/** Bot that approves join requests in this chat, if any */
|
|
121
|
+
get guardBot(): User | null;
|
|
120
122
|
/**
|
|
121
123
|
* For supergroups, ID of the basic group from which this supergroup was upgraded,
|
|
122
124
|
* and the identifier of the last message from the original group.
|
|
@@ -117,6 +117,8 @@ export declare class FullChat extends Chat {
|
|
|
117
117
|
get notificationsSettings(): tl.TypePeerNotifySettings | null;
|
|
118
118
|
/** Information about bots in this chat */
|
|
119
119
|
get botInfo(): BotInfo[];
|
|
120
|
+
/** Bot that approves join requests in this chat, if any */
|
|
121
|
+
get guardBot(): User | null;
|
|
120
122
|
/**
|
|
121
123
|
* For supergroups, ID of the basic group from which this supergroup was upgraded,
|
|
122
124
|
* and the identifier of the last message from the original group.
|
|
@@ -210,6 +210,11 @@ class FullChat extends Chat$2 {
|
|
|
210
210
|
get botInfo() {
|
|
211
211
|
return this.full._ === "channelFull" ? this.full.botInfo.map((it) => new BotInfo$2(it)) : [];
|
|
212
212
|
}
|
|
213
|
+
/** Bot that approves join requests in this chat, if any */
|
|
214
|
+
get guardBot() {
|
|
215
|
+
if (this.full._ !== "channelFull" || !this.full.guardBotId) return null;
|
|
216
|
+
return new User$2(this.peers.user(this.full.guardBotId));
|
|
217
|
+
}
|
|
213
218
|
/**
|
|
214
219
|
* For supergroups, ID of the basic group from which this supergroup was upgraded,
|
|
215
220
|
* and the identifier of the last message from the original group.
|
|
@@ -314,6 +319,7 @@ const FullChat$1 = /* @__PURE__ */ memoizeGetters(FullChat, [
|
|
|
314
319
|
"stickerSet",
|
|
315
320
|
"emojiSet",
|
|
316
321
|
"botInfo",
|
|
322
|
+
"guardBot",
|
|
317
323
|
"linkedChat",
|
|
318
324
|
"recentRequesters",
|
|
319
325
|
"stories",
|
|
@@ -83,6 +83,10 @@ class User {
|
|
|
83
83
|
get isBusinessBot() {
|
|
84
84
|
return this.raw.botBusiness;
|
|
85
85
|
}
|
|
86
|
+
/** Whether this bot can approve join requests */
|
|
87
|
+
get isBotGuard() {
|
|
88
|
+
return this.raw.botGuard;
|
|
89
|
+
}
|
|
86
90
|
/** Whether this user is a bot that has access to all messages */
|
|
87
91
|
get isBotWithHistory() {
|
|
88
92
|
return this.raw.botChatHistory;
|
|
@@ -118,6 +122,10 @@ class User {
|
|
|
118
122
|
get canBotManageBots() {
|
|
119
123
|
return this.raw.botCanManageBots;
|
|
120
124
|
}
|
|
125
|
+
/** Whether this bot supports bot guest chats */
|
|
126
|
+
get isBotWithGuestChat() {
|
|
127
|
+
return this.raw.botGuestchat;
|
|
128
|
+
}
|
|
121
129
|
/** Whether this user has been verified by Telegram */
|
|
122
130
|
get isVerified() {
|
|
123
131
|
return this.raw.verified;
|
|
@@ -70,6 +70,8 @@ export declare class User {
|
|
|
70
70
|
* Telegram Business account to receive its messages
|
|
71
71
|
*/
|
|
72
72
|
get isBusinessBot(): boolean;
|
|
73
|
+
/** Whether this bot can approve join requests */
|
|
74
|
+
get isBotGuard(): boolean;
|
|
73
75
|
/** Whether this user is a bot that has access to all messages */
|
|
74
76
|
get isBotWithHistory(): boolean;
|
|
75
77
|
/** Whether this user is a bot that can't be added to chats */
|
|
@@ -87,6 +89,8 @@ export declare class User {
|
|
|
87
89
|
get canBotManageForumTopics(): boolean;
|
|
88
90
|
/** Whether this bot can manage other bots */
|
|
89
91
|
get canBotManageBots(): boolean;
|
|
92
|
+
/** Whether this bot supports bot guest chats */
|
|
93
|
+
get isBotWithGuestChat(): boolean;
|
|
90
94
|
/** Whether this user has been verified by Telegram */
|
|
91
95
|
get isVerified(): boolean;
|
|
92
96
|
/**
|
|
@@ -70,6 +70,8 @@ export declare class User {
|
|
|
70
70
|
* Telegram Business account to receive its messages
|
|
71
71
|
*/
|
|
72
72
|
get isBusinessBot(): boolean;
|
|
73
|
+
/** Whether this bot can approve join requests */
|
|
74
|
+
get isBotGuard(): boolean;
|
|
73
75
|
/** Whether this user is a bot that has access to all messages */
|
|
74
76
|
get isBotWithHistory(): boolean;
|
|
75
77
|
/** Whether this user is a bot that can't be added to chats */
|
|
@@ -87,6 +89,8 @@ export declare class User {
|
|
|
87
89
|
get canBotManageForumTopics(): boolean;
|
|
88
90
|
/** Whether this bot can manage other bots */
|
|
89
91
|
get canBotManageBots(): boolean;
|
|
92
|
+
/** Whether this bot supports bot guest chats */
|
|
93
|
+
get isBotWithGuestChat(): boolean;
|
|
90
94
|
/** Whether this user has been verified by Telegram */
|
|
91
95
|
get isVerified(): boolean;
|
|
92
96
|
/**
|