@mtcute/core 0.29.6 → 0.29.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/client.cjs +8 -0
  2. package/client.js +8 -0
  3. package/highlevel/client.d.cts +19 -1
  4. package/highlevel/client.d.ts +19 -1
  5. package/highlevel/methods/bots/answer-bot-guest-chat-query.cjs +26 -0
  6. package/highlevel/methods/bots/answer-bot-guest-chat-query.d.cts +12 -0
  7. package/highlevel/methods/bots/answer-bot-guest-chat-query.d.ts +12 -0
  8. package/highlevel/methods/bots/answer-bot-guest-chat-query.js +21 -0
  9. package/highlevel/methods/messages/send-copy-group.cjs +5 -9
  10. package/highlevel/methods/messages/send-copy-group.js +5 -9
  11. package/highlevel/methods.d.cts +1 -0
  12. package/highlevel/methods.d.ts +1 -0
  13. package/highlevel/storage/service/peers.cjs +1 -0
  14. package/highlevel/storage/service/peers.js +1 -0
  15. package/highlevel/types/media/poll.cjs +14 -0
  16. package/highlevel/types/media/poll.d.cts +6 -0
  17. package/highlevel/types/media/poll.d.ts +6 -0
  18. package/highlevel/types/media/poll.js +14 -0
  19. package/highlevel/types/messages/message.cjs +10 -1
  20. package/highlevel/types/messages/message.d.cts +5 -0
  21. package/highlevel/types/messages/message.d.ts +5 -0
  22. package/highlevel/types/messages/message.js +10 -1
  23. package/highlevel/types/peers/chat-permissions.cjs +6 -0
  24. package/highlevel/types/peers/chat-permissions.d.cts +4 -0
  25. package/highlevel/types/peers/chat-permissions.d.ts +4 -0
  26. package/highlevel/types/peers/chat-permissions.js +6 -0
  27. package/highlevel/types/peers/user.cjs +4 -0
  28. package/highlevel/types/peers/user.d.cts +2 -0
  29. package/highlevel/types/peers/user.d.ts +2 -0
  30. package/highlevel/types/peers/user.js +4 -0
  31. package/highlevel/types/updates/bot-guest-chat-query.cjs +39 -0
  32. package/highlevel/types/updates/bot-guest-chat-query.d.cts +21 -0
  33. package/highlevel/types/updates/bot-guest-chat-query.d.ts +21 -0
  34. package/highlevel/types/updates/bot-guest-chat-query.js +34 -0
  35. package/highlevel/types/updates/index.d.cts +5 -1
  36. package/highlevel/types/updates/index.d.ts +5 -1
  37. package/highlevel/types/updates/parse-update.cjs +3 -0
  38. package/highlevel/types/updates/parse-update.js +3 -0
  39. package/highlevel/updates/manager.cjs +23 -3
  40. package/highlevel/updates/manager.d.cts +1 -0
  41. package/highlevel/updates/manager.d.ts +1 -0
  42. package/highlevel/updates/manager.js +23 -3
  43. package/index.cjs +2 -0
  44. package/index.js +2 -0
  45. package/methods.cjs +2 -0
  46. package/methods.js +2 -0
  47. package/network/network-manager.cjs +1 -1
  48. package/network/network-manager.js +1 -1
  49. package/package.json +1 -1
  50. package/tl/api-schema.json +1 -1
  51. package/tl/binary/reader.cjs +85 -40
  52. package/tl/binary/reader.js +85 -40
  53. package/tl/binary/writer.cjs +349 -143
  54. package/tl/binary/writer.js +349 -143
  55. package/tl/compat/reader.cjs +8 -0
  56. package/tl/compat/reader.js +8 -0
  57. package/tl/index.d.cts +2071 -179
  58. package/tl/index.d.ts +2071 -179
  59. package/tl/inner-tl.cjs +17 -5
  60. package/tl/inner-tl.js +17 -5
  61. package/utils/binary/compat.cjs +5 -0
  62. package/utils/binary/compat.js +5 -0
package/client.cjs CHANGED
@@ -20,6 +20,7 @@ const signIn = require("./highlevel/methods/auth/sign-in.cjs");
20
20
  const startTest = require("./highlevel/methods/auth/start-test.cjs");
21
21
  const start = require("./highlevel/methods/auth/start.cjs");
22
22
  const utils$1 = require("./highlevel/methods/auth/utils.cjs");
23
+ const answerBotGuestChatQuery = require("./highlevel/methods/bots/answer-bot-guest-chat-query.cjs");
23
24
  const answerCallbackQuery = require("./highlevel/methods/bots/answer-callback-query.cjs");
24
25
  const answerInlineQuery = require("./highlevel/methods/bots/answer-inline-query.cjs");
25
26
  const answerPreCheckoutQuery = require("./highlevel/methods/bots/answer-pre-checkout-query.cjs");
@@ -303,6 +304,7 @@ class TelegramClient {
303
304
  this.onDeleteMessage = new utils.Emitter();
304
305
  this.onChatMemberUpdate = new utils.Emitter();
305
306
  this.onInlineQuery = new utils.Emitter();
307
+ this.onBotGuestChatQuery = new utils.Emitter();
306
308
  this.onChosenInlineResult = new utils.Emitter();
307
309
  this.onCallbackQuery = new utils.Emitter();
308
310
  this.onInlineCallbackQuery = new utils.Emitter();
@@ -373,6 +375,9 @@ class TelegramClient {
373
375
  case "inline_query":
374
376
  this.onInlineQuery.emit(update.data);
375
377
  break;
378
+ case "bot_guest_chat_query":
379
+ this.onBotGuestChatQuery.emit(update.data);
380
+ break;
376
381
  case "chosen_inline_result":
377
382
  this.onChosenInlineResult.emit(update.data);
378
383
  break;
@@ -488,6 +493,9 @@ TelegramClient.prototype.start = function(...args) {
488
493
  TelegramClient.prototype.isSelfPeer = function(...args) {
489
494
  return utils$1.isSelfPeer(this._client, ...args);
490
495
  };
496
+ TelegramClient.prototype.answerBotGuestChatQuery = function(...args) {
497
+ return answerBotGuestChatQuery.answerBotGuestChatQuery(this._client, ...args);
498
+ };
491
499
  TelegramClient.prototype.answerCallbackQuery = function(...args) {
492
500
  return answerCallbackQuery.answerCallbackQuery(this._client, ...args);
493
501
  };
package/client.js CHANGED
@@ -13,6 +13,7 @@ import { signIn } from "./highlevel/methods/auth/sign-in.js";
13
13
  import { startTest } from "./highlevel/methods/auth/start-test.js";
14
14
  import { start } from "./highlevel/methods/auth/start.js";
15
15
  import { isSelfPeer } from "./highlevel/methods/auth/utils.js";
16
+ import { answerBotGuestChatQuery } from "./highlevel/methods/bots/answer-bot-guest-chat-query.js";
16
17
  import { answerCallbackQuery } from "./highlevel/methods/bots/answer-callback-query.js";
17
18
  import { answerInlineQuery } from "./highlevel/methods/bots/answer-inline-query.js";
18
19
  import { answerPreCheckoutQuery } from "./highlevel/methods/bots/answer-pre-checkout-query.js";
@@ -296,6 +297,7 @@ class TelegramClient {
296
297
  this.onDeleteMessage = new Emitter();
297
298
  this.onChatMemberUpdate = new Emitter();
298
299
  this.onInlineQuery = new Emitter();
300
+ this.onBotGuestChatQuery = new Emitter();
299
301
  this.onChosenInlineResult = new Emitter();
300
302
  this.onCallbackQuery = new Emitter();
301
303
  this.onInlineCallbackQuery = new Emitter();
@@ -366,6 +368,9 @@ class TelegramClient {
366
368
  case "inline_query":
367
369
  this.onInlineQuery.emit(update.data);
368
370
  break;
371
+ case "bot_guest_chat_query":
372
+ this.onBotGuestChatQuery.emit(update.data);
373
+ break;
369
374
  case "chosen_inline_result":
370
375
  this.onChosenInlineResult.emit(update.data);
371
376
  break;
@@ -481,6 +486,9 @@ TelegramClient.prototype.start = function(...args) {
481
486
  TelegramClient.prototype.isSelfPeer = function(...args) {
482
487
  return isSelfPeer(this._client, ...args);
483
488
  };
489
+ TelegramClient.prototype.answerBotGuestChatQuery = function(...args) {
490
+ return answerBotGuestChatQuery(this._client, ...args);
491
+ };
484
492
  TelegramClient.prototype.answerCallbackQuery = function(...args) {
485
493
  return answerCallbackQuery(this._client, ...args);
486
494
  };
@@ -27,7 +27,7 @@ import { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
27
27
  import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
28
28
  import { CanSendStoryResult } from './methods/stories/can-send-story.js';
29
29
  import { ITelegramStorageProvider } from './storage/provider.js';
30
- import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
30
+ import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotGuestChatQuery, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineMessage, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
31
31
  import { ParsedUpdateHandlerParams } from './updates/parsed.js';
32
32
  import { RawUpdateInfo } from './updates/types.js';
33
33
  import { InputStringSessionData } from './utils/string-session.js';
@@ -91,6 +91,8 @@ export interface TelegramClient extends ITelegramClient {
91
91
  readonly onChatMemberUpdate: Emitter<ChatMemberUpdate>;
92
92
  /** an inline query handler */
93
93
  readonly onInlineQuery: Emitter<InlineQuery>;
94
+ /** a bot guest chat query handler */
95
+ readonly onBotGuestChatQuery: Emitter<BotGuestChatQuery>;
94
96
  /** a chosen inline result handler */
95
97
  readonly onChosenInlineResult: Emitter<ChosenInlineResult>;
96
98
  /** a callback query handler */
@@ -412,6 +414,14 @@ export interface TelegramClient extends ITelegramClient {
412
414
  *
413
415
  */
414
416
  isSelfPeer(peer: tl.TypeInputPeer | tl.TypePeer | tl.TypeInputUser): boolean;
417
+ /**
418
+ * Answer a bot guest chat query with a result.
419
+ *
420
+ * @param queryId Query ID
421
+ * @param result Result of the query
422
+ * @returns ID of the inline message that was sent
423
+ */
424
+ answerBotGuestChatQuery(queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
415
425
  /**
416
426
  * Send an answer to a callback query.
417
427
  *
@@ -1113,6 +1123,8 @@ export interface TelegramClient extends ITelegramClient {
1113
1123
  }): Promise<void>;
1114
1124
  /**
1115
1125
  * Edit the custom rank (title) of a group chat participant.
1126
+ * **Available**: 👤 users only
1127
+ *
1116
1128
  */
1117
1129
  editChatMemberRank(params: {
1118
1130
  /** Chat ID */
@@ -1283,6 +1295,8 @@ export interface TelegramClient extends ITelegramClient {
1283
1295
  * Get the user who will be made the creator of the chat/channel/supergroup if you were to leave it.
1284
1296
  *
1285
1297
  * You must be the creator of the chat/channel/supergroup to use this method.
1298
+ * **Available**: 👤 users only
1299
+ *
1286
1300
  */
1287
1301
  getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
1288
1302
  /**
@@ -1689,6 +1703,8 @@ export interface TelegramClient extends ITelegramClient {
1689
1703
  *
1690
1704
  * You must be the creator of the chat to use this method,
1691
1705
  * and your account must have 2FA enabled.
1706
+ * **Available**: 👤 users only
1707
+ *
1692
1708
  */
1693
1709
  transferChatOwnership(params: {
1694
1710
  /** ID of the chat/channel/supergroup to transfer */
@@ -3100,6 +3116,8 @@ export interface TelegramClient extends ITelegramClient {
3100
3116
  *
3101
3117
  * - `append` - appends the text to the previous draft
3102
3118
  * - `replace` - replaces the previous draft with the new one
3119
+ *
3120
+ * @default `replace`
3103
3121
  */
3104
3122
  mode?: 'append' | 'replace';
3105
3123
  }): Promise<StreamingDraft>;
@@ -27,7 +27,7 @@ import { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
27
27
  import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
28
28
  import { CanSendStoryResult } from './methods/stories/can-send-story.js';
29
29
  import { ITelegramStorageProvider } from './storage/provider.js';
30
- import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
30
+ import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotGuestChatQuery, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineMessage, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
31
31
  import { ParsedUpdateHandlerParams } from './updates/parsed.js';
32
32
  import { RawUpdateInfo } from './updates/types.js';
33
33
  import { InputStringSessionData } from './utils/string-session.js';
@@ -91,6 +91,8 @@ export interface TelegramClient extends ITelegramClient {
91
91
  readonly onChatMemberUpdate: Emitter<ChatMemberUpdate>;
92
92
  /** an inline query handler */
93
93
  readonly onInlineQuery: Emitter<InlineQuery>;
94
+ /** a bot guest chat query handler */
95
+ readonly onBotGuestChatQuery: Emitter<BotGuestChatQuery>;
94
96
  /** a chosen inline result handler */
95
97
  readonly onChosenInlineResult: Emitter<ChosenInlineResult>;
96
98
  /** a callback query handler */
@@ -412,6 +414,14 @@ export interface TelegramClient extends ITelegramClient {
412
414
  *
413
415
  */
414
416
  isSelfPeer(peer: tl.TypeInputPeer | tl.TypePeer | tl.TypeInputUser): boolean;
417
+ /**
418
+ * Answer a bot guest chat query with a result.
419
+ *
420
+ * @param queryId Query ID
421
+ * @param result Result of the query
422
+ * @returns ID of the inline message that was sent
423
+ */
424
+ answerBotGuestChatQuery(queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
415
425
  /**
416
426
  * Send an answer to a callback query.
417
427
  *
@@ -1113,6 +1123,8 @@ export interface TelegramClient extends ITelegramClient {
1113
1123
  }): Promise<void>;
1114
1124
  /**
1115
1125
  * Edit the custom rank (title) of a group chat participant.
1126
+ * **Available**: 👤 users only
1127
+ *
1116
1128
  */
1117
1129
  editChatMemberRank(params: {
1118
1130
  /** Chat ID */
@@ -1283,6 +1295,8 @@ export interface TelegramClient extends ITelegramClient {
1283
1295
  * Get the user who will be made the creator of the chat/channel/supergroup if you were to leave it.
1284
1296
  *
1285
1297
  * You must be the creator of the chat/channel/supergroup to use this method.
1298
+ * **Available**: 👤 users only
1299
+ *
1286
1300
  */
1287
1301
  getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
1288
1302
  /**
@@ -1689,6 +1703,8 @@ export interface TelegramClient extends ITelegramClient {
1689
1703
  *
1690
1704
  * You must be the creator of the chat to use this method,
1691
1705
  * and your account must have 2FA enabled.
1706
+ * **Available**: 👤 users only
1707
+ *
1692
1708
  */
1693
1709
  transferChatOwnership(params: {
1694
1710
  /** ID of the chat/channel/supergroup to transfer */
@@ -3100,6 +3116,8 @@ export interface TelegramClient extends ITelegramClient {
3100
3116
  *
3101
3117
  * - `append` - appends the text to the previous draft
3102
3118
  * - `replace` - replaces the previous draft with the new one
3119
+ *
3120
+ * @default `replace`
3103
3121
  */
3104
3122
  mode?: 'append' | 'replace';
3105
3123
  }): Promise<StreamingDraft>;
@@ -0,0 +1,26 @@
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 Long = require("long");
9
+ const factories = require("../../types/bots/inline-result/factories.cjs");
10
+ async function answerBotGuestChatQuery(client, queryId, result) {
11
+ if (!("id" in result)) {
12
+ result = {
13
+ type: "article",
14
+ id: "guest",
15
+ title: "guest",
16
+ message: result
17
+ };
18
+ }
19
+ const [, tlResults] = await factories._convertToTl(client, [result]);
20
+ return client.call({
21
+ _: "messages.setBotGuestChatResult",
22
+ queryId: Long.isLong(queryId) ? queryId : queryId.id,
23
+ result: tlResults[0]
24
+ });
25
+ }
26
+ exports.answerBotGuestChatQuery = answerBotGuestChatQuery;
@@ -0,0 +1,12 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { ITelegramClient } from '../../client.types.js';
3
+ import { InputInlineMessage, InputInlineResult } from '../../types/bots/index.js';
4
+ import { BotGuestChatQuery } from '../../types/updates/bot-guest-chat-query.js';
5
+ /**
6
+ * Answer a bot guest chat query with a result.
7
+ *
8
+ * @param queryId Query ID
9
+ * @param result Result of the query
10
+ * @returns ID of the inline message that was sent
11
+ */
12
+ export declare function answerBotGuestChatQuery(client: ITelegramClient, queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
@@ -0,0 +1,12 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { ITelegramClient } from '../../client.types.js';
3
+ import { InputInlineMessage, InputInlineResult } from '../../types/bots/index.js';
4
+ import { BotGuestChatQuery } from '../../types/updates/bot-guest-chat-query.js';
5
+ /**
6
+ * Answer a bot guest chat query with a result.
7
+ *
8
+ * @param queryId Query ID
9
+ * @param result Result of the query
10
+ * @returns ID of the inline message that was sent
11
+ */
12
+ export declare function answerBotGuestChatQuery(client: ITelegramClient, queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
@@ -0,0 +1,21 @@
1
+ import Long from "long";
2
+ import { _convertToTl } from "../../types/bots/inline-result/factories.js";
3
+ async function answerBotGuestChatQuery(client, queryId, result) {
4
+ if (!("id" in result)) {
5
+ result = {
6
+ type: "article",
7
+ id: "guest",
8
+ title: "guest",
9
+ message: result
10
+ };
11
+ }
12
+ const [, tlResults] = await _convertToTl(client, [result]);
13
+ return client.call({
14
+ _: "messages.setBotGuestChatResult",
15
+ queryId: Long.isLong(queryId) ? queryId : queryId.id,
16
+ result: tlResults[0]
17
+ });
18
+ }
19
+ export {
20
+ answerBotGuestChatQuery
21
+ };
@@ -28,15 +28,11 @@ async function sendCopyGroup(client, params) {
28
28
  return sendMediaGroup.sendMediaGroup(
29
29
  client,
30
30
  toChatId,
31
- msgs.map((msg) => {
32
- const raw = msg.raw;
33
- return {
34
- type: "auto",
35
- file: msg.media.inputMedia,
36
- caption: raw.message,
37
- entities: raw.entities
38
- };
39
- }),
31
+ msgs.map((msg) => ({
32
+ type: "auto",
33
+ file: msg.media.inputMedia,
34
+ caption: msg.textWithEntities
35
+ })),
40
36
  rest
41
37
  );
42
38
  }
@@ -21,15 +21,11 @@ async function sendCopyGroup(client, params) {
21
21
  return sendMediaGroup(
22
22
  client,
23
23
  toChatId,
24
- msgs.map((msg) => {
25
- const raw = msg.raw;
26
- return {
27
- type: "auto",
28
- file: msg.media.inputMedia,
29
- caption: raw.message,
30
- entities: raw.entities
31
- };
32
- }),
24
+ msgs.map((msg) => ({
25
+ type: "auto",
26
+ file: msg.media.inputMedia,
27
+ caption: msg.textWithEntities
28
+ })),
33
29
  rest
34
30
  );
35
31
  }
@@ -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';
@@ -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';
@@ -183,6 +183,7 @@ class PeersService extends base.BaseService {
183
183
  botBusiness: peer.botBusiness,
184
184
  botHasMainApp: peer.botHasMainApp,
185
185
  botCanManageBots: peer.botCanManageBots,
186
+ botGuestchat: peer.botGuestchat,
186
187
  photo: peer.applyMinPhoto ? peer.photo : existing.photo,
187
188
  status: !existing.status || existing.status._ === "userStatusEmpty" ? peer.status : existing.status,
188
189
  botInfoVersion: peer.botInfoVersion,
@@ -176,6 +176,7 @@ class PeersService extends BaseService {
176
176
  botBusiness: peer.botBusiness,
177
177
  botHasMainApp: peer.botHasMainApp,
178
178
  botCanManageBots: peer.botCanManageBots,
179
+ botGuestchat: peer.botGuestchat,
179
180
  photo: peer.applyMinPhoto ? peer.photo : existing.photo,
180
181
  status: !existing.status || existing.status._ === "userStatusEmpty" ? peer.status : existing.status,
181
182
  botInfoVersion: peer.botInfoVersion,
@@ -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
  };
@@ -282,6 +282,14 @@ class Message {
282
282
  }
283
283
  return new user.User(this._peers.user(this.raw.viaBusinessBotId));
284
284
  }
285
+ /**
286
+ * For messages sent via a bot guest chat,
287
+ * the peer who initiated it
288
+ */
289
+ get guestChatViaFrom() {
290
+ if (this.raw._ !== "message" || !this.raw.guestchatViaFrom) return null;
291
+ return peer.parsePeer(this.raw.guestchatViaFrom, this._peers);
292
+ }
285
293
  /**
286
294
  * Message text or media caption.
287
295
  *
@@ -478,7 +486,8 @@ const Message$1 = /* @__PURE__ */ memoize.memoizeGetters(Message, [
478
486
  "markup",
479
487
  "reactions",
480
488
  "factCheck",
481
- "suggestedPost"
489
+ "suggestedPost",
490
+ "guestChatViaFrom"
482
491
  ]);
483
492
  const Message$2 = /* @__PURE__ */ inspectable.makeInspectable(Message$1, ["isScheduled"], ["link"]);
484
493
  exports.Message = Message$2;
@@ -185,6 +185,11 @@ export declare class Message {
185
185
  * **Note**: only available to the business account and the bot itself.
186
186
  */
187
187
  get viaBusinessBot(): User | null;
188
+ /**
189
+ * For messages sent via a bot guest chat,
190
+ * the peer who initiated it
191
+ */
192
+ get guestChatViaFrom(): Peer | null;
188
193
  /**
189
194
  * Message text or media caption.
190
195
  *
@@ -185,6 +185,11 @@ export declare class Message {
185
185
  * **Note**: only available to the business account and the bot itself.
186
186
  */
187
187
  get viaBusinessBot(): User | null;
188
+ /**
189
+ * For messages sent via a bot guest chat,
190
+ * the peer who initiated it
191
+ */
192
+ get guestChatViaFrom(): Peer | null;
188
193
  /**
189
194
  * Message text or media caption.
190
195
  *
@@ -275,6 +275,14 @@ class Message {
275
275
  }
276
276
  return new User$2(this._peers.user(this.raw.viaBusinessBotId));
277
277
  }
278
+ /**
279
+ * For messages sent via a bot guest chat,
280
+ * the peer who initiated it
281
+ */
282
+ get guestChatViaFrom() {
283
+ if (this.raw._ !== "message" || !this.raw.guestchatViaFrom) return null;
284
+ return parsePeer(this.raw.guestchatViaFrom, this._peers);
285
+ }
278
286
  /**
279
287
  * Message text or media caption.
280
288
  *
@@ -471,7 +479,8 @@ const Message$1 = /* @__PURE__ */ memoizeGetters(Message, [
471
479
  "markup",
472
480
  "reactions",
473
481
  "factCheck",
474
- "suggestedPost"
482
+ "suggestedPost",
483
+ "guestChatViaFrom"
475
484
  ]);
476
485
  const Message$2 = /* @__PURE__ */ makeInspectable(Message$1, ["isScheduled"], ["link"]);
477
486
  export {
@@ -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.
@@ -118,6 +118,10 @@ class User {
118
118
  get canBotManageBots() {
119
119
  return this.raw.botCanManageBots;
120
120
  }
121
+ /** Whether this bot supports bot guest chats */
122
+ get isBotWithGuestChat() {
123
+ return this.raw.botGuestchat;
124
+ }
121
125
  /** Whether this user has been verified by Telegram */
122
126
  get isVerified() {
123
127
  return this.raw.verified;
@@ -87,6 +87,8 @@ export declare class User {
87
87
  get canBotManageForumTopics(): boolean;
88
88
  /** Whether this bot can manage other bots */
89
89
  get canBotManageBots(): boolean;
90
+ /** Whether this bot supports bot guest chats */
91
+ get isBotWithGuestChat(): boolean;
90
92
  /** Whether this user has been verified by Telegram */
91
93
  get isVerified(): boolean;
92
94
  /**
@@ -87,6 +87,8 @@ export declare class User {
87
87
  get canBotManageForumTopics(): boolean;
88
88
  /** Whether this bot can manage other bots */
89
89
  get canBotManageBots(): boolean;
90
+ /** Whether this bot supports bot guest chats */
91
+ get isBotWithGuestChat(): boolean;
90
92
  /** Whether this user has been verified by Telegram */
91
93
  get isVerified(): boolean;
92
94
  /**
@@ -111,6 +111,10 @@ class User {
111
111
  get canBotManageBots() {
112
112
  return this.raw.botCanManageBots;
113
113
  }
114
+ /** Whether this bot supports bot guest chats */
115
+ get isBotWithGuestChat() {
116
+ return this.raw.botGuestchat;
117
+ }
114
118
  /** Whether this user has been verified by Telegram */
115
119
  get isVerified() {
116
120
  return this.raw.verified;