@mtcute/core 0.12.5 → 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.
- package/cjs/highlevel/client.d.ts +83 -2
- package/cjs/highlevel/client.js +19 -0
- package/cjs/highlevel/client.js.map +1 -1
- package/cjs/highlevel/methods/_imports.js.map +1 -1
- package/cjs/highlevel/methods/chats/archive-chats.js +2 -1
- package/cjs/highlevel/methods/chats/archive-chats.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/find-dialogs.d.ts +12 -0
- package/cjs/highlevel/methods/dialogs/find-dialogs.js +88 -0
- package/cjs/highlevel/methods/dialogs/find-dialogs.js.map +1 -0
- package/cjs/highlevel/methods/dialogs/get-peer-dialogs.js +2 -1
- package/cjs/highlevel/methods/dialogs/get-peer-dialogs.js.map +1 -1
- package/cjs/highlevel/methods/dialogs/iter-dialogs.js +3 -1
- package/cjs/highlevel/methods/dialogs/iter-dialogs.js.map +1 -1
- package/cjs/highlevel/methods/messages/_business-connection.d.ts +2 -1
- package/cjs/highlevel/methods/messages/_business-connection.js.map +1 -1
- package/cjs/highlevel/methods/messages/get-available-effects.d.ts +6 -0
- package/cjs/highlevel/methods/messages/get-available-effects.js +26 -0
- package/cjs/highlevel/methods/messages/get-available-effects.js.map +1 -0
- package/cjs/highlevel/methods/messages/get-fact-check.d.ts +11 -0
- package/cjs/highlevel/methods/messages/get-fact-check.js +27 -0
- package/cjs/highlevel/methods/messages/get-fact-check.js.map +1 -0
- package/cjs/highlevel/methods/messages/search-hashtag.d.ts +44 -0
- package/cjs/highlevel/methods/messages/search-hashtag.js +75 -0
- package/cjs/highlevel/methods/messages/search-hashtag.js.map +1 -0
- package/cjs/highlevel/methods/messages/send-common.d.ts +5 -0
- package/cjs/highlevel/methods/messages/send-common.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-media-group.js +1 -0
- package/cjs/highlevel/methods/messages/send-media-group.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-media.js +1 -0
- package/cjs/highlevel/methods/messages/send-media.js.map +1 -1
- package/cjs/highlevel/methods/messages/send-text.js +1 -0
- package/cjs/highlevel/methods/messages/send-text.js.map +1 -1
- package/cjs/highlevel/methods/misc/normalize-privacy-rules.js +2 -1
- package/cjs/highlevel/methods/misc/normalize-privacy-rules.js.map +1 -1
- package/cjs/highlevel/methods/users/resolve-peer-many.d.ts +6 -2
- package/cjs/highlevel/methods/users/resolve-peer-many.js +22 -6
- package/cjs/highlevel/methods/users/resolve-peer-many.js.map +1 -1
- package/cjs/highlevel/methods/users/resolve-peer.js +30 -11
- package/cjs/highlevel/methods/users/resolve-peer.js.map +1 -1
- package/cjs/highlevel/methods.d.ts +6 -0
- package/cjs/highlevel/methods.js +15 -4
- package/cjs/highlevel/methods.js.map +1 -1
- package/cjs/highlevel/types/conversation.js +1 -1
- package/cjs/highlevel/types/conversation.js.map +1 -1
- package/cjs/highlevel/types/messages/dialog.d.ts +2 -2
- package/cjs/highlevel/types/messages/dialog.js +2 -3
- package/cjs/highlevel/types/messages/dialog.js.map +1 -1
- package/cjs/highlevel/types/messages/fact-check.d.ts +30 -0
- package/cjs/highlevel/types/messages/fact-check.js +56 -0
- package/cjs/highlevel/types/messages/fact-check.js.map +1 -0
- package/cjs/highlevel/types/messages/index.d.ts +2 -0
- package/cjs/highlevel/types/messages/index.js +2 -0
- package/cjs/highlevel/types/messages/index.js.map +1 -1
- package/cjs/highlevel/types/messages/message-effect.d.ts +20 -0
- package/cjs/highlevel/types/messages/message-effect.js +69 -0
- package/cjs/highlevel/types/messages/message-effect.js.map +1 -0
- package/cjs/highlevel/types/messages/message-entity.d.ts +4 -1
- package/cjs/highlevel/types/messages/message-entity.js +1 -1
- package/cjs/highlevel/types/messages/message-entity.js.map +1 -1
- package/cjs/highlevel/types/messages/message.d.ts +12 -0
- package/cjs/highlevel/types/messages/message.js +23 -0
- package/cjs/highlevel/types/messages/message.js.map +1 -1
- package/cjs/network/network-manager.js +1 -1
- package/esm/highlevel/client.d.ts +83 -2
- package/esm/highlevel/client.js +19 -0
- package/esm/highlevel/client.js.map +1 -1
- package/esm/highlevel/methods/_imports.js.map +1 -1
- package/esm/highlevel/methods/chats/archive-chats.js +2 -1
- package/esm/highlevel/methods/chats/archive-chats.js.map +1 -1
- package/esm/highlevel/methods/dialogs/find-dialogs.d.ts +12 -0
- package/esm/highlevel/methods/dialogs/find-dialogs.js +84 -0
- package/esm/highlevel/methods/dialogs/find-dialogs.js.map +1 -0
- package/esm/highlevel/methods/dialogs/get-peer-dialogs.js +2 -1
- package/esm/highlevel/methods/dialogs/get-peer-dialogs.js.map +1 -1
- package/esm/highlevel/methods/dialogs/iter-dialogs.js +3 -1
- package/esm/highlevel/methods/dialogs/iter-dialogs.js.map +1 -1
- package/esm/highlevel/methods/messages/_business-connection.d.ts +2 -1
- package/esm/highlevel/methods/messages/_business-connection.js.map +1 -1
- package/esm/highlevel/methods/messages/get-available-effects.d.ts +6 -0
- package/esm/highlevel/methods/messages/get-available-effects.js +22 -0
- package/esm/highlevel/methods/messages/get-available-effects.js.map +1 -0
- package/esm/highlevel/methods/messages/get-fact-check.d.ts +11 -0
- package/esm/highlevel/methods/messages/get-fact-check.js +23 -0
- package/esm/highlevel/methods/messages/get-fact-check.js.map +1 -0
- package/esm/highlevel/methods/messages/search-hashtag.d.ts +44 -0
- package/esm/highlevel/methods/messages/search-hashtag.js +70 -0
- package/esm/highlevel/methods/messages/search-hashtag.js.map +1 -0
- package/esm/highlevel/methods/messages/send-common.d.ts +5 -0
- package/esm/highlevel/methods/messages/send-common.js.map +1 -1
- package/esm/highlevel/methods/messages/send-media-group.js +1 -0
- package/esm/highlevel/methods/messages/send-media-group.js.map +1 -1
- package/esm/highlevel/methods/messages/send-media.js +1 -0
- package/esm/highlevel/methods/messages/send-media.js.map +1 -1
- package/esm/highlevel/methods/messages/send-text.js +1 -0
- package/esm/highlevel/methods/messages/send-text.js.map +1 -1
- package/esm/highlevel/methods/misc/normalize-privacy-rules.js +2 -1
- package/esm/highlevel/methods/misc/normalize-privacy-rules.js.map +1 -1
- package/esm/highlevel/methods/users/resolve-peer-many.d.ts +6 -2
- package/esm/highlevel/methods/users/resolve-peer-many.js +22 -6
- package/esm/highlevel/methods/users/resolve-peer-many.js.map +1 -1
- package/esm/highlevel/methods/users/resolve-peer.js +30 -11
- package/esm/highlevel/methods/users/resolve-peer.js.map +1 -1
- package/esm/highlevel/methods.d.ts +6 -0
- package/esm/highlevel/methods.js +5 -0
- package/esm/highlevel/methods.js.map +1 -1
- package/esm/highlevel/types/conversation.js +1 -1
- package/esm/highlevel/types/conversation.js.map +1 -1
- package/esm/highlevel/types/messages/dialog.d.ts +2 -2
- package/esm/highlevel/types/messages/dialog.js +2 -3
- package/esm/highlevel/types/messages/dialog.js.map +1 -1
- package/esm/highlevel/types/messages/fact-check.d.ts +30 -0
- package/esm/highlevel/types/messages/fact-check.js +53 -0
- package/esm/highlevel/types/messages/fact-check.js.map +1 -0
- package/esm/highlevel/types/messages/index.d.ts +2 -0
- package/esm/highlevel/types/messages/index.js +2 -0
- package/esm/highlevel/types/messages/index.js.map +1 -1
- package/esm/highlevel/types/messages/message-effect.d.ts +20 -0
- package/esm/highlevel/types/messages/message-effect.js +66 -0
- package/esm/highlevel/types/messages/message-effect.js.map +1 -0
- package/esm/highlevel/types/messages/message-entity.d.ts +4 -1
- package/esm/highlevel/types/messages/message-entity.js +1 -1
- package/esm/highlevel/types/messages/message-entity.js.map +1 -1
- package/esm/highlevel/types/messages/message.d.ts +12 -0
- package/esm/highlevel/types/messages/message.js +23 -0
- package/esm/highlevel/types/messages/message.js.map +1 -1
- package/esm/network/network-manager.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageEffect = void 0;
|
|
4
|
+
const errors_js_1 = require("../../../types/errors.js");
|
|
5
|
+
const inspectable_js_1 = require("../../utils/inspectable.js");
|
|
6
|
+
const memoize_js_1 = require("../../utils/memoize.js");
|
|
7
|
+
const document_utils_js_1 = require("../media/document-utils.js");
|
|
8
|
+
class MessageEffect {
|
|
9
|
+
raw;
|
|
10
|
+
documentsMap;
|
|
11
|
+
constructor(raw, documentsMap) {
|
|
12
|
+
this.raw = raw;
|
|
13
|
+
this.documentsMap = documentsMap;
|
|
14
|
+
}
|
|
15
|
+
/** Whether Telegram Premium is required to use this effect */
|
|
16
|
+
get isPremiumRequired() {
|
|
17
|
+
return this.raw.premiumRequired;
|
|
18
|
+
}
|
|
19
|
+
/** ID of this effect */
|
|
20
|
+
get id() {
|
|
21
|
+
return this.raw.id;
|
|
22
|
+
}
|
|
23
|
+
/** Emoji representint this reaction */
|
|
24
|
+
get emoji() {
|
|
25
|
+
return this.raw.emoticon;
|
|
26
|
+
}
|
|
27
|
+
/** Sticker representing a static icon for this effect (if any) */
|
|
28
|
+
get staticIcon() {
|
|
29
|
+
if (!this.raw.staticIconId)
|
|
30
|
+
return null;
|
|
31
|
+
const document = this.documentsMap.get(this.raw.staticIconId);
|
|
32
|
+
if (!document)
|
|
33
|
+
return null;
|
|
34
|
+
const parsed = (0, document_utils_js_1.parseSticker)(document);
|
|
35
|
+
if (!parsed) {
|
|
36
|
+
throw new errors_js_1.MtTypeAssertionError('MessageEffect.staticIcon', 'sticker', 'null');
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
/** Animated icon representing the effect */
|
|
41
|
+
get icon() {
|
|
42
|
+
const document = this.documentsMap.get(this.raw.effectStickerId);
|
|
43
|
+
if (!document) {
|
|
44
|
+
throw new errors_js_1.MtTypeAssertionError('MessageEffect.effect', 'document', 'null');
|
|
45
|
+
}
|
|
46
|
+
const parsed = (0, document_utils_js_1.parseSticker)(document);
|
|
47
|
+
if (!parsed) {
|
|
48
|
+
throw new errors_js_1.MtTypeAssertionError('MessageEffect.effect', 'sticker', 'null');
|
|
49
|
+
}
|
|
50
|
+
return parsed;
|
|
51
|
+
}
|
|
52
|
+
/** The animation itself */
|
|
53
|
+
get animation() {
|
|
54
|
+
if (!this.raw.effectAnimationId)
|
|
55
|
+
return null;
|
|
56
|
+
const document = this.documentsMap.get(this.raw.effectAnimationId);
|
|
57
|
+
if (!document)
|
|
58
|
+
return null;
|
|
59
|
+
const parsed = (0, document_utils_js_1.parseSticker)(document);
|
|
60
|
+
if (!parsed) {
|
|
61
|
+
throw new errors_js_1.MtTypeAssertionError('MessageEffect.effectAnimation', 'sticker', 'null');
|
|
62
|
+
}
|
|
63
|
+
return parsed;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.MessageEffect = MessageEffect;
|
|
67
|
+
(0, memoize_js_1.memoizeGetters)(MessageEffect, ['staticIcon', 'icon', 'animation']);
|
|
68
|
+
(0, inspectable_js_1.makeInspectable)(MessageEffect);
|
|
69
|
+
//# sourceMappingURL=message-effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-effect.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-effect.ts"],"names":[],"mappings":";;;AAEA,wDAA+D;AAE/D,+DAA4D;AAC5D,uDAAuD;AACvD,kEAAyD;AAGzD,MAAa,aAAa;IAET;IACA;IAFb,YACa,GAA0B,EAC1B,YAAqC;QADrC,QAAG,GAAH,GAAG,CAAuB;QAC1B,iBAAY,GAAZ,YAAY,CAAyB;IAC/C,CAAC;IAEJ,8DAA8D;IAC9D,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,eAAgB,CAAA;IACpC,CAAC;IAED,wBAAwB;IACxB,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IACtB,CAAC;IAED,uCAAuC;IACvC,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAA;IAC5B,CAAC;IAED,kEAAkE;IAClE,IAAI,UAAU;QACV,IAAI,CAAC,IAAI,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CAAA;QAErC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,gCAAoB,CAAC,+BAA+B,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;QACtF,CAAC;QAED,OAAO,MAAM,CAAA;IACjB,CAAC;CACJ;AArED,sCAqEC;AAED,IAAA,2BAAc,EAAC,aAAa,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAA;AAClE,IAAA,gCAAe,EAAC,aAAa,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtTypeAssertionError } from '../../../types/errors.js'\nimport { LongMap } from '../../../utils/long-utils.js'\nimport { makeInspectable } from '../../utils/inspectable.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { parseSticker } from '../media/document-utils.js'\nimport { Sticker } from '../media/sticker.js'\n\nexport class MessageEffect {\n constructor(\n readonly raw: tl.RawAvailableEffect,\n readonly documentsMap: LongMap<tl.RawDocument>,\n ) {}\n\n /** Whether Telegram Premium is required to use this effect */\n get isPremiumRequired(): boolean {\n return this.raw.premiumRequired!\n }\n\n /** ID of this effect */\n get id(): tl.Long {\n return this.raw.id\n }\n\n /** Emoji representint this reaction */\n get emoji(): string {\n return this.raw.emoticon\n }\n\n /** Sticker representing a static icon for this effect (if any) */\n get staticIcon(): Sticker | null {\n if (!this.raw.staticIconId) return null\n\n const document = this.documentsMap.get(this.raw.staticIconId)\n if (!document) return null\n\n const parsed = parseSticker(document)\n\n if (!parsed) {\n throw new MtTypeAssertionError('MessageEffect.staticIcon', 'sticker', 'null')\n }\n\n return parsed\n }\n\n /** Animated icon representing the effect */\n get icon(): Sticker {\n const document = this.documentsMap.get(this.raw.effectStickerId)\n\n if (!document) {\n throw new MtTypeAssertionError('MessageEffect.effect', 'document', 'null')\n }\n\n const parsed = parseSticker(document)\n\n if (!parsed) {\n throw new MtTypeAssertionError('MessageEffect.effect', 'sticker', 'null')\n }\n\n return parsed\n }\n\n /** The animation itself */\n get animation(): Sticker | null {\n if (!this.raw.effectAnimationId) return null\n\n const document = this.documentsMap.get(this.raw.effectAnimationId)\n if (!document) return null\n\n const parsed = parseSticker(document)\n\n if (!parsed) {\n throw new MtTypeAssertionError('MessageEffect.effectAnimation', 'sticker', 'null')\n }\n\n return parsed\n }\n}\n\nmemoizeGetters(MessageEffect, ['staticIcon', 'icon', 'animation'])\nmakeInspectable(MessageEffect)\n"]}
|
|
@@ -20,7 +20,10 @@ import { tl } from '@mtcute/tl';
|
|
|
20
20
|
* - 'emoji': A custom emoji. `.emojiId` contains the emoji ID.
|
|
21
21
|
*/
|
|
22
22
|
export type MessageEntityParams = {
|
|
23
|
-
kind: 'mention' | 'hashtag' | 'cashtag' | 'bot_command' | 'url' | 'email' | 'phone_number' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'spoiler' | 'code' | '
|
|
23
|
+
kind: 'mention' | 'hashtag' | 'cashtag' | 'bot_command' | 'url' | 'email' | 'phone_number' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'spoiler' | 'code' | 'bank_card' | 'unknown';
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'blockquote';
|
|
26
|
+
collapsible: boolean;
|
|
24
27
|
} | {
|
|
25
28
|
kind: 'pre';
|
|
26
29
|
language?: string;
|
|
@@ -73,7 +73,7 @@ class MessageEntity {
|
|
|
73
73
|
case 'messageEntityMentionName':
|
|
74
74
|
return { kind: 'text_mention', userId: this.raw.userId };
|
|
75
75
|
case 'messageEntityBlockquote':
|
|
76
|
-
return { kind: 'blockquote' };
|
|
76
|
+
return { kind: 'blockquote', collapsible: this.raw.collapsed };
|
|
77
77
|
case 'messageEntityCustomEmoji':
|
|
78
78
|
return { kind: 'emoji', emojiId: this.raw.documentId };
|
|
79
79
|
case 'messageEntityBankCard':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-entity.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-entity.ts"],"names":[],"mappings":";;;AAEA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AA;YAChC,KAAK,qBAAqB;gBACtB,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAA;YACpC,KAAK,sBAAsB;gBACvB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;YAC9B,KAAK,mBAAmB;gBACpB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;YAC3B,KAAK,kBAAkB;gBACnB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAA;YACvD,KAAK,sBAAsB;gBACvB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;YACnD,KAAK,0BAA0B;gBAC3B,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;YAC5D,KAAK,yBAAyB;gBAC1B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"message-entity.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message-entity.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAuD;AAoDvD;;GAEG;AACH,MAAa,aAAa;IAET;IACA;IAFb,YACa,GAAyB,EACzB,KAAc;QADd,QAAG,GAAH,GAAG,CAAsB;QACzB,UAAK,GAAL,KAAK,CAAS;IACxB,CAAC;IAEJ;;;;OAIG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;IAED;;;;OAIG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAA;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACN,QAAQ,I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O,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAA;YAC5D,KAAK,yBAAyB;gBAC1B,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,CAAC,SAAU,EAAE,CAAA;YACnE,KAAK,0BAA0B;gBAC3B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,CAAA;YAC1D,KAAK,uBAAuB;gBACxB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;QACpC,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;IAC9B,CAAC;IAED;;;;;OAKG;IACH,IAAI,IAAI;QACJ,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,CAAA;QAE1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAC/E,CAAC;IAED;;;;OAIG;IACH,EAAE,CACE,IAAO;QAEP,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAA;IACpC,CAAC;CACJ;AArGD,sCAqGC;AAED,IAAA,2BAAc,EAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;AACzC,IAAA,0BAAe,EAAC,aAAa,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\n\n/**\n * Params of the entity. `.kind` can be:\n * - 'mention': `@username`.\n * - 'hashtag': `#hashtag`.\n * - 'cashtag': `$USD`.\n * - 'bot_command': `/start`.\n * - 'url': `https://example.com`\n * - 'email': `example@example.com`.\n * - 'phone_number': `+42000`.\n * - 'bold': **bold text**.\n * - 'italic': *italic text*.\n * - 'underline': <u>underlined</u> text.\n * - 'strikethrough': <s>strikethrough</s> text.\n * - 'code': `monospaced` string.\n * - 'pre': `monospaced` block. `.language` contains the language of the block (if available).\n * - 'text_link': for clickable text URLs.\n * - 'text_mention': for user mention by name. `.userId` contains the ID of the mentioned user.\n * - 'blockquote': A blockquote\n * - 'emoji': A custom emoji. `.emojiId` contains the emoji ID.\n */\nexport type MessageEntityParams =\n | {\n kind:\n | 'mention'\n | 'hashtag'\n | 'cashtag'\n | 'bot_command'\n | 'url'\n | 'email'\n | 'phone_number'\n | 'bold'\n | 'italic'\n | 'underline'\n | 'strikethrough'\n | 'spoiler'\n | 'code'\n | 'bank_card'\n | 'unknown'\n }\n | { kind: 'blockquote'; collapsible: boolean }\n | { kind: 'pre'; language?: string }\n | { kind: 'text_link'; url: string }\n | { kind: 'text_mention'; userId: number }\n | { kind: 'emoji'; emojiId: tl.Long }\n\n/**\n * Kind of the entity. For more information, see {@link MessageEntityParams}\n */\nexport type MessageEntityKind = MessageEntityParams['kind']\n\n/**\n * One special entity in a text message (like mention, hashtag, URL, etc.)\n */\nexport class MessageEntity {\n constructor(\n readonly raw: tl.TypeMessageEntity,\n readonly _text?: string,\n ) {}\n\n /**\n * Offset in UTF-16 code units to the start of the entity.\n *\n * Since JS strings are UTF-16, you can use this as-is\n */\n get offset() {\n return this.raw.offset\n }\n\n /**\n * Length of the entity in UTF-16 code units.\n *\n * Since JS strings are UTF-16, you can use this as-is\n */\n get length() {\n return this.raw.length\n }\n\n /**\n * Kind of the entity (see {@link MessageEntityParams})\n */\n get kind(): MessageEntityKind {\n return this.params.kind\n }\n\n /**\n * Params of the entity\n */\n get params(): MessageEntityParams {\n switch (this.raw._) {\n case 'messageEntityMention':\n return { kind: 'mention' }\n case 'messageEntityHashtag':\n return { kind: 'hashtag' }\n case 'messageEntityCashtag':\n return { kind: 'cashtag' }\n case 'messageEntityBotCommand':\n return { kind: 'bot_command' }\n case 'messageEntityUrl':\n return { kind: 'url' }\n case 'messageEntityEmail':\n return { kind: 'email' }\n case 'messageEntityPhone':\n return { kind: 'phone_number' }\n case 'messageEntityBold':\n return { kind: 'bold' }\n case 'messageEntityItalic':\n return { kind: 'italic' }\n case 'messageEntityUnderline':\n return { kind: 'underline' }\n case 'messageEntityStrike':\n return { kind: 'strikethrough' }\n case 'messageEntitySpoiler':\n return { kind: 'spoiler' }\n case 'messageEntityCode':\n return { kind: 'code' }\n case 'messageEntityPre':\n return { kind: 'pre', language: this.raw.language }\n case 'messageEntityTextUrl':\n return { kind: 'text_link', url: this.raw.url }\n case 'messageEntityMentionName':\n return { kind: 'text_mention', userId: this.raw.userId }\n case 'messageEntityBlockquote':\n return { kind: 'blockquote', collapsible: this.raw.collapsed! }\n case 'messageEntityCustomEmoji':\n return { kind: 'emoji', emojiId: this.raw.documentId }\n case 'messageEntityBankCard':\n return { kind: 'bank_card' }\n }\n\n return { kind: 'unknown' }\n }\n\n /**\n * Text contained in this entity.\n *\n * > **Note**: This does not take into account that entities may overlap,\n * > and is only useful for simple cases.\n */\n get text(): string {\n if (!this._text) return ''\n\n return this._text.slice(this.raw.offset, this.raw.offset + this.raw.length)\n }\n\n /**\n * Checks if this entity is of the given type, and adjusts the type accordingly.\n * @param kind\n * @returns\n */\n is<const T extends MessageEntityKind>(\n kind: T,\n ): this is MessageEntity & { params: Extract<MessageEntityParams, { kind: T }>; kind: T } {\n return this.params.kind === kind\n }\n}\n\nmemoizeGetters(MessageEntity, ['params'])\nmakeInspectable(MessageEntity)\n"]}
|
|
@@ -5,6 +5,7 @@ import { Chat } from '../peers/chat.js';
|
|
|
5
5
|
import { Peer } from '../peers/peer.js';
|
|
6
6
|
import { PeersIndex } from '../peers/peers-index.js';
|
|
7
7
|
import { User } from '../peers/user.js';
|
|
8
|
+
import { FactCheck } from './fact-check.js';
|
|
8
9
|
import { MessageAction } from './message-action.js';
|
|
9
10
|
import { MessageEntity } from './message-entity.js';
|
|
10
11
|
import { MessageForwardInfo } from './message-forward.js';
|
|
@@ -226,7 +227,18 @@ export declare class Message {
|
|
|
226
227
|
* `false` for service mesasges and private restricted chats/chanenls
|
|
227
228
|
*/
|
|
228
229
|
get canBeForwarded(): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Reactions added to this message, if any
|
|
232
|
+
*/
|
|
229
233
|
get reactions(): MessageReactions | null;
|
|
234
|
+
/**
|
|
235
|
+
* Information about fact-check added to the message, if any
|
|
236
|
+
*/
|
|
237
|
+
get factCheck(): FactCheck | null;
|
|
238
|
+
/**
|
|
239
|
+
* If this message was sent with a message effect, ID of the effect
|
|
240
|
+
*/
|
|
241
|
+
get effectId(): tl.Long | null;
|
|
230
242
|
/**
|
|
231
243
|
* Generated permalink to this message, only for groups and channels
|
|
232
244
|
*
|
|
@@ -11,6 +11,7 @@ const index_js_2 = require("../bots/keyboards/index.js");
|
|
|
11
11
|
const chat_js_1 = require("../peers/chat.js");
|
|
12
12
|
const peer_js_1 = require("../peers/peer.js");
|
|
13
13
|
const user_js_1 = require("../peers/user.js");
|
|
14
|
+
const fact_check_js_1 = require("./fact-check.js");
|
|
14
15
|
const message_action_js_1 = require("./message-action.js");
|
|
15
16
|
const message_entity_js_1 = require("./message-entity.js");
|
|
16
17
|
const message_forward_js_1 = require("./message-forward.js");
|
|
@@ -402,12 +403,33 @@ class Message {
|
|
|
402
403
|
get canBeForwarded() {
|
|
403
404
|
return this.raw._ === 'message' && !this.raw.noforwards;
|
|
404
405
|
}
|
|
406
|
+
/**
|
|
407
|
+
* Reactions added to this message, if any
|
|
408
|
+
*/
|
|
405
409
|
get reactions() {
|
|
406
410
|
if (this.raw._ === 'messageService' || !this.raw.reactions) {
|
|
407
411
|
return null;
|
|
408
412
|
}
|
|
409
413
|
return new message_reactions_js_1.MessageReactions(this.raw.id, (0, peer_utils_js_1.getMarkedPeerId)(this.raw.peerId), this.raw.reactions, this._peers);
|
|
410
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Information about fact-check added to the message, if any
|
|
417
|
+
*/
|
|
418
|
+
get factCheck() {
|
|
419
|
+
if (this.raw._ === 'messageService')
|
|
420
|
+
return null;
|
|
421
|
+
if (!this.raw.factcheck || this.raw.factcheck.hash.isZero())
|
|
422
|
+
return null;
|
|
423
|
+
return new fact_check_js_1.FactCheck(this.raw.factcheck);
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* If this message was sent with a message effect, ID of the effect
|
|
427
|
+
*/
|
|
428
|
+
get effectId() {
|
|
429
|
+
if (this.raw._ === 'messageService')
|
|
430
|
+
return null;
|
|
431
|
+
return this.raw.effect ?? null;
|
|
432
|
+
}
|
|
411
433
|
/**
|
|
412
434
|
* Generated permalink to this message, only for groups and channels
|
|
413
435
|
*
|
|
@@ -435,6 +457,7 @@ exports.Message = Message;
|
|
|
435
457
|
'media',
|
|
436
458
|
'markup',
|
|
437
459
|
'reactions',
|
|
460
|
+
'factCheck',
|
|
438
461
|
]);
|
|
439
462
|
(0, index_js_1.makeInspectable)(Message, ['isScheduled'], ['link']);
|
|
440
463
|
//# sourceMappingURL=message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message.ts"],"names":[],"mappings":";;;AAEA,wDAA0D;AAC1D,sDAAqD;AACrD,gEAAmF;AACnF,0EAAmE;AACnE,mDAAsD;AACtD,uDAAuD;AACvD,yDAAqE;AAErE,8CAAuC;AACvC,8CAAkD;AAElD,8CAAuC;AACvC,2DAAyE;AACzE,2DAAmD;AACnD,6DAAyD;AACzD,yDAAsE;AACtE,iEAAyD;AACzD,6DAAyD;AACzD,6DAAyD;AAEzD;;GAEG;AACH,MAAa,OAAO;IAQH;IAKA;IAZb;;OAEG;IACM,GAAG,CAAsC;IAElD,YACI,GAAmB,EACV,MAAkB;IAC3B;;;OAGG;IACM,cAAc,KAAK;QALnB,WAAM,GAAN,MAAM,CAAY;QAKlB,gBAAW,GAAX,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Y,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC1E,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO,gBAAgB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;YAC1D,CAAC;YAED,OAAO,kBAAkB,IAAA,mCAAmB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;QAC3E,CAAC;QAED,MAAM,IAAI,2BAAe,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvF,CAAC;CACJ;AA/cD,0BA+cC;AAED,IAAA,2BAAc,EAAC,OAAO,EAAE;IACpB,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;CACd,CAAC,CAAA;AACF,IAAA,0BAAe,EAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtArgumentError } from '../../../types/errors.js'\nimport { assertNever } from '../../../types/utils.js'\nimport { getMarkedPeerId, toggleChannelIdMark } from '../../../utils/peer-utils.js'\nimport { assertTypeIsNot } from '../../../utils/type-assertions.js'\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { BotKeyboard, ReplyMarkup } from '../bots/keyboards/index.js'\nimport { TextWithEntities } from '../misc/index.js'\nimport { Chat } from '../peers/chat.js'\nimport { parsePeer, Peer } from '../peers/peer.js'\nimport { PeersIndex } from '../peers/peers-index.js'\nimport { User } from '../peers/user.js'\nimport { _messageActionFromTl, MessageAction } from './message-action.js'\nimport { MessageEntity } from './message-entity.js'\nimport { MessageForwardInfo } from './message-forward.js'\nimport { _messageMediaFromTl, MessageMedia } from './message-media.js'\nimport { MessageReactions } from './message-reactions.js'\nimport { MessageRepliesInfo } from './message-replies.js'\nimport { RepliedMessageInfo } from './replied-message.js'\n\n/**\n * A Telegram message.\n */\nexport class Message {\n /**\n * Raw TL object.\n */\n readonly raw: tl.RawMessage | tl.RawMessageService\n\n constructor(\n raw: tl.TypeMessage,\n readonly _peers: PeersIndex,\n /**\n * Whether the message is scheduled.\n * If it is, then its {@link date} is set to future.\n */\n readonly isScheduled = false,\n ) {\n assertTypeIsNot('Message#ctor', raw, 'messageEmpty')\n\n this.raw = raw\n }\n\n /** Unique message identifier inside this chat */\n get id(): number {\n return this.raw.id\n }\n\n /**\n * For channel posts, number of views\n *\n * `null` for service messages and non-post messages.\n */\n get views(): number | null {\n return this.raw._ === 'message' ? this.raw.views ?? null : null\n }\n\n /**\n * For channel posts, number of forwards\n *\n * `null` for service messages and non-post messages, or\n * if the current user is not an admin in the channel\n */\n get forwards(): number | null {\n return this.raw._ === 'message' ? this.raw.forwards ?? null : null\n }\n\n /**\n * For channel posts with signatures enabled, name of the post author\n */\n get signature(): string | null {\n return this.raw._ === 'message' ? this.raw.postAuthor ?? null : null\n }\n\n /**\n * Whether the message is incoming or outgoing:\n * - Messages received from other chats are incoming (`outgoing = false`)\n * - Messages sent by you to other chats are outgoing (`outgoing = true`)\n * - Messages to yourself (i.e. *Saved Messages*) are incoming (`outgoing = false`)\n */\n get isOutgoing(): boolean {\n return this.raw.out!\n }\n\n /**\n * Whether this message is a service message\n */\n get isService(): boolean {\n return this.raw._ === 'messageService'\n }\n\n /** Whether this message has content protection (i.e. disabled forwards) */\n get isContentProtected(): boolean {\n return this.raw._ === 'message' && this.raw.noforwards!\n }\n\n /**\n * Whether the message was sent by an implicit action, for example,\n * as an away or a greeting business message, or as a scheduled message\n */\n get isFromOffline(): boolean {\n return this.raw._ === 'message' && this.raw.offline!\n }\n\n /** Whether this is a silent message (no notification triggered) */\n get isSilent(): boolean {\n return this.raw.silent!\n }\n\n /** Whether there are unread media attachments in this message */\n get hasUnreadMedia(): boolean {\n return this.raw.mediaUnread!\n }\n\n /** Whether this is a broadcast channel post */\n get isChannelPost(): boolean {\n return this.raw._ === 'message' && this.raw.post!\n }\n\n /**\n * Whether this message was automatically sent from a scheduled message.\n *\n * **Note**: for messages sent by other users, this is always `false`.\n */\n get isFromScheduled(): boolean {\n return this.raw._ === 'message' && this.raw.fromScheduled!\n }\n\n /** Whether the message is pinned in the current chat */\n get isPinned(): boolean {\n return this.raw._ === 'message' && this.raw.pinned!\n }\n\n /** Whether the message should be considered unedited, even if {@link editDate} ≠ null */\n get hideEditMark(): boolean {\n return this.raw._ === 'message' && this.raw.editHide!\n }\n\n /**\n * If set, any eventual webpage preview should be shown on top of\n * the message instead of at the bottom.\n */\n get invertMedia(): boolean {\n return this.raw._ === 'message' && this.raw.invertMedia!\n }\n\n /**\n * Multiple media messages with the same grouped ID\n * indicate an album or media group\n *\n * `null` for service messages and non-grouped messages\n */\n get groupedId(): tl.Long | null {\n return this.raw._ === 'message' ? this.raw.groupedId ?? null : null\n }\n\n /**\n * Same as {@link groupedId}, but is globally unique across chats.\n */\n get groupedIdUnique(): string | null {\n if (!(this.raw._ === 'message' && this.raw.groupedId !== undefined)) return null\n\n return `${this.raw.groupedId.low}|${this.raw.groupedId.high}|${getMarkedPeerId(this.raw.peerId)}`\n }\n\n /**\n * Message sender.\n *\n * Usually is a {@link User}, but can be a {@link Chat}\n * in case the message was sent by an anonymous admin, anonymous premium user,\n * or if the message is a forwarded channel post.\n *\n * If the message was sent by an anonymous admin,\n * sender will equal to {@link chat}.\n *\n * If the message is a forwarded channel post,\n * sender is the channel itself.\n */\n get sender(): Peer {\n const from = this.raw.fromId\n\n if (!from) {\n if (this.raw.peerId._ === 'peerUser') {\n return new User(this._peers.user(this.raw.peerId.userId))\n }\n\n // anon admin, return the chat\n return this.chat\n }\n\n return parsePeer(from, this._peers)\n }\n\n /**\n * Number of boosts applied to this {@link chat} by the sender\n */\n get senderBoostCount(): number {\n if (this.raw._ !== 'message') return 0\n\n return this.raw.fromBoostsApplied ?? 0\n }\n\n /**\n * Conversation the message belongs to\n */\n get chat(): Chat {\n return Chat._parseFromMessage(this.raw, this._peers)\n }\n\n /**\n * Date when the message was sent\n */\n get date(): Date {\n return new Date(this.raw.date * 1000)\n }\n\n /**\n * Date when the message was last edited\n */\n get editDate(): Date | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.editDate ? new Date(this.raw.editDate * 1000) : null\n }\n\n /**\n * If this message is a forward, contains info about it.\n */\n get forward(): MessageForwardInfo | null {\n if (this.raw._ !== 'message' || !this.raw.fwdFrom) {\n return null\n }\n\n return new MessageForwardInfo(this.raw.fwdFrom, this._peers)\n }\n\n /**\n * Whether the message is a channel post that was\n * automatically forwarded to the connected discussion group\n */\n get isAutomaticForward(): boolean {\n if (this.raw._ === 'messageService' || !this.raw.fwdFrom) return false\n\n const fwd = this.raw.fwdFrom\n\n return Boolean(\n this.chat.chatType === 'supergroup' &&\n fwd.savedFromMsgId &&\n fwd.savedFromPeer?._ === 'peerChannel' &&\n getMarkedPeerId(fwd.savedFromPeer) !== getMarkedPeerId(this.raw.peerId),\n )\n }\n\n /**\n * Information about comments (for channels) or replies (for groups)\n */\n get replies(): MessageRepliesInfo | null {\n if (this.raw._ !== 'message' || !this.raw.replies) return null\n\n return new MessageRepliesInfo(this.raw.replies, this._peers)\n }\n\n /**\n * For replies, information about the that is being replied to.\n *\n * Mutually exclusive with {@link replyToStory}\n */\n get replyToMessage(): RepliedMessageInfo | null {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return null\n\n return new RepliedMessageInfo(this.raw.replyTo, this._peers)\n }\n\n /**\n * For replies, information about the story that is being replied to\n *\n * Mutually exclusive with {@link replyToMessage}\n */\n get replyToStory(): tl.RawMessageReplyStoryHeader | null {\n if (this.raw.replyTo?._ !== 'messageReplyStoryHeader') return null\n\n return this.raw.replyTo\n }\n\n /** Whether this message is in a forum topic */\n get isTopicMessage(): boolean {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return false\n\n return this.raw.replyTo.forumTopic!\n }\n\n /**\n * Whether this message contains mention of the current user\n */\n get isMention(): boolean {\n return this.raw.mentioned!\n }\n\n /**\n * If non-null, this message is not actually sent, and is\n * instead inside a group of \"quick reply\" messages\n * under the given shortcut ID\n */\n get quickReplyShortcutId(): number | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.quickReplyShortcutId ?? null\n }\n\n /**\n * If this message is generated from an inline query,\n * information about the bot which generated it\n */\n get viaBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBotId))\n }\n\n /**\n * If this message was sent by a business bot on behalf of {@link sender},\n * information about the business bot.\n *\n * **Note**: only available to the business account and the bot itself.\n */\n get viaBusinessBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBusinessBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBusinessBotId))\n }\n\n /**\n * Message text or media caption.\n *\n * Empty string for service messages\n * (you should handle i18n yourself)\n */\n get text(): string {\n return this.raw._ === 'messageService' ? '' : this.raw.message\n }\n\n /**\n * Message text/caption entities (may be empty)\n */\n get entities(): ReadonlyArray<MessageEntity> {\n const entities: MessageEntity[] = []\n\n if (this.raw._ === 'message' && this.raw.entities?.length) {\n for (const ent of this.raw.entities) {\n entities.push(new MessageEntity(ent, this.raw.message))\n }\n }\n\n return entities\n }\n\n get textWithEntities(): TextWithEntities {\n if (this.raw._ === 'messageService') return { text: '', entities: [] }\n\n return {\n text: this.raw.message,\n entities: this.raw.entities,\n }\n }\n\n /**\n * Message action. `null` for non-service messages\n * or for unsupported events.\n *\n * For unsupported events, use `.raw.action` directly.\n */\n get action(): MessageAction | null {\n if (this.raw._ === 'message') {\n return null\n }\n\n return _messageActionFromTl.call(this, this.raw.action)\n }\n\n /**\n * Message media. `null` for text-only and service messages\n * and for unsupported media types.\n *\n * For unsupported media types, use `.raw.media` directly.\n */\n get media(): MessageMedia {\n if (this.raw._ === 'messageService' || !this.raw.media || this.raw.media._ === 'messageMediaEmpty') {\n return null\n }\n\n return _messageMediaFromTl(this._peers, this.raw.media)\n }\n\n /**\n * Whether this is a premium media\n * (e.g. >2gb file or fullscreen sticker)\n * that was forwarded without author by a non-premium user\n */\n get isForwardedPremiumMedia(): boolean {\n return this.raw._ === 'message' && this.raw.media?._ === 'messageMediaDocument' && this.raw.media.nopremium!\n }\n\n /**\n * TTL period of the message, in seconds.\n */\n get ttlPeriod(): number | null {\n return this.raw.ttlPeriod ?? null\n }\n\n /**\n * Reply markup provided with this message, if any.\n */\n get markup(): ReplyMarkup | null {\n if (this.raw._ === 'messageService' || !this.raw.replyMarkup) {\n return null\n }\n\n const rm = this.raw.replyMarkup\n\n switch (rm._) {\n case 'replyKeyboardHide':\n return {\n type: 'reply_hide',\n selective: rm.selective,\n }\n case 'replyKeyboardForceReply':\n return {\n type: 'force_reply',\n singleUse: rm.singleUse,\n selective: rm.selective,\n }\n case 'replyKeyboardMarkup':\n return {\n type: 'reply',\n resize: rm.resize,\n singleUse: rm.singleUse,\n selective: rm.selective,\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n case 'replyInlineMarkup':\n return {\n type: 'inline',\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n default:\n assertNever(rm)\n }\n }\n\n /**\n * Whether this message can be forwarded\n *\n * `false` for service mesasges and private restricted chats/chanenls\n */\n get canBeForwarded(): boolean {\n return this.raw._ === 'message' && !this.raw.noforwards\n }\n\n get reactions(): MessageReactions | null {\n if (this.raw._ === 'messageService' || !this.raw.reactions) {\n return null\n }\n\n return new MessageReactions(this.raw.id, getMarkedPeerId(this.raw.peerId), this.raw.reactions, this._peers)\n }\n\n /**\n * Generated permalink to this message, only for groups and channels\n *\n * @throws MtArgumentError In case the chat does not support message links\n */\n get link(): string {\n if (this.chat.chatType === 'supergroup' || this.chat.chatType === 'channel') {\n if (this.chat.username) {\n return `https://t.me/${this.chat.username}/${this.id}`\n }\n\n return `https://t.me/c/${toggleChannelIdMark(this.chat.id)}/${this.id}`\n }\n\n throw new MtArgumentError(`Cannot generate message link for ${this.chat.chatType}`)\n }\n}\n\nmemoizeGetters(Message, [\n 'sender',\n 'chat',\n 'forward',\n 'replies',\n 'viaBot',\n 'entities',\n 'action',\n 'media',\n 'markup',\n 'reactions',\n])\nmakeInspectable(Message, ['isScheduled'], ['link'])\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../src/highlevel/types/messages/message.ts"],"names":[],"mappings":";;;AAEA,wDAA0D;AAC1D,sDAAqD;AACrD,gEAAmF;AACnF,0EAAmE;AACnE,mDAAsD;AACtD,uDAAuD;AACvD,yDAAqE;AAErE,8CAAuC;AACvC,8CAAkD;AAElD,8CAAuC;AACvC,mDAA2C;AAC3C,2DAAyE;AACzE,2DAAmD;AACnD,6DAAyD;AACzD,yDAAsE;AACtE,iEAAyD;AACzD,6DAAyD;AACzD,6DAAyD;AAEzD;;GAEG;AACH,MAAa,OAAO;IAQH;IAKA;IAZb;;OAEG;IACM,GAAG,CAAsC;IAElD,YACI,GAAmB,EACV,MAAkB;IAC3B;;;OAGG;IACM,cAAc,KAAK;QALnB,WAAM,GAAN,MAAM,CAAY;QAKlB,gBAAW,GAAX,WAAW,CAAQ;QAE5B,IAAA,oCAAe,EAAC,cAAc,EAAE,GAAG,EAAE,cAAc,CAAC,CAAA;QAEpD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAClB,CAAC;IAED,iDAAiD;IACjD,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAA;IACtB,CAAC;IAED;;;;OAIG;IACH,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;IAC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AC,MAAM,IAAI,IAAI,CAAA;IAClC,CAAC;IAED;;;;OAIG;IACH,IAAI,IAAI;QACJ,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC1E,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACrB,OAAO,gBAAgB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;YAC1D,CAAC;YAED,OAAO,kBAAkB,IAAA,mCAAmB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE,CAAA;QAC3E,CAAC;QAED,MAAM,IAAI,2BAAe,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;IACvF,CAAC;CACJ;AAreD,0BAqeC;AAED,IAAA,2BAAc,EAAC,OAAO,EAAE;IACpB,QAAQ;IACR,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,WAAW;IACX,WAAW;CACd,CAAC,CAAA;AACF,IAAA,0BAAe,EAAC,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA","sourcesContent":["import { tl } from '@mtcute/tl'\n\nimport { MtArgumentError } from '../../../types/errors.js'\nimport { assertNever } from '../../../types/utils.js'\nimport { getMarkedPeerId, toggleChannelIdMark } from '../../../utils/peer-utils.js'\nimport { assertTypeIsNot } from '../../../utils/type-assertions.js'\nimport { makeInspectable } from '../../utils/index.js'\nimport { memoizeGetters } from '../../utils/memoize.js'\nimport { BotKeyboard, ReplyMarkup } from '../bots/keyboards/index.js'\nimport { TextWithEntities } from '../misc/index.js'\nimport { Chat } from '../peers/chat.js'\nimport { parsePeer, Peer } from '../peers/peer.js'\nimport { PeersIndex } from '../peers/peers-index.js'\nimport { User } from '../peers/user.js'\nimport { FactCheck } from './fact-check.js'\nimport { _messageActionFromTl, MessageAction } from './message-action.js'\nimport { MessageEntity } from './message-entity.js'\nimport { MessageForwardInfo } from './message-forward.js'\nimport { _messageMediaFromTl, MessageMedia } from './message-media.js'\nimport { MessageReactions } from './message-reactions.js'\nimport { MessageRepliesInfo } from './message-replies.js'\nimport { RepliedMessageInfo } from './replied-message.js'\n\n/**\n * A Telegram message.\n */\nexport class Message {\n /**\n * Raw TL object.\n */\n readonly raw: tl.RawMessage | tl.RawMessageService\n\n constructor(\n raw: tl.TypeMessage,\n readonly _peers: PeersIndex,\n /**\n * Whether the message is scheduled.\n * If it is, then its {@link date} is set to future.\n */\n readonly isScheduled = false,\n ) {\n assertTypeIsNot('Message#ctor', raw, 'messageEmpty')\n\n this.raw = raw\n }\n\n /** Unique message identifier inside this chat */\n get id(): number {\n return this.raw.id\n }\n\n /**\n * For channel posts, number of views\n *\n * `null` for service messages and non-post messages.\n */\n get views(): number | null {\n return this.raw._ === 'message' ? this.raw.views ?? null : null\n }\n\n /**\n * For channel posts, number of forwards\n *\n * `null` for service messages and non-post messages, or\n * if the current user is not an admin in the channel\n */\n get forwards(): number | null {\n return this.raw._ === 'message' ? this.raw.forwards ?? null : null\n }\n\n /**\n * For channel posts with signatures enabled, name of the post author\n */\n get signature(): string | null {\n return this.raw._ === 'message' ? this.raw.postAuthor ?? null : null\n }\n\n /**\n * Whether the message is incoming or outgoing:\n * - Messages received from other chats are incoming (`outgoing = false`)\n * - Messages sent by you to other chats are outgoing (`outgoing = true`)\n * - Messages to yourself (i.e. *Saved Messages*) are incoming (`outgoing = false`)\n */\n get isOutgoing(): boolean {\n return this.raw.out!\n }\n\n /**\n * Whether this message is a service message\n */\n get isService(): boolean {\n return this.raw._ === 'messageService'\n }\n\n /** Whether this message has content protection (i.e. disabled forwards) */\n get isContentProtected(): boolean {\n return this.raw._ === 'message' && this.raw.noforwards!\n }\n\n /**\n * Whether the message was sent by an implicit action, for example,\n * as an away or a greeting business message, or as a scheduled message\n */\n get isFromOffline(): boolean {\n return this.raw._ === 'message' && this.raw.offline!\n }\n\n /** Whether this is a silent message (no notification triggered) */\n get isSilent(): boolean {\n return this.raw.silent!\n }\n\n /** Whether there are unread media attachments in this message */\n get hasUnreadMedia(): boolean {\n return this.raw.mediaUnread!\n }\n\n /** Whether this is a broadcast channel post */\n get isChannelPost(): boolean {\n return this.raw._ === 'message' && this.raw.post!\n }\n\n /**\n * Whether this message was automatically sent from a scheduled message.\n *\n * **Note**: for messages sent by other users, this is always `false`.\n */\n get isFromScheduled(): boolean {\n return this.raw._ === 'message' && this.raw.fromScheduled!\n }\n\n /** Whether the message is pinned in the current chat */\n get isPinned(): boolean {\n return this.raw._ === 'message' && this.raw.pinned!\n }\n\n /** Whether the message should be considered unedited, even if {@link editDate} ≠ null */\n get hideEditMark(): boolean {\n return this.raw._ === 'message' && this.raw.editHide!\n }\n\n /**\n * If set, any eventual webpage preview should be shown on top of\n * the message instead of at the bottom.\n */\n get invertMedia(): boolean {\n return this.raw._ === 'message' && this.raw.invertMedia!\n }\n\n /**\n * Multiple media messages with the same grouped ID\n * indicate an album or media group\n *\n * `null` for service messages and non-grouped messages\n */\n get groupedId(): tl.Long | null {\n return this.raw._ === 'message' ? this.raw.groupedId ?? null : null\n }\n\n /**\n * Same as {@link groupedId}, but is globally unique across chats.\n */\n get groupedIdUnique(): string | null {\n if (!(this.raw._ === 'message' && this.raw.groupedId !== undefined)) return null\n\n return `${this.raw.groupedId.low}|${this.raw.groupedId.high}|${getMarkedPeerId(this.raw.peerId)}`\n }\n\n /**\n * Message sender.\n *\n * Usually is a {@link User}, but can be a {@link Chat}\n * in case the message was sent by an anonymous admin, anonymous premium user,\n * or if the message is a forwarded channel post.\n *\n * If the message was sent by an anonymous admin,\n * sender will equal to {@link chat}.\n *\n * If the message is a forwarded channel post,\n * sender is the channel itself.\n */\n get sender(): Peer {\n const from = this.raw.fromId\n\n if (!from) {\n if (this.raw.peerId._ === 'peerUser') {\n return new User(this._peers.user(this.raw.peerId.userId))\n }\n\n // anon admin, return the chat\n return this.chat\n }\n\n return parsePeer(from, this._peers)\n }\n\n /**\n * Number of boosts applied to this {@link chat} by the sender\n */\n get senderBoostCount(): number {\n if (this.raw._ !== 'message') return 0\n\n return this.raw.fromBoostsApplied ?? 0\n }\n\n /**\n * Conversation the message belongs to\n */\n get chat(): Chat {\n return Chat._parseFromMessage(this.raw, this._peers)\n }\n\n /**\n * Date when the message was sent\n */\n get date(): Date {\n return new Date(this.raw.date * 1000)\n }\n\n /**\n * Date when the message was last edited\n */\n get editDate(): Date | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.editDate ? new Date(this.raw.editDate * 1000) : null\n }\n\n /**\n * If this message is a forward, contains info about it.\n */\n get forward(): MessageForwardInfo | null {\n if (this.raw._ !== 'message' || !this.raw.fwdFrom) {\n return null\n }\n\n return new MessageForwardInfo(this.raw.fwdFrom, this._peers)\n }\n\n /**\n * Whether the message is a channel post that was\n * automatically forwarded to the connected discussion group\n */\n get isAutomaticForward(): boolean {\n if (this.raw._ === 'messageService' || !this.raw.fwdFrom) return false\n\n const fwd = this.raw.fwdFrom\n\n return Boolean(\n this.chat.chatType === 'supergroup' &&\n fwd.savedFromMsgId &&\n fwd.savedFromPeer?._ === 'peerChannel' &&\n getMarkedPeerId(fwd.savedFromPeer) !== getMarkedPeerId(this.raw.peerId),\n )\n }\n\n /**\n * Information about comments (for channels) or replies (for groups)\n */\n get replies(): MessageRepliesInfo | null {\n if (this.raw._ !== 'message' || !this.raw.replies) return null\n\n return new MessageRepliesInfo(this.raw.replies, this._peers)\n }\n\n /**\n * For replies, information about the that is being replied to.\n *\n * Mutually exclusive with {@link replyToStory}\n */\n get replyToMessage(): RepliedMessageInfo | null {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return null\n\n return new RepliedMessageInfo(this.raw.replyTo, this._peers)\n }\n\n /**\n * For replies, information about the story that is being replied to\n *\n * Mutually exclusive with {@link replyToMessage}\n */\n get replyToStory(): tl.RawMessageReplyStoryHeader | null {\n if (this.raw.replyTo?._ !== 'messageReplyStoryHeader') return null\n\n return this.raw.replyTo\n }\n\n /** Whether this message is in a forum topic */\n get isTopicMessage(): boolean {\n if (this.raw.replyTo?._ !== 'messageReplyHeader') return false\n\n return this.raw.replyTo.forumTopic!\n }\n\n /**\n * Whether this message contains mention of the current user\n */\n get isMention(): boolean {\n return this.raw.mentioned!\n }\n\n /**\n * If non-null, this message is not actually sent, and is\n * instead inside a group of \"quick reply\" messages\n * under the given shortcut ID\n */\n get quickReplyShortcutId(): number | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.quickReplyShortcutId ?? null\n }\n\n /**\n * If this message is generated from an inline query,\n * information about the bot which generated it\n */\n get viaBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBotId))\n }\n\n /**\n * If this message was sent by a business bot on behalf of {@link sender},\n * information about the business bot.\n *\n * **Note**: only available to the business account and the bot itself.\n */\n get viaBusinessBot(): User | null {\n if (this.raw._ === 'messageService' || !this.raw.viaBusinessBotId) {\n return null\n }\n\n return new User(this._peers.user(this.raw.viaBusinessBotId))\n }\n\n /**\n * Message text or media caption.\n *\n * Empty string for service messages\n * (you should handle i18n yourself)\n */\n get text(): string {\n return this.raw._ === 'messageService' ? '' : this.raw.message\n }\n\n /**\n * Message text/caption entities (may be empty)\n */\n get entities(): ReadonlyArray<MessageEntity> {\n const entities: MessageEntity[] = []\n\n if (this.raw._ === 'message' && this.raw.entities?.length) {\n for (const ent of this.raw.entities) {\n entities.push(new MessageEntity(ent, this.raw.message))\n }\n }\n\n return entities\n }\n\n get textWithEntities(): TextWithEntities {\n if (this.raw._ === 'messageService') return { text: '', entities: [] }\n\n return {\n text: this.raw.message,\n entities: this.raw.entities,\n }\n }\n\n /**\n * Message action. `null` for non-service messages\n * or for unsupported events.\n *\n * For unsupported events, use `.raw.action` directly.\n */\n get action(): MessageAction | null {\n if (this.raw._ === 'message') {\n return null\n }\n\n return _messageActionFromTl.call(this, this.raw.action)\n }\n\n /**\n * Message media. `null` for text-only and service messages\n * and for unsupported media types.\n *\n * For unsupported media types, use `.raw.media` directly.\n */\n get media(): MessageMedia {\n if (this.raw._ === 'messageService' || !this.raw.media || this.raw.media._ === 'messageMediaEmpty') {\n return null\n }\n\n return _messageMediaFromTl(this._peers, this.raw.media)\n }\n\n /**\n * Whether this is a premium media\n * (e.g. >2gb file or fullscreen sticker)\n * that was forwarded without author by a non-premium user\n */\n get isForwardedPremiumMedia(): boolean {\n return this.raw._ === 'message' && this.raw.media?._ === 'messageMediaDocument' && this.raw.media.nopremium!\n }\n\n /**\n * TTL period of the message, in seconds.\n */\n get ttlPeriod(): number | null {\n return this.raw.ttlPeriod ?? null\n }\n\n /**\n * Reply markup provided with this message, if any.\n */\n get markup(): ReplyMarkup | null {\n if (this.raw._ === 'messageService' || !this.raw.replyMarkup) {\n return null\n }\n\n const rm = this.raw.replyMarkup\n\n switch (rm._) {\n case 'replyKeyboardHide':\n return {\n type: 'reply_hide',\n selective: rm.selective,\n }\n case 'replyKeyboardForceReply':\n return {\n type: 'force_reply',\n singleUse: rm.singleUse,\n selective: rm.selective,\n }\n case 'replyKeyboardMarkup':\n return {\n type: 'reply',\n resize: rm.resize,\n singleUse: rm.singleUse,\n selective: rm.selective,\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n case 'replyInlineMarkup':\n return {\n type: 'inline',\n buttons: BotKeyboard._rowsTo2d(rm.rows),\n }\n default:\n assertNever(rm)\n }\n }\n\n /**\n * Whether this message can be forwarded\n *\n * `false` for service mesasges and private restricted chats/chanenls\n */\n get canBeForwarded(): boolean {\n return this.raw._ === 'message' && !this.raw.noforwards\n }\n\n /**\n * Reactions added to this message, if any\n */\n get reactions(): MessageReactions | null {\n if (this.raw._ === 'messageService' || !this.raw.reactions) {\n return null\n }\n\n return new MessageReactions(this.raw.id, getMarkedPeerId(this.raw.peerId), this.raw.reactions, this._peers)\n }\n\n /**\n * Information about fact-check added to the message, if any\n */\n get factCheck(): FactCheck | null {\n if (this.raw._ === 'messageService') return null\n if (!this.raw.factcheck || this.raw.factcheck.hash.isZero()) return null\n\n return new FactCheck(this.raw.factcheck)\n }\n\n /**\n * If this message was sent with a message effect, ID of the effect\n */\n get effectId(): tl.Long | null {\n if (this.raw._ === 'messageService') return null\n\n return this.raw.effect ?? null\n }\n\n /**\n * Generated permalink to this message, only for groups and channels\n *\n * @throws MtArgumentError In case the chat does not support message links\n */\n get link(): string {\n if (this.chat.chatType === 'supergroup' || this.chat.chatType === 'channel') {\n if (this.chat.username) {\n return `https://t.me/${this.chat.username}/${this.id}`\n }\n\n return `https://t.me/c/${toggleChannelIdMark(this.chat.id)}/${this.id}`\n }\n\n throw new MtArgumentError(`Cannot generate message link for ${this.chat.chatType}`)\n }\n}\n\nmemoizeGetters(Message, [\n 'sender',\n 'chat',\n 'forward',\n 'replies',\n 'viaBot',\n 'entities',\n 'action',\n 'media',\n 'markup',\n 'reactions',\n 'factCheck',\n])\nmakeInspectable(Message, ['isScheduled'], ['link'])\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.
|
package/esm/highlevel/client.js
CHANGED
|
@@ -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';
|
|
@@ -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
|
};
|