@mtcute/core 0.12.2 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/cjs/highlevel/client.d.ts +83 -2
  2. package/cjs/highlevel/client.js +20 -1
  3. package/cjs/highlevel/client.js.map +1 -1
  4. package/cjs/highlevel/methods/_imports.js.map +1 -1
  5. package/cjs/highlevel/methods/_init.js +1 -1
  6. package/cjs/highlevel/methods/_init.js.map +1 -1
  7. package/cjs/highlevel/methods/bots/get-callback-answer.d.ts +11 -0
  8. package/cjs/highlevel/methods/bots/get-callback-answer.js +10 -2
  9. package/cjs/highlevel/methods/bots/get-callback-answer.js.map +1 -1
  10. package/cjs/highlevel/methods/chats/archive-chats.js +2 -1
  11. package/cjs/highlevel/methods/chats/archive-chats.js.map +1 -1
  12. package/cjs/highlevel/methods/dialogs/find-dialogs.d.ts +12 -0
  13. package/cjs/highlevel/methods/dialogs/find-dialogs.js +88 -0
  14. package/cjs/highlevel/methods/dialogs/find-dialogs.js.map +1 -0
  15. package/cjs/highlevel/methods/dialogs/get-peer-dialogs.js +2 -1
  16. package/cjs/highlevel/methods/dialogs/get-peer-dialogs.js.map +1 -1
  17. package/cjs/highlevel/methods/dialogs/iter-dialogs.js +3 -1
  18. package/cjs/highlevel/methods/dialogs/iter-dialogs.js.map +1 -1
  19. package/cjs/highlevel/methods/messages/_business-connection.d.ts +2 -1
  20. package/cjs/highlevel/methods/messages/_business-connection.js.map +1 -1
  21. package/cjs/highlevel/methods/messages/get-available-effects.d.ts +6 -0
  22. package/cjs/highlevel/methods/messages/get-available-effects.js +26 -0
  23. package/cjs/highlevel/methods/messages/get-available-effects.js.map +1 -0
  24. package/cjs/highlevel/methods/messages/get-fact-check.d.ts +11 -0
  25. package/cjs/highlevel/methods/messages/get-fact-check.js +27 -0
  26. package/cjs/highlevel/methods/messages/get-fact-check.js.map +1 -0
  27. package/cjs/highlevel/methods/messages/search-hashtag.d.ts +44 -0
  28. package/cjs/highlevel/methods/messages/search-hashtag.js +75 -0
  29. package/cjs/highlevel/methods/messages/search-hashtag.js.map +1 -0
  30. package/cjs/highlevel/methods/messages/send-common.d.ts +5 -0
  31. package/cjs/highlevel/methods/messages/send-common.js.map +1 -1
  32. package/cjs/highlevel/methods/messages/send-media-group.js +1 -0
  33. package/cjs/highlevel/methods/messages/send-media-group.js.map +1 -1
  34. package/cjs/highlevel/methods/messages/send-media.js +1 -0
  35. package/cjs/highlevel/methods/messages/send-media.js.map +1 -1
  36. package/cjs/highlevel/methods/messages/send-text.js +1 -0
  37. package/cjs/highlevel/methods/messages/send-text.js.map +1 -1
  38. package/cjs/highlevel/methods/misc/normalize-privacy-rules.js +2 -1
  39. package/cjs/highlevel/methods/misc/normalize-privacy-rules.js.map +1 -1
  40. package/cjs/highlevel/methods/users/resolve-peer-many.d.ts +6 -2
  41. package/cjs/highlevel/methods/users/resolve-peer-many.js +22 -6
  42. package/cjs/highlevel/methods/users/resolve-peer-many.js.map +1 -1
  43. package/cjs/highlevel/methods/users/resolve-peer.js +30 -11
  44. package/cjs/highlevel/methods/users/resolve-peer.js.map +1 -1
  45. package/cjs/highlevel/methods.d.ts +6 -0
  46. package/cjs/highlevel/methods.js +15 -4
  47. package/cjs/highlevel/methods.js.map +1 -1
  48. package/cjs/highlevel/types/conversation.js +1 -1
  49. package/cjs/highlevel/types/conversation.js.map +1 -1
  50. package/cjs/highlevel/types/messages/dialog.d.ts +2 -2
  51. package/cjs/highlevel/types/messages/dialog.js +2 -3
  52. package/cjs/highlevel/types/messages/dialog.js.map +1 -1
  53. package/cjs/highlevel/types/messages/fact-check.d.ts +30 -0
  54. package/cjs/highlevel/types/messages/fact-check.js +56 -0
  55. package/cjs/highlevel/types/messages/fact-check.js.map +1 -0
  56. package/cjs/highlevel/types/messages/index.d.ts +2 -0
  57. package/cjs/highlevel/types/messages/index.js +2 -0
  58. package/cjs/highlevel/types/messages/index.js.map +1 -1
  59. package/cjs/highlevel/types/messages/message-effect.d.ts +20 -0
  60. package/cjs/highlevel/types/messages/message-effect.js +69 -0
  61. package/cjs/highlevel/types/messages/message-effect.js.map +1 -0
  62. package/cjs/highlevel/types/messages/message-entity.d.ts +4 -1
  63. package/cjs/highlevel/types/messages/message-entity.js +1 -1
  64. package/cjs/highlevel/types/messages/message-entity.js.map +1 -1
  65. package/cjs/highlevel/types/messages/message.d.ts +12 -0
  66. package/cjs/highlevel/types/messages/message.js +23 -0
  67. package/cjs/highlevel/types/messages/message.js.map +1 -1
  68. package/cjs/network/client.d.ts +1 -2
  69. package/cjs/network/client.js +3 -3
  70. package/cjs/network/client.js.map +1 -1
  71. package/cjs/network/network-manager.js +1 -1
  72. package/cjs/network/session-connection.js +1 -1
  73. package/cjs/network/session-connection.js.map +1 -1
  74. package/cjs/platform.js +3 -7
  75. package/cjs/platform.js.map +1 -1
  76. package/esm/highlevel/client.d.ts +83 -2
  77. package/esm/highlevel/client.js +20 -1
  78. package/esm/highlevel/client.js.map +1 -1
  79. package/esm/highlevel/methods/_imports.js.map +1 -1
  80. package/esm/highlevel/methods/_init.js +1 -1
  81. package/esm/highlevel/methods/_init.js.map +1 -1
  82. package/esm/highlevel/methods/bots/get-callback-answer.d.ts +11 -0
  83. package/esm/highlevel/methods/bots/get-callback-answer.js +10 -2
  84. package/esm/highlevel/methods/bots/get-callback-answer.js.map +1 -1
  85. package/esm/highlevel/methods/chats/archive-chats.js +2 -1
  86. package/esm/highlevel/methods/chats/archive-chats.js.map +1 -1
  87. package/esm/highlevel/methods/dialogs/find-dialogs.d.ts +12 -0
  88. package/esm/highlevel/methods/dialogs/find-dialogs.js +84 -0
  89. package/esm/highlevel/methods/dialogs/find-dialogs.js.map +1 -0
  90. package/esm/highlevel/methods/dialogs/get-peer-dialogs.js +2 -1
  91. package/esm/highlevel/methods/dialogs/get-peer-dialogs.js.map +1 -1
  92. package/esm/highlevel/methods/dialogs/iter-dialogs.js +3 -1
  93. package/esm/highlevel/methods/dialogs/iter-dialogs.js.map +1 -1
  94. package/esm/highlevel/methods/messages/_business-connection.d.ts +2 -1
  95. package/esm/highlevel/methods/messages/_business-connection.js.map +1 -1
  96. package/esm/highlevel/methods/messages/get-available-effects.d.ts +6 -0
  97. package/esm/highlevel/methods/messages/get-available-effects.js +22 -0
  98. package/esm/highlevel/methods/messages/get-available-effects.js.map +1 -0
  99. package/esm/highlevel/methods/messages/get-fact-check.d.ts +11 -0
  100. package/esm/highlevel/methods/messages/get-fact-check.js +23 -0
  101. package/esm/highlevel/methods/messages/get-fact-check.js.map +1 -0
  102. package/esm/highlevel/methods/messages/search-hashtag.d.ts +44 -0
  103. package/esm/highlevel/methods/messages/search-hashtag.js +70 -0
  104. package/esm/highlevel/methods/messages/search-hashtag.js.map +1 -0
  105. package/esm/highlevel/methods/messages/send-common.d.ts +5 -0
  106. package/esm/highlevel/methods/messages/send-common.js.map +1 -1
  107. package/esm/highlevel/methods/messages/send-media-group.js +1 -0
  108. package/esm/highlevel/methods/messages/send-media-group.js.map +1 -1
  109. package/esm/highlevel/methods/messages/send-media.js +1 -0
  110. package/esm/highlevel/methods/messages/send-media.js.map +1 -1
  111. package/esm/highlevel/methods/messages/send-text.js +1 -0
  112. package/esm/highlevel/methods/messages/send-text.js.map +1 -1
  113. package/esm/highlevel/methods/misc/normalize-privacy-rules.js +2 -1
  114. package/esm/highlevel/methods/misc/normalize-privacy-rules.js.map +1 -1
  115. package/esm/highlevel/methods/users/resolve-peer-many.d.ts +6 -2
  116. package/esm/highlevel/methods/users/resolve-peer-many.js +22 -6
  117. package/esm/highlevel/methods/users/resolve-peer-many.js.map +1 -1
  118. package/esm/highlevel/methods/users/resolve-peer.js +30 -11
  119. package/esm/highlevel/methods/users/resolve-peer.js.map +1 -1
  120. package/esm/highlevel/methods.d.ts +6 -0
  121. package/esm/highlevel/methods.js +5 -0
  122. package/esm/highlevel/methods.js.map +1 -1
  123. package/esm/highlevel/types/conversation.js +1 -1
  124. package/esm/highlevel/types/conversation.js.map +1 -1
  125. package/esm/highlevel/types/messages/dialog.d.ts +2 -2
  126. package/esm/highlevel/types/messages/dialog.js +2 -3
  127. package/esm/highlevel/types/messages/dialog.js.map +1 -1
  128. package/esm/highlevel/types/messages/fact-check.d.ts +30 -0
  129. package/esm/highlevel/types/messages/fact-check.js +53 -0
  130. package/esm/highlevel/types/messages/fact-check.js.map +1 -0
  131. package/esm/highlevel/types/messages/index.d.ts +2 -0
  132. package/esm/highlevel/types/messages/index.js +2 -0
  133. package/esm/highlevel/types/messages/index.js.map +1 -1
  134. package/esm/highlevel/types/messages/message-effect.d.ts +20 -0
  135. package/esm/highlevel/types/messages/message-effect.js +66 -0
  136. package/esm/highlevel/types/messages/message-effect.js.map +1 -0
  137. package/esm/highlevel/types/messages/message-entity.d.ts +4 -1
  138. package/esm/highlevel/types/messages/message-entity.js +1 -1
  139. package/esm/highlevel/types/messages/message-entity.js.map +1 -1
  140. package/esm/highlevel/types/messages/message.d.ts +12 -0
  141. package/esm/highlevel/types/messages/message.js +23 -0
  142. package/esm/highlevel/types/messages/message.js.map +1 -1
  143. package/esm/network/client.d.ts +1 -2
  144. package/esm/network/client.js +3 -3
  145. package/esm/network/client.js.map +1 -1
  146. package/esm/network/network-manager.js +1 -1
  147. package/esm/network/session-connection.js +1 -1
  148. package/esm/network/session-connection.js.map +1 -1
  149. package/esm/platform.js +3 -7
  150. package/esm/platform.js.map +1 -1
  151. package/package.json +4 -4
package/cjs/platform.js CHANGED
@@ -9,14 +9,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.getPlatform = exports.setPlatform = void 0;
10
10
  const tl_runtime_1 = require("@mtcute/tl-runtime");
11
11
  const errors_js_1 = require("./types/errors.js");
12
- // eslint-disable-next-line
13
- const globalObject = (0, eval)('this');
14
12
  // NB: when using with some bundlers (e.g. vite) re-importing this module will not return the same object
15
13
  // so we need to store the platform in a global object to be able to survive hot-reloads etc.
16
14
  // try to use Symbol if available, otherwise fallback to a string
17
15
  const platformKey = typeof Symbol !== 'undefined' ? Symbol.for('mtcute.platform') : '__MTCUTE_PLATFORM__';
18
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
19
- let _platform = globalObject?.[platformKey] ?? null;
16
+ // eslint-disable-next-line
17
+ let _platform = globalThis?.[platformKey] ?? null;
20
18
  function setPlatform(platform) {
21
19
  if (_platform) {
22
20
  if (_platform.constructor !== platform.constructor) {
@@ -27,9 +25,7 @@ function setPlatform(platform) {
27
25
  _platform = platform;
28
26
  tl_runtime_1.TlBinaryReader.platform = platform;
29
27
  tl_runtime_1.TlBinaryWriter.platform = platform;
30
- if (globalObject) {
31
- globalObject[platformKey] = platform;
32
- }
28
+ globalThis[platformKey] = platform;
33
29
  }
34
30
  exports.setPlatform = setPlatform;
35
31
  function getPlatform() {
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/platform.ts"],"names":[],"mappings":";;;AAAA,mDAAgF;AAGhF,iDAAsD;AAiBtD,2BAA2B;AAC3B,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtC,yGAAyG;AACzG,6FAA6F;AAC7F,iEAAiE;AACjE,MAAM,WAAW,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAA;AAEzG,mEAAmE;AACnE,IAAI,SAAS,GAAyB,YAAY,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,CAAA;AAEzE,SAAgB,WAAW,CAAC,QAAuB;IAC/C,IAAI,SAAS,EAAE,CAAC;QACZ,IAAI,SAAS,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,IAAI,8BAAkB,CAAC,yCAAyC,CAAC,CAAA;QAC3E,CAAC;QAED,OAAM;IACV,CAAC;IAED,SAAS,GAAG,QAAQ,CAAA;IACpB,2BAAc,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAClC,2BAAc,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAElC,IAAI,YAAY,EAAE,CAAC;QACf,YAAY,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAA;IACxC,CAAC;AACL,CAAC;AAhBD,kCAgBC;AAED,SAAgB,WAAW;IACvB,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,8BAAkB,CAAC,wDAAwD,CAAC,CAAA;IAC1F,CAAC;IAED,OAAO,SAAS,CAAA;AACpB,CAAC;AAND,kCAMC","sourcesContent":["import { ITlPlatform, TlBinaryReader, TlBinaryWriter } from '@mtcute/tl-runtime'\n\nimport { UploadFileLike } from './highlevel/types/files/utils.js'\nimport { MtUnsupportedError } from './types/errors.js'\nimport { MaybePromise } from './types/index.js'\n\nexport interface ICorePlatform extends ITlPlatform {\n beforeExit(fn: () => void): () => void\n log(color: number, level: number, tag: string, fmt: string, args: unknown[]): void\n getDefaultLogLevel(): number | null\n getDeviceModel(): string\n normalizeFile?(file: UploadFileLike): MaybePromise<{\n file?: UploadFileLike\n fileSize?: number\n fileName?: string\n } | null>\n onNetworkChanged?(fn: (connected: boolean) => void): () => void\n isOnline?(): boolean\n}\n\n// eslint-disable-next-line\nconst globalObject = (0, eval)('this')\n\n// NB: when using with some bundlers (e.g. vite) re-importing this module will not return the same object\n// so we need to store the platform in a global object to be able to survive hot-reloads etc.\n// try to use Symbol if available, otherwise fallback to a string\nconst platformKey = typeof Symbol !== 'undefined' ? Symbol.for('mtcute.platform') : '__MTCUTE_PLATFORM__'\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nlet _platform: ICorePlatform | null = globalObject?.[platformKey] ?? null\n\nexport function setPlatform(platform: ICorePlatform): void {\n if (_platform) {\n if (_platform.constructor !== platform.constructor) {\n throw new MtUnsupportedError('Platform may not be changed at runtime!')\n }\n\n return\n }\n\n _platform = platform\n TlBinaryReader.platform = platform\n TlBinaryWriter.platform = platform\n\n if (globalObject) {\n globalObject[platformKey] = platform\n }\n}\n\nexport function getPlatform(): ICorePlatform {\n if (!_platform) {\n throw new MtUnsupportedError('Platform is not set! Have you instantiated the client?')\n }\n\n return _platform\n}\n"]}
1
+ {"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/platform.ts"],"names":[],"mappings":";;;AAAA,mDAAgF;AAGhF,iDAAsD;AAiBtD,yGAAyG;AACzG,6FAA6F;AAC7F,iEAAiE;AACjE,MAAM,WAAW,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAA;AAEzG,2BAA2B;AAC3B,IAAI,SAAS,GAA0B,UAAkB,EAAE,CAAC,WAAW,CAAC,IAAI,IAAI,CAAA;AAEhF,SAAgB,WAAW,CAAC,QAAuB;IAC/C,IAAI,SAAS,EAAE,CAAC;QACZ,IAAI,SAAS,CAAC,WAAW,KAAK,QAAQ,CAAC,WAAW,EAAE,CAAC;YACjD,MAAM,IAAI,8BAAkB,CAAC,yCAAyC,CAAC,CAAA;QAC3E,CAAC;QAED,OAAM;IACV,CAAC;IAED,SAAS,GAAG,QAAQ,CAAA;IACpB,2BAAc,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAClC,2BAAc,CAAC,QAAQ,GAAG,QAAQ,CAGjC;IAAC,UAAkB,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAA;AAChD,CAAC;AAfD,kCAeC;AAED,SAAgB,WAAW;IACvB,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,8BAAkB,CAAC,wDAAwD,CAAC,CAAA;IAC1F,CAAC;IAED,OAAO,SAAS,CAAA;AACpB,CAAC;AAND,kCAMC","sourcesContent":["import { ITlPlatform, TlBinaryReader, TlBinaryWriter } from '@mtcute/tl-runtime'\n\nimport { UploadFileLike } from './highlevel/types/files/utils.js'\nimport { MtUnsupportedError } from './types/errors.js'\nimport { MaybePromise } from './types/index.js'\n\nexport interface ICorePlatform extends ITlPlatform {\n beforeExit(fn: () => void): () => void\n log(color: number, level: number, tag: string, fmt: string, args: unknown[]): void\n getDefaultLogLevel(): number | null\n getDeviceModel(): string\n normalizeFile?(file: UploadFileLike): MaybePromise<{\n file?: UploadFileLike\n fileSize?: number\n fileName?: string\n } | null>\n onNetworkChanged?(fn: (connected: boolean) => void): () => void\n isOnline?(): boolean\n}\n\n// NB: when using with some bundlers (e.g. vite) re-importing this module will not return the same object\n// so we need to store the platform in a global object to be able to survive hot-reloads etc.\n// try to use Symbol if available, otherwise fallback to a string\nconst platformKey = typeof Symbol !== 'undefined' ? Symbol.for('mtcute.platform') : '__MTCUTE_PLATFORM__'\n\n// eslint-disable-next-line\nlet _platform: ICorePlatform | null = (globalThis as any)?.[platformKey] ?? null\n\nexport function setPlatform(platform: ICorePlatform): void {\n if (_platform) {\n if (_platform.constructor !== platform.constructor) {\n throw new MtUnsupportedError('Platform may not be changed at runtime!')\n }\n\n return\n }\n\n _platform = platform\n TlBinaryReader.platform = platform\n TlBinaryWriter.platform = platform\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ;(globalThis as any)[platformKey] = platform\n}\n\nexport function getPlatform(): ICorePlatform {\n if (!_platform) {\n throw new MtUnsupportedError('Platform is not set! Have you instantiated the client?')\n }\n\n return _platform\n}\n"]}
@@ -18,6 +18,7 @@ import { ForwardMessageOptions } from './methods/messages/forward-messages.js';
18
18
  import { getHistory, GetHistoryOffset } from './methods/messages/get-history.js';
19
19
  import { getReactionUsers, GetReactionUsersOffset } from './methods/messages/get-reaction-users.js';
20
20
  import { searchGlobal, SearchGlobalOffset } from './methods/messages/search-global.js';
21
+ import { searchHashtag, SearchHashtagOffset } from './methods/messages/search-hashtag.js';
21
22
  import { searchMessages, SearchMessagesOffset } from './methods/messages/search-messages.js';
22
23
  import { CommonSendParams } from './methods/messages/send-common.js';
23
24
  import { SendCopyParams } from './methods/messages/send-copy.js';
@@ -34,7 +35,7 @@ import { getProfileStories } from './methods/stories/get-profile-stories.js';
34
35
  import { getStoryViewers } from './methods/stories/get-story-viewers.js';
35
36
  import { getProfilePhotos } from './methods/users/get-profile-photos.js';
36
37
  import { ITelegramStorageProvider } from './storage/provider.js';
37
- import { AllStories, ArrayPaginated, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStickerSet, InputStickerSetItem, InputText, MaybeDynamic, Message, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, PeerReaction, PeersIndex, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SentCode, Sticker, StickerSet, StickerSourceType, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate } from './types/index.js';
38
+ import { AllStories, ArrayPaginated, ArrayWithTotal, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputFileLike, InputInlineResult, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStickerSet, InputStickerSetItem, InputText, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, PeerReaction, PeersIndex, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SentCode, Sticker, StickerSet, StickerSourceType, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate } from './types/index.js';
38
39
  import { ParsedUpdateHandlerParams } from './updates/parsed.js';
39
40
  import { StringSessionData } from './utils/string-session.js';
40
41
  type TelegramClientOptions = ((PartialOnly<Omit<BaseTelegramClientOptions, 'storage'>, 'transport' | 'crypto'> & {
@@ -698,6 +699,17 @@ export interface TelegramClient extends ITelegramClient {
698
699
  * @default `10000` (10 sec)
699
700
  */
700
701
  timeout?: number;
702
+ /**
703
+ * Whether to "fire and forget" this request,
704
+ * in which case the promise will resolve as soon
705
+ * as the request is sent with an empty response.
706
+ *
707
+ * Useful for interacting with bots that don't correctly
708
+ * answer to callback queries and the request always times out.
709
+ *
710
+ * **Note**: any errors will be silently ignored.
711
+ */
712
+ fireAndForget?: boolean;
701
713
  /**
702
714
  * Whether this is a "play game" button
703
715
  */
@@ -1723,6 +1735,17 @@ export interface TelegramClient extends ITelegramClient {
1723
1735
  /** Modification to be applied to this folder */
1724
1736
  modification: Partial<Omit<tl.RawDialogFilter, 'id' | '_'>>;
1725
1737
  }): Promise<tl.RawDialogFilter>;
1738
+ /**
1739
+ * Try to find a dialog (dialogs) with a given peer (peers) by their ID, username or phone number.
1740
+ *
1741
+ * This might be an expensive call, as it will potentially iterate over all
1742
+ * dialogs to find the one with the given peer
1743
+ *
1744
+ * **Available**: 👤 users only
1745
+ *
1746
+ * @throws {MtPeerNotFoundError} If a dialog with any of the given peers was not found
1747
+ */
1748
+ findDialogs(peers: MaybeArray<string | number>): Promise<Dialog[]>;
1726
1749
  /**
1727
1750
  * Find a folder by its parameter.
1728
1751
  *
@@ -2678,6 +2701,12 @@ export interface TelegramClient extends ITelegramClient {
2678
2701
  * @param chatId Chat's marked ID, its username, phone or `"me"` or `"self"`
2679
2702
  */
2680
2703
  getAllScheduledMessages(chatId: InputPeerLike): Promise<Message[]>;
2704
+ /**
2705
+ * Get a list of available message effects
2706
+ * **Available**: 👤 users only
2707
+ *
2708
+ */
2709
+ getAvailableMessageEffects(): Promise<MessageEffect[]>;
2681
2710
  /**
2682
2711
  * Get the message containing the button being clicked
2683
2712
  * in the given callback query.
@@ -2706,6 +2735,15 @@ export interface TelegramClient extends ITelegramClient {
2706
2735
  * @param message ID of the channel post
2707
2736
  */
2708
2737
  getDiscussionMessage(params: InputMessageId): Promise<Message | null>;
2738
+ /**
2739
+ * Get fact check information for one or more messages in a chat
2740
+ *
2741
+ * **Available**: 👤 users only
2742
+ *
2743
+ * @param chatId Chat where the messages are located
2744
+ * @param msgIds One or more message IDs
2745
+ */
2746
+ getFactCheck(chatId: InputPeerLike, msgIds: MaybeArray<number>): Promise<(FactCheck | null)[]>;
2709
2747
  /**
2710
2748
  * Get chat history.
2711
2749
  *
@@ -3077,6 +3115,45 @@ export interface TelegramClient extends ITelegramClient {
3077
3115
  */
3078
3116
  onlyChannels?: boolean;
3079
3117
  }): Promise<ArrayPaginated<Message, SearchGlobalOffset>>;
3118
+ /**
3119
+ * Perform a global hashtag search, across the entire Telegram
3120
+ *
3121
+ * **Available**: 👤 users only
3122
+ *
3123
+ * @param hashtag Hashtag to search for
3124
+ * @param params Additional parameters
3125
+ */
3126
+ searchHashtag(hashtag: string, params?: {
3127
+ /** Offset for the search */
3128
+ offset?: SearchHashtagOffset;
3129
+ /** Limit the number of results */
3130
+ limit?: number;
3131
+ }): Promise<ArrayPaginated<Message, SearchHashtagOffset>>;
3132
+ /**
3133
+ * Perform a global hashtag search, across the entire Telegram
3134
+ *
3135
+ * Iterable version of {@link searchHashtag}
3136
+ *
3137
+ * **Available**: ✅ both users and bots
3138
+ *
3139
+ * @param hashtag Hashtag to search for
3140
+ * @param params Additional parameters
3141
+ */
3142
+ iterSearchHashtag(hashtag: string, params?: Parameters<typeof searchHashtag>[2] & {
3143
+ /**
3144
+ * Limits the number of messages to be retrieved.
3145
+ *
3146
+ * @default `Infinity`, i.e. all messages are returned
3147
+ */
3148
+ limit?: number;
3149
+ /**
3150
+ * Chunk size, which will be passed as `limit` parameter
3151
+ * for `messages.search`. Usually you shouldn't care about this.
3152
+ *
3153
+ * @default 100
3154
+ */
3155
+ chunkSize?: number;
3156
+ }): AsyncIterableIterator<Message>;
3080
3157
  /**
3081
3158
  * Search for messages inside a specific chat
3082
3159
  *
@@ -4471,6 +4548,8 @@ export interface TelegramClient extends ITelegramClient {
4471
4548
  * while also normalizing and removing
4472
4549
  * peers that can't be normalized to that type.
4473
4550
  *
4551
+ * If a peer was not found, it will be skipped.
4552
+ *
4474
4553
  * Uses async pool internally, with a concurrent limit of 8
4475
4554
  *
4476
4555
  * @param peerIds Peer Ids
@@ -4480,11 +4559,13 @@ export interface TelegramClient extends ITelegramClient {
4480
4559
  /**
4481
4560
  * Get multiple `InputPeer`s at once.
4482
4561
  *
4562
+ * If a peer was not found, `null` will be returned instead
4563
+ *
4483
4564
  * Uses async pool internally, with a concurrent limit of 8
4484
4565
  *
4485
4566
  * @param peerIds Peer Ids
4486
4567
  */
4487
- resolvePeerMany(peerIds: InputPeerLike[]): Promise<tl.TypeInputPeer[]>;
4568
+ resolvePeerMany(peerIds: InputPeerLike[]): Promise<(tl.TypeInputPeer | null)[]>;
4488
4569
  /**
4489
4570
  * Get the `InputPeer` of a known peer id.
4490
4571
  * Useful when an `InputPeer` is needed in Raw API.
@@ -82,6 +82,7 @@ import { importContacts } from './methods/contacts/import-contacts.js';
82
82
  import { createFolder } from './methods/dialogs/create-folder.js';
83
83
  import { deleteFolder } from './methods/dialogs/delete-folder.js';
84
84
  import { editFolder } from './methods/dialogs/edit-folder.js';
85
+ import { findDialogs } from './methods/dialogs/find-dialogs.js';
85
86
  import { findFolder } from './methods/dialogs/find-folder.js';
86
87
  import { getFolders } from './methods/dialogs/get-folders.js';
87
88
  import { getPeerDialogs } from './methods/dialogs/get-peer-dialogs.js';
@@ -124,8 +125,10 @@ import { editInlineMessage } from './methods/messages/edit-inline-message.js';
124
125
  import { editMessage } from './methods/messages/edit-message.js';
125
126
  import { forwardMessages, forwardMessagesById } from './methods/messages/forward-messages.js';
126
127
  import { getAllScheduledMessages } from './methods/messages/get-all-scheduled-messages.js';
128
+ import { getAvailableMessageEffects } from './methods/messages/get-available-effects.js';
127
129
  import { getCallbackQueryMessage } from './methods/messages/get-callback-query-message.js';
128
130
  import { getDiscussionMessage } from './methods/messages/get-discussion-message.js';
131
+ import { getFactCheck } from './methods/messages/get-fact-check.js';
129
132
  import { getHistory } from './methods/messages/get-history.js';
130
133
  import { getMessageByLink } from './methods/messages/get-message-by-link.js';
131
134
  import { getMessageGroup } from './methods/messages/get-message-group.js';
@@ -143,6 +146,7 @@ import { pinMessage } from './methods/messages/pin-message.js';
143
146
  import { readHistory } from './methods/messages/read-history.js';
144
147
  import { readReactions } from './methods/messages/read-reactions.js';
145
148
  import { searchGlobal } from './methods/messages/search-global.js';
149
+ import { iterSearchHashtag, searchHashtag } from './methods/messages/search-hashtag.js';
146
150
  import { searchMessages } from './methods/messages/search-messages.js';
147
151
  import { answerMedia, answerMediaGroup, answerText } from './methods/messages/send-answer.js';
148
152
  import { commentMedia, commentMediaGroup, commentText } from './methods/messages/send-comment.js';
@@ -260,7 +264,7 @@ export class TelegramClient extends EventEmitter {
260
264
  this._client.onUpdate(makeParsedUpdateHandler({
261
265
  messageGroupingInterval,
262
266
  onUpdate: (update) => {
263
- if (Conversation.handleUpdate(this._client, update) && skipConversationUpdates)
267
+ if (Conversation.handleUpdate(this, update) && skipConversationUpdates)
264
268
  return;
265
269
  this.emit('update', update);
266
270
  this.emit(update.name, update.data);
@@ -524,6 +528,9 @@ TelegramClient.prototype.deleteFolder = function (...args) {
524
528
  TelegramClient.prototype.editFolder = function (...args) {
525
529
  return editFolder(this._client, ...args);
526
530
  };
531
+ TelegramClient.prototype.findDialogs = function (...args) {
532
+ return findDialogs(this._client, ...args);
533
+ };
527
534
  TelegramClient.prototype.findFolder = function (...args) {
528
535
  return findFolder(this._client, ...args);
529
536
  };
@@ -656,12 +663,18 @@ TelegramClient.prototype.forwardMessages = function (...args) {
656
663
  TelegramClient.prototype.getAllScheduledMessages = function (...args) {
657
664
  return getAllScheduledMessages(this._client, ...args);
658
665
  };
666
+ TelegramClient.prototype.getAvailableMessageEffects = function (...args) {
667
+ return getAvailableMessageEffects(this._client, ...args);
668
+ };
659
669
  TelegramClient.prototype.getCallbackQueryMessage = function (...args) {
660
670
  return getCallbackQueryMessage(this._client, ...args);
661
671
  };
662
672
  TelegramClient.prototype.getDiscussionMessage = function (...args) {
663
673
  return getDiscussionMessage(this._client, ...args);
664
674
  };
675
+ TelegramClient.prototype.getFactCheck = function (...args) {
676
+ return getFactCheck(this._client, ...args);
677
+ };
665
678
  TelegramClient.prototype.getHistory = function (...args) {
666
679
  return getHistory(this._client, ...args);
667
680
  };
@@ -716,6 +729,12 @@ TelegramClient.prototype.readReactions = function (...args) {
716
729
  TelegramClient.prototype.searchGlobal = function (...args) {
717
730
  return searchGlobal(this._client, ...args);
718
731
  };
732
+ TelegramClient.prototype.searchHashtag = function (...args) {
733
+ return searchHashtag(this._client, ...args);
734
+ };
735
+ TelegramClient.prototype.iterSearchHashtag = function (...args) {
736
+ return iterSearchHashtag(this._client, ...args);
737
+ };
719
738
  TelegramClient.prototype.searchMessages = function (...args) {
720
739
  return searchMessages(this._client, ...args);
721
740
  };