@mtcute/core 0.15.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/highlevel/methods/messages/edit-inline-message.js +1 -1
- package/cjs/highlevel/methods/messages/edit-inline-message.js.map +1 -1
- package/cjs/highlevel/methods/messages/edit-message.js +1 -1
- package/cjs/highlevel/methods/messages/edit-message.js.map +1 -1
- package/cjs/network/network-manager.js +1 -1
- package/esm/highlevel/methods/messages/edit-inline-message.js +1 -1
- package/esm/highlevel/methods/messages/edit-inline-message.js.map +1 -1
- package/esm/highlevel/methods/messages/edit-message.js +1 -1
- package/esm/highlevel/methods/messages/edit-message.js.map +1 -1
- package/esm/network/network-manager.js +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ async function editInlineMessage(client, params) {
|
|
|
27
27
|
[content, entities] = await (0, normalize_text_js_1._normalizeInputText)(client, params.media.caption);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
else if (params.text) {
|
|
30
|
+
else if (params.text !== undefined) {
|
|
31
31
|
[content, entities] = await (0, normalize_text_js_1._normalizeInputText)(client, params.text);
|
|
32
32
|
}
|
|
33
33
|
let retries = 3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-inline-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-inline-message.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAG/B,mDAA0F;AAC1F,iEAA+D;AAC/D,gFAAwE;AACxE,iEAA+D;AAE/D;;;;;;;GAOG;AACI,KAAK,UAAU,iBAAiB,CACnC,MAAuB,EACvB,MA6CC;IAED,IAAI,OAAO,GAAuB,SAAS,CAAA;IAC3C,IAAI,QAA4C,CAAA;IAChD,IAAI,KAAK,GAAkC,SAAS,CAAA;IAEpD,MAAM,EAAE,GAAG,IAAA,mCAAiB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAE9C,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,MAAM,IAAA,+CAAoB,EAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAEtE,wEAAwE;QACxE,+EAA+E;QAC/E,IAAI,SAAS,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClE,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,IAAA,uCAAmB,EAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjF,CAAC;IACL,CAAC;SAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"edit-inline-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-inline-message.ts"],"names":[],"mappings":";;;AAAA,mCAA+B;AAG/B,mDAA0F;AAC1F,iEAA+D;AAC/D,gFAAwE;AACxE,iEAA+D;AAE/D;;;;;;;GAOG;AACI,KAAK,UAAU,iBAAiB,CACnC,MAAuB,EACvB,MA6CC;IAED,IAAI,OAAO,GAAuB,SAAS,CAAA;IAC3C,IAAI,QAA4C,CAAA;IAChD,IAAI,KAAK,GAAkC,SAAS,CAAA;IAEpD,MAAM,EAAE,GAAG,IAAA,mCAAiB,EAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAE9C,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,MAAM,IAAA,+CAAoB,EAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAEtE,wEAAwE;QACxE,+EAA+E;QAC/E,IAAI,SAAS,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClE,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,IAAA,uCAAmB,EAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjF,CAAC;IACL,CAAC;SAAM,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QACnC,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,IAAA,uCAAmB,EAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;IAED,IAAI,OAAO,GAAG,CAAC,CAAA;IAEf,OAAO,OAAO,EAAE,EAAE,CAAC;QACf,IAAI,CAAC;YACD,MAAM,MAAM,CAAC,IAAI,CACb;gBACI,CAAC,EAAE,+BAA+B;gBAClC,EAAE;gBACF,SAAS,EAAE,MAAM,CAAC,iBAAiB;gBACnC,WAAW,EAAE,sBAAW,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC;gBACzD,OAAO,EAAE,OAAO;gBAChB,QAAQ;gBACR,KAAK;gBACL,WAAW,EAAE,MAAM,CAAC,WAAW;aAClC,EACD,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CACpB,CAAA;YAED,OAAM;QACV,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,IAAI,OAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,CAAC;gBACnC,SAAQ;YACZ,CAAC;YAED,MAAM,CAAC,CAAA;QACX,CAAC;IACL,CAAC;AACL,CAAC;AA9FD,8CA8FC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { ITelegramClient } from '../../client.types.js'\nimport { BotKeyboard, InputMediaLike, InputText, ReplyMarkup } from '../../types/index.js'\nimport { normalizeInlineId } from '../../utils/inline-utils.js'\nimport { _normalizeInputMedia } from '../files/normalize-input-media.js'\nimport { _normalizeInputText } from '../misc/normalize-text.js'\n\n/**\n * Edit sent inline message text, media and reply markup.\n *\n * @param messageId\n * Inline message ID, either as a TL object, or as a\n * TDLib and Bot API compatible string\n * @param params\n */\nexport async function editInlineMessage(\n client: ITelegramClient,\n params: {\n /**\n * Inline message ID, either as a TL object, or as a\n * TDLib and Bot API compatible string\n */\n messageId: tl.TypeInputBotInlineMessageID | string\n\n /**\n * New message text\n *\n * When `media` is passed, `media.caption` is used instead\n */\n text?: InputText\n\n /**\n * New message media\n */\n media?: InputMediaLike\n\n /**\n * Whether to disable links preview in this message\n */\n disableWebPreview?: boolean\n\n /**\n * Whether to invert media position.\n *\n * Currently only supported for web previews and makes the\n * client render the preview above the caption and not below.\n */\n invertMedia?: boolean\n\n /**\n * For bots: new reply markup.\n * If omitted, existing markup will be removed.\n */\n replyMarkup?: ReplyMarkup\n\n /**\n * For media, upload progress callback.\n *\n * @param uploaded Number of bytes uploaded\n * @param total Total file size in bytes\n */\n progressCallback?: (uploaded: number, total: number) => void\n },\n): Promise<void> {\n let content: string | undefined = undefined\n let entities: tl.TypeMessageEntity[] | undefined\n let media: tl.TypeInputMedia | undefined = undefined\n\n const id = normalizeInlineId(params.messageId)\n\n if (params.media) {\n media = await _normalizeInputMedia(client, params.media, params, true)\n\n // if there's no caption in input media (i.e. not present or undefined),\n // user wants to keep current caption, thus `content` needs to stay `undefined`\n if ('caption' in params.media && params.media.caption !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.media.caption)\n }\n } else if (params.text !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.text)\n }\n\n let retries = 3\n\n while (retries--) {\n try {\n await client.call(\n {\n _: 'messages.editInlineBotMessage',\n id,\n noWebpage: params.disableWebPreview,\n replyMarkup: BotKeyboard._convertToTl(params.replyMarkup),\n message: content,\n entities,\n media,\n invertMedia: params.invertMedia,\n },\n { dcId: id.dcId },\n )\n\n return\n } catch (e) {\n if (tl.RpcError.is(e, 'MEDIA_EMPTY')) {\n continue\n }\n\n throw e\n }\n }\n}\n"]}
|
|
@@ -27,7 +27,7 @@ async function editMessage(client, params) {
|
|
|
27
27
|
[content, entities] = await (0, normalize_text_js_1._normalizeInputText)(client, params.media.caption);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
if (params.text) {
|
|
30
|
+
if (params.text !== undefined) {
|
|
31
31
|
[content, entities] = await (0, normalize_text_js_1._normalizeInputText)(client, params.text);
|
|
32
32
|
}
|
|
33
33
|
const res = await (0, _business_connection_js_1._maybeInvokeWithBusinessConnection)(client, params.businessConnectionId, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-message.ts"],"names":[],"mappings":";;;AAGA,mDAQ6B;AAC7B,gFAAwE;AACxE,iEAA+D;AAC/D,8DAAsD;AACtD,uEAA8E;AAC9E,2DAA0D;AAE1D;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC7B,MAAuB,EACvB,MAqDC;IAED,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,kCAAuB,EAAC,MAAM,CAAC,CAAA;IAC3D,IAAI,OAAO,GAAuB,SAAS,CAAA;IAC3C,IAAI,QAA4C,CAAA;IAChD,IAAI,KAAK,GAAkC,SAAS,CAAA;IAEpD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,MAAM,IAAA,+CAAoB,EAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAEhE,wEAAwE;QACxE,+EAA+E;QAC/E,IAAI,SAAS,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClE,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,IAAA,uCAAmB,EAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjF,CAAC;IACL,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"edit-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-message.ts"],"names":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C,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC;QACzD,OAAO,EAAE,OAAO;QAChB,QAAQ;QACR,KAAK;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;KAClC,CAAC,CAAA;IAEF,OAAO,IAAA,wCAAoB,EAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;AAC1E,CAAC;AAzFD,kCAyFC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { ITelegramClient } from '../../client.types.js'\nimport {\n BotKeyboard,\n InputMediaLike,\n InputMessageId,\n InputText,\n Message,\n normalizeInputMessageId,\n ReplyMarkup,\n} from '../../types/index.js'\nimport { _normalizeInputMedia } from '../files/normalize-input-media.js'\nimport { _normalizeInputText } from '../misc/normalize-text.js'\nimport { resolvePeer } from '../users/resolve-peer.js'\nimport { _maybeInvokeWithBusinessConnection } from './_business-connection.js'\nimport { _findMessageInUpdate } from './find-in-update.js'\n\n/**\n * Edit message text, media, reply markup and schedule date.\n *\n * @param chatId ID of the chat, its username, phone or `\"me\"` or `\"self\"`\n * @param message Message or its ID\n * @param params\n */\nexport async function editMessage(\n client: ITelegramClient,\n params: InputMessageId & {\n /**\n * New message text\n *\n * When `media` is passed, `media.caption` is used instead\n */\n text?: InputText\n\n /**\n * New message media\n */\n media?: InputMediaLike\n\n /**\n * Whether to disable links preview in this message\n */\n disableWebPreview?: boolean\n\n /**\n * For bots: new reply markup.\n * If omitted, existing markup will be removed.\n */\n replyMarkup?: ReplyMarkup\n\n /**\n * To re-schedule a message: new schedule date.\n * When passing a number, a UNIX time in ms is expected.\n */\n scheduleDate?: Date | number\n\n /**\n * For media, upload progress callback.\n *\n * @param uploaded Number of bytes uploaded\n * @param total Total file size in bytes\n */\n progressCallback?: (uploaded: number, total: number) => void\n\n /**\n * Whether to dispatch the edit message event\n * to the client's update handler.\n */\n shouldDispatch?: true\n\n /**\n * Whether to invert media position.\n *\n * Currently only supported for web previews and makes the\n * client render the preview above the caption and not below.\n */\n invertMedia?: boolean\n\n businessConnectionId?: string\n },\n): Promise<Message> {\n const { chatId, message } = normalizeInputMessageId(params)\n let content: string | undefined = undefined\n let entities: tl.TypeMessageEntity[] | undefined\n let media: tl.TypeInputMedia | undefined = undefined\n\n if (params.media) {\n media = await _normalizeInputMedia(client, params.media, params)\n\n // if there's no caption in input media (i.e. not present or undefined),\n // user wants to keep current caption, thus `content` needs to stay `undefined`\n if ('caption' in params.media && params.media.caption !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.media.caption)\n }\n }\n\n if (params.text !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.text)\n }\n\n const res = await _maybeInvokeWithBusinessConnection(client, params.businessConnectionId, {\n _: 'messages.editMessage',\n id: message,\n peer: await resolvePeer(client, chatId),\n noWebpage: params.disableWebPreview,\n replyMarkup: BotKeyboard._convertToTl(params.replyMarkup),\n message: content,\n entities,\n media,\n invertMedia: params.invertMedia,\n })\n\n return _findMessageInUpdate(client, res, true, !params.shouldDispatch)\n}\n"]}
|
|
@@ -24,7 +24,7 @@ export async function editInlineMessage(client, params) {
|
|
|
24
24
|
[content, entities] = await _normalizeInputText(client, params.media.caption);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
else if (params.text) {
|
|
27
|
+
else if (params.text !== undefined) {
|
|
28
28
|
[content, entities] = await _normalizeInputText(client, params.text);
|
|
29
29
|
}
|
|
30
30
|
let retries = 3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-inline-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-inline-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAG/B,OAAO,EAAE,WAAW,EAA0C,MAAM,sBAAsB,CAAA;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,MAAuB,EACvB,MA6CC;IAED,IAAI,OAAO,GAAuB,SAAS,CAAA;IAC3C,IAAI,QAA4C,CAAA;IAChD,IAAI,KAAK,GAAkC,SAAS,CAAA;IAEpD,MAAM,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IAE9C,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAEtE,wEAAwE;QACxE,+EAA+E;QAC/E,IAAI,SAAS,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClE,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjF,CAAC;IACL,CAAC;SAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"edit-inline-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-inline-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAG/B,OAAO,EAAE,WAAW,EAA0C,MAAM,sBAAsB,CAAA;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE/D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACnC,MAAuB,EACvB,MA6CC;IAED,IAAI,OAAO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AE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,CAAC;gBACnC,SAAQ;YACZ,CAAC;YAED,MAAM,CAAC,CAAA;QACX,CAAC;IACL,CAAC;AACL,CAAC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { ITelegramClient } from '../../client.types.js'\nimport { BotKeyboard, InputMediaLike, InputText, ReplyMarkup } from '../../types/index.js'\nimport { normalizeInlineId } from '../../utils/inline-utils.js'\nimport { _normalizeInputMedia } from '../files/normalize-input-media.js'\nimport { _normalizeInputText } from '../misc/normalize-text.js'\n\n/**\n * Edit sent inline message text, media and reply markup.\n *\n * @param messageId\n * Inline message ID, either as a TL object, or as a\n * TDLib and Bot API compatible string\n * @param params\n */\nexport async function editInlineMessage(\n client: ITelegramClient,\n params: {\n /**\n * Inline message ID, either as a TL object, or as a\n * TDLib and Bot API compatible string\n */\n messageId: tl.TypeInputBotInlineMessageID | string\n\n /**\n * New message text\n *\n * When `media` is passed, `media.caption` is used instead\n */\n text?: InputText\n\n /**\n * New message media\n */\n media?: InputMediaLike\n\n /**\n * Whether to disable links preview in this message\n */\n disableWebPreview?: boolean\n\n /**\n * Whether to invert media position.\n *\n * Currently only supported for web previews and makes the\n * client render the preview above the caption and not below.\n */\n invertMedia?: boolean\n\n /**\n * For bots: new reply markup.\n * If omitted, existing markup will be removed.\n */\n replyMarkup?: ReplyMarkup\n\n /**\n * For media, upload progress callback.\n *\n * @param uploaded Number of bytes uploaded\n * @param total Total file size in bytes\n */\n progressCallback?: (uploaded: number, total: number) => void\n },\n): Promise<void> {\n let content: string | undefined = undefined\n let entities: tl.TypeMessageEntity[] | undefined\n let media: tl.TypeInputMedia | undefined = undefined\n\n const id = normalizeInlineId(params.messageId)\n\n if (params.media) {\n media = await _normalizeInputMedia(client, params.media, params, true)\n\n // if there's no caption in input media (i.e. not present or undefined),\n // user wants to keep current caption, thus `content` needs to stay `undefined`\n if ('caption' in params.media && params.media.caption !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.media.caption)\n }\n } else if (params.text !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.text)\n }\n\n let retries = 3\n\n while (retries--) {\n try {\n await client.call(\n {\n _: 'messages.editInlineBotMessage',\n id,\n noWebpage: params.disableWebPreview,\n replyMarkup: BotKeyboard._convertToTl(params.replyMarkup),\n message: content,\n entities,\n media,\n invertMedia: params.invertMedia,\n },\n { dcId: id.dcId },\n )\n\n return\n } catch (e) {\n if (tl.RpcError.is(e, 'MEDIA_EMPTY')) {\n continue\n }\n\n throw e\n }\n }\n}\n"]}
|
|
@@ -24,7 +24,7 @@ export async function editMessage(client, params) {
|
|
|
24
24
|
[content, entities] = await _normalizeInputText(client, params.media.caption);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
if (params.text) {
|
|
27
|
+
if (params.text !== undefined) {
|
|
28
28
|
[content, entities] = await _normalizeInputText(client, params.text);
|
|
29
29
|
}
|
|
30
30
|
const res = await _maybeInvokeWithBusinessConnection(client, params.businessConnectionId, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit-message.js","sourceRoot":"","sources":["../../../../../src/highlevel/methods/messages/edit-message.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,WAAW,EAKX,uBAAuB,GAE1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,kCAAkC,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,MAAuB,EACvB,MAqDC;IAED,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAA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AAI,KAAK,GAAkC,SAAS,CAAA;IAEpD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,KAAK,GAAG,MAAM,oBAAoB,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;QAEhE,wEAAwE;QACxE,+EAA+E;QAC/E,IAAI,SAAS,IAAI,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAClE,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjF,CAAC;IACL,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC5B,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,MAAM,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,kCAAkC,CAAC,MAAM,EAAE,MAAM,CAAC,oBAAoB,EAAE;QACtF,CAAC,EAAE,sBAAsB;QACzB,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,MAAM,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC;QACvC,SAAS,EAAE,MAAM,CAAC,iBAAiB;QACnC,WAAW,EAAE,WAAW,CAAC,YAAY,CAAC,MAAM,CAAC,WAAW,CAAC;QACzD,OAAO,EAAE,OAAO;QAChB,QAAQ;QACR,KAAK;QACL,WAAW,EAAE,MAAM,CAAC,WAAW;KAClC,CAAC,CAAA;IAEF,OAAO,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;AAC1E,CAAC","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { ITelegramClient } from '../../client.types.js'\nimport {\n BotKeyboard,\n InputMediaLike,\n InputMessageId,\n InputText,\n Message,\n normalizeInputMessageId,\n ReplyMarkup,\n} from '../../types/index.js'\nimport { _normalizeInputMedia } from '../files/normalize-input-media.js'\nimport { _normalizeInputText } from '../misc/normalize-text.js'\nimport { resolvePeer } from '../users/resolve-peer.js'\nimport { _maybeInvokeWithBusinessConnection } from './_business-connection.js'\nimport { _findMessageInUpdate } from './find-in-update.js'\n\n/**\n * Edit message text, media, reply markup and schedule date.\n *\n * @param chatId ID of the chat, its username, phone or `\"me\"` or `\"self\"`\n * @param message Message or its ID\n * @param params\n */\nexport async function editMessage(\n client: ITelegramClient,\n params: InputMessageId & {\n /**\n * New message text\n *\n * When `media` is passed, `media.caption` is used instead\n */\n text?: InputText\n\n /**\n * New message media\n */\n media?: InputMediaLike\n\n /**\n * Whether to disable links preview in this message\n */\n disableWebPreview?: boolean\n\n /**\n * For bots: new reply markup.\n * If omitted, existing markup will be removed.\n */\n replyMarkup?: ReplyMarkup\n\n /**\n * To re-schedule a message: new schedule date.\n * When passing a number, a UNIX time in ms is expected.\n */\n scheduleDate?: Date | number\n\n /**\n * For media, upload progress callback.\n *\n * @param uploaded Number of bytes uploaded\n * @param total Total file size in bytes\n */\n progressCallback?: (uploaded: number, total: number) => void\n\n /**\n * Whether to dispatch the edit message event\n * to the client's update handler.\n */\n shouldDispatch?: true\n\n /**\n * Whether to invert media position.\n *\n * Currently only supported for web previews and makes the\n * client render the preview above the caption and not below.\n */\n invertMedia?: boolean\n\n businessConnectionId?: string\n },\n): Promise<Message> {\n const { chatId, message } = normalizeInputMessageId(params)\n let content: string | undefined = undefined\n let entities: tl.TypeMessageEntity[] | undefined\n let media: tl.TypeInputMedia | undefined = undefined\n\n if (params.media) {\n media = await _normalizeInputMedia(client, params.media, params)\n\n // if there's no caption in input media (i.e. not present or undefined),\n // user wants to keep current caption, thus `content` needs to stay `undefined`\n if ('caption' in params.media && params.media.caption !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.media.caption)\n }\n }\n\n if (params.text !== undefined) {\n [content, entities] = await _normalizeInputText(client, params.text)\n }\n\n const res = await _maybeInvokeWithBusinessConnection(client, params.businessConnectionId, {\n _: 'messages.editMessage',\n id: message,\n peer: await resolvePeer(client, chatId),\n noWebpage: params.disableWebPreview,\n replyMarkup: BotKeyboard._convertToTl(params.replyMarkup),\n message: content,\n entities,\n media,\n invertMedia: params.invertMedia,\n })\n\n return _findMessageInUpdate(client, res, true, !params.shouldDispatch)\n}\n"]}
|
|
@@ -263,7 +263,7 @@ export class NetworkManager {
|
|
|
263
263
|
_: 'initConnection',
|
|
264
264
|
deviceModel,
|
|
265
265
|
systemVersion: '1.0',
|
|
266
|
-
appVersion: '0.15.
|
|
266
|
+
appVersion: '0.15.1',
|
|
267
267
|
systemLangCode: 'en',
|
|
268
268
|
langPack: '', // "langPacks are for official apps only"
|
|
269
269
|
langCode: 'en',
|