@mtcute/core 0.29.5 → 0.29.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.cjs +4 -0
- package/client.js +4 -0
- package/highlevel/client.d.cts +30 -0
- package/highlevel/client.d.ts +30 -0
- package/highlevel/methods/files/normalize-input-media.cjs +21 -1
- package/highlevel/methods/files/normalize-input-media.js +21 -1
- package/highlevel/methods/messages/create-streaming-draft.cjs +57 -0
- package/highlevel/methods/messages/create-streaming-draft.d.cts +36 -0
- package/highlevel/methods/messages/create-streaming-draft.d.ts +36 -0
- package/highlevel/methods/messages/create-streaming-draft.js +52 -0
- package/highlevel/methods/messages/send-common.cjs +2 -1
- package/highlevel/methods/messages/send-common.d.cts +4 -0
- package/highlevel/methods/messages/send-common.d.ts +4 -0
- package/highlevel/methods/messages/send-common.js +2 -1
- package/highlevel/methods/messages/send-media.cjs +1 -1
- package/highlevel/methods/messages/send-media.d.cts +3 -0
- package/highlevel/methods/messages/send-media.d.ts +3 -0
- package/highlevel/methods/messages/send-media.js +1 -1
- package/highlevel/methods/messages/send-text.cjs +1 -1
- package/highlevel/methods/messages/send-text.d.cts +3 -0
- package/highlevel/methods/messages/send-text.d.ts +3 -0
- package/highlevel/methods/messages/send-text.js +1 -1
- package/highlevel/methods.d.cts +2 -0
- package/highlevel/methods.d.ts +2 -0
- package/highlevel/types/media/input-media/types.d.cts +14 -0
- package/highlevel/types/media/input-media/types.d.ts +14 -0
- package/highlevel/types/media/photo.cjs +8 -0
- package/highlevel/types/media/photo.d.cts +2 -0
- package/highlevel/types/media/photo.d.ts +2 -0
- package/highlevel/types/media/photo.js +8 -0
- package/highlevel/types/media/poll.cjs +44 -4
- package/highlevel/types/media/poll.d.cts +19 -1
- package/highlevel/types/media/poll.d.ts +19 -1
- package/highlevel/types/media/poll.js +44 -4
- package/highlevel/types/messages/message-media.cjs +6 -1
- package/highlevel/types/messages/message-media.js +6 -1
- package/highlevel/types/messages/replied-message.cjs +4 -0
- package/highlevel/types/messages/replied-message.d.cts +2 -0
- package/highlevel/types/messages/replied-message.d.ts +2 -0
- package/highlevel/types/messages/replied-message.js +4 -0
- package/highlevel/types/messages/search-filters.cjs +2 -1
- package/highlevel/types/messages/search-filters.d.cts +4 -0
- package/highlevel/types/messages/search-filters.d.ts +4 -0
- package/highlevel/types/messages/search-filters.js +2 -1
- package/methods.cjs +2 -0
- package/methods.js +2 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +1 -1
|
@@ -131,6 +131,8 @@ export interface InputMediaPhoto extends FileMixin, CaptionMixin {
|
|
|
131
131
|
* Whether this photo should be hidden with a spoiler
|
|
132
132
|
*/
|
|
133
133
|
spoiler?: boolean;
|
|
134
|
+
/** If this is a live photo, the video representing it */
|
|
135
|
+
livePhotoVideo?: InputMediaLike;
|
|
134
136
|
}
|
|
135
137
|
/**
|
|
136
138
|
* A sticker to be sent
|
|
@@ -404,6 +406,8 @@ export interface InputMediaPoll extends CaptionMixin {
|
|
|
404
406
|
* Question of the poll (1-255 chars for users, 1-300 chars for bots)
|
|
405
407
|
*/
|
|
406
408
|
question: InputText;
|
|
409
|
+
/** Media attached to the poll */
|
|
410
|
+
attachedMedia?: InputMediaLike;
|
|
407
411
|
/**
|
|
408
412
|
* Answers of the poll.
|
|
409
413
|
*
|
|
@@ -444,6 +448,14 @@ export interface InputMediaPoll extends CaptionMixin {
|
|
|
444
448
|
* When `number` is used, UNIX time in ms is expected
|
|
445
449
|
*/
|
|
446
450
|
closeDate?: number | Date;
|
|
451
|
+
/** Whether participants can suggest new options to the poll */
|
|
452
|
+
openAnswers?: boolean;
|
|
453
|
+
/** Whether retracting the votes should be disabled in the poll */
|
|
454
|
+
disableRevoting?: boolean;
|
|
455
|
+
/** Whether answers to the poll should be shuffled before showing to the user */
|
|
456
|
+
shuffleAnswers?: boolean;
|
|
457
|
+
/** Whether the results of the poll should be hidden until the end of the poll */
|
|
458
|
+
hideResultsUntilClose?: boolean;
|
|
447
459
|
}
|
|
448
460
|
/**
|
|
449
461
|
* A quiz to be sent.
|
|
@@ -461,6 +473,8 @@ export interface InputMediaQuiz extends Omit<InputMediaPoll, 'type'> {
|
|
|
461
473
|
* Explanation of the quiz solution
|
|
462
474
|
*/
|
|
463
475
|
solution?: InputText;
|
|
476
|
+
/** Media attached to the solution */
|
|
477
|
+
solutionMedia?: InputMediaLike;
|
|
464
478
|
}
|
|
465
479
|
/**
|
|
466
480
|
* A story to be sent
|
|
@@ -131,6 +131,8 @@ export interface InputMediaPhoto extends FileMixin, CaptionMixin {
|
|
|
131
131
|
* Whether this photo should be hidden with a spoiler
|
|
132
132
|
*/
|
|
133
133
|
spoiler?: boolean;
|
|
134
|
+
/** If this is a live photo, the video representing it */
|
|
135
|
+
livePhotoVideo?: InputMediaLike;
|
|
134
136
|
}
|
|
135
137
|
/**
|
|
136
138
|
* A sticker to be sent
|
|
@@ -404,6 +406,8 @@ export interface InputMediaPoll extends CaptionMixin {
|
|
|
404
406
|
* Question of the poll (1-255 chars for users, 1-300 chars for bots)
|
|
405
407
|
*/
|
|
406
408
|
question: InputText;
|
|
409
|
+
/** Media attached to the poll */
|
|
410
|
+
attachedMedia?: InputMediaLike;
|
|
407
411
|
/**
|
|
408
412
|
* Answers of the poll.
|
|
409
413
|
*
|
|
@@ -444,6 +448,14 @@ export interface InputMediaPoll extends CaptionMixin {
|
|
|
444
448
|
* When `number` is used, UNIX time in ms is expected
|
|
445
449
|
*/
|
|
446
450
|
closeDate?: number | Date;
|
|
451
|
+
/** Whether participants can suggest new options to the poll */
|
|
452
|
+
openAnswers?: boolean;
|
|
453
|
+
/** Whether retracting the votes should be disabled in the poll */
|
|
454
|
+
disableRevoting?: boolean;
|
|
455
|
+
/** Whether answers to the poll should be shuffled before showing to the user */
|
|
456
|
+
shuffleAnswers?: boolean;
|
|
457
|
+
/** Whether the results of the poll should be hidden until the end of the poll */
|
|
458
|
+
hideResultsUntilClose?: boolean;
|
|
447
459
|
}
|
|
448
460
|
/**
|
|
449
461
|
* A quiz to be sent.
|
|
@@ -461,6 +473,8 @@ export interface InputMediaQuiz extends Omit<InputMediaPoll, 'type'> {
|
|
|
461
473
|
* Explanation of the quiz solution
|
|
462
474
|
*/
|
|
463
475
|
solution?: InputText;
|
|
476
|
+
/** Media attached to the solution */
|
|
477
|
+
solutionMedia?: InputMediaLike;
|
|
464
478
|
}
|
|
465
479
|
/**
|
|
466
480
|
* A story to be sent
|
|
@@ -7,6 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const errors = require("../../../types/errors.cjs");
|
|
9
9
|
const memoize = require("../../utils/memoize.cjs");
|
|
10
|
+
const documentUtils = require("./document-utils.cjs");
|
|
10
11
|
const thumbnail = require("./thumbnail.cjs");
|
|
11
12
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
12
13
|
const fileLocation = require("../files/file-location.cjs");
|
|
@@ -136,6 +137,13 @@ class Photo extends fileLocation.FileLocation {
|
|
|
136
137
|
}
|
|
137
138
|
return this.getThumbnail(this._bestSize.type).uniqueFileId;
|
|
138
139
|
}
|
|
140
|
+
get livePhotoVideo() {
|
|
141
|
+
if (!this.media?.video) return null;
|
|
142
|
+
if (this.media.video._ !== "document") return null;
|
|
143
|
+
const parsed = documentUtils.parseDocument(this.media.video);
|
|
144
|
+
if (parsed.type !== "video") return null;
|
|
145
|
+
return parsed;
|
|
146
|
+
}
|
|
139
147
|
/**
|
|
140
148
|
* Input photo generated from this object.
|
|
141
149
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { Video } from './video.js';
|
|
2
3
|
import { FileLocation } from '../files/index.js';
|
|
3
4
|
import { Thumbnail } from './thumbnail.js';
|
|
4
5
|
/**
|
|
@@ -59,6 +60,7 @@ export declare class Photo extends FileLocation {
|
|
|
59
60
|
* representing this photo's best thumbnail.
|
|
60
61
|
*/
|
|
61
62
|
get uniqueFileId(): string;
|
|
63
|
+
get livePhotoVideo(): Video | null;
|
|
62
64
|
/**
|
|
63
65
|
* Input photo generated from this object.
|
|
64
66
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { Video } from './video.js';
|
|
2
3
|
import { FileLocation } from '../files/index.js';
|
|
3
4
|
import { Thumbnail } from './thumbnail.js';
|
|
4
5
|
/**
|
|
@@ -59,6 +60,7 @@ export declare class Photo extends FileLocation {
|
|
|
59
60
|
* representing this photo's best thumbnail.
|
|
60
61
|
*/
|
|
61
62
|
get uniqueFileId(): string;
|
|
63
|
+
get livePhotoVideo(): Video | null;
|
|
62
64
|
/**
|
|
63
65
|
* Input photo generated from this object.
|
|
64
66
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MtArgumentError } from "../../../types/errors.js";
|
|
2
2
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
3
|
+
import { parseDocument } from "./document-utils.js";
|
|
3
4
|
import { Thumbnail as Thumbnail$2 } from "./thumbnail.js";
|
|
4
5
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
5
6
|
import { FileLocation as FileLocation$1 } from "../files/file-location.js";
|
|
@@ -129,6 +130,13 @@ class Photo extends FileLocation$1 {
|
|
|
129
130
|
}
|
|
130
131
|
return this.getThumbnail(this._bestSize.type).uniqueFileId;
|
|
131
132
|
}
|
|
133
|
+
get livePhotoVideo() {
|
|
134
|
+
if (!this.media?.video) return null;
|
|
135
|
+
if (this.media.video._ !== "document") return null;
|
|
136
|
+
const parsed = parseDocument(this.media.video);
|
|
137
|
+
if (parsed.type !== "video") return null;
|
|
138
|
+
return parsed;
|
|
139
|
+
}
|
|
132
140
|
/**
|
|
133
141
|
* Input photo generated from this object.
|
|
134
142
|
*/
|
|
@@ -9,6 +9,7 @@ const Long = require("long");
|
|
|
9
9
|
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
10
10
|
const memoize = require("../../utils/memoize.cjs");
|
|
11
11
|
const messageEntity = require("../messages/message-entity.cjs");
|
|
12
|
+
const messageMedia = require("../messages/message-media.cjs");
|
|
12
13
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
13
14
|
class PollAnswer {
|
|
14
15
|
constructor(raw, result) {
|
|
@@ -58,14 +59,19 @@ class PollAnswer {
|
|
|
58
59
|
get correct() {
|
|
59
60
|
return Boolean(this.result?.correct);
|
|
60
61
|
}
|
|
62
|
+
/** Media attached to this answer, if any */
|
|
63
|
+
get media() {
|
|
64
|
+
return this.raw.media ? messageMedia._messageMediaFromTl(null, this.raw.media) : null;
|
|
65
|
+
}
|
|
61
66
|
}
|
|
62
|
-
const PollAnswer$1 = /* @__PURE__ */ memoize.memoizeGetters(PollAnswer, ["textEntities"]);
|
|
67
|
+
const PollAnswer$1 = /* @__PURE__ */ memoize.memoizeGetters(PollAnswer, ["textEntities", "media"]);
|
|
63
68
|
const PollAnswer$2 = /* @__PURE__ */ inspectable.makeInspectable(PollAnswer$1);
|
|
64
69
|
class Poll {
|
|
65
|
-
constructor(raw, _peers, results) {
|
|
70
|
+
constructor(raw, _peers, results, attachedMedia) {
|
|
66
71
|
this.raw = raw;
|
|
67
72
|
this._peers = _peers;
|
|
68
73
|
this.results = results;
|
|
74
|
+
this.attachedMedia = attachedMedia;
|
|
69
75
|
}
|
|
70
76
|
type = "poll";
|
|
71
77
|
/**
|
|
@@ -131,6 +137,30 @@ class Poll {
|
|
|
131
137
|
get isMultiple() {
|
|
132
138
|
return this.raw.multipleChoice;
|
|
133
139
|
}
|
|
140
|
+
/** Whether the current user is the creator of this poll */
|
|
141
|
+
get isCreator() {
|
|
142
|
+
return this.raw.creator;
|
|
143
|
+
}
|
|
144
|
+
/** Whether new options can be suggested to this poll */
|
|
145
|
+
get canAddAnswers() {
|
|
146
|
+
return !this.raw.closed && !this.raw.openAnswers;
|
|
147
|
+
}
|
|
148
|
+
/** Whether retracting the vote is disabled in this poll */
|
|
149
|
+
get isRevotingDisabled() {
|
|
150
|
+
return this.raw.revotingDisabled;
|
|
151
|
+
}
|
|
152
|
+
/** Whether answers to this poll should be shuffled before showing to the user */
|
|
153
|
+
get shuffleAnswers() {
|
|
154
|
+
return this.raw.shuffleAnswers;
|
|
155
|
+
}
|
|
156
|
+
/** Whether the results of this poll are hidden until the end of the poll */
|
|
157
|
+
get hideResultsUntilClose() {
|
|
158
|
+
return this.raw.hideResultsUntilClose;
|
|
159
|
+
}
|
|
160
|
+
/** Whether the poll has unread votes */
|
|
161
|
+
get hasUnreaVotes() {
|
|
162
|
+
return this.results?.hasUnreadVotes ?? false;
|
|
163
|
+
}
|
|
134
164
|
/**
|
|
135
165
|
* Solution for the quiz, only available
|
|
136
166
|
* in case you have already answered
|
|
@@ -152,6 +182,10 @@ class Poll {
|
|
|
152
182
|
}
|
|
153
183
|
return res;
|
|
154
184
|
}
|
|
185
|
+
/** Media attached to the solution, if any */
|
|
186
|
+
get solutionMedia() {
|
|
187
|
+
return this.results?.solutionMedia ? messageMedia._messageMediaFromTl(null, this.results.solutionMedia) : null;
|
|
188
|
+
}
|
|
155
189
|
/**
|
|
156
190
|
* Input media TL object generated from this object,
|
|
157
191
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -170,6 +204,8 @@ class Poll {
|
|
|
170
204
|
get inputMedia() {
|
|
171
205
|
return {
|
|
172
206
|
_: "inputMediaPoll",
|
|
207
|
+
attachedMedia: this.attachedMedia?.inputMedia,
|
|
208
|
+
solutionMedia: this.solutionMedia?.inputMedia,
|
|
173
209
|
poll: {
|
|
174
210
|
_: "poll",
|
|
175
211
|
closed: false,
|
|
@@ -180,12 +216,16 @@ class Poll {
|
|
|
180
216
|
answers: this.raw.answers,
|
|
181
217
|
closePeriod: this.raw.closePeriod,
|
|
182
218
|
closeDate: this.raw.closeDate,
|
|
219
|
+
openAnswers: this.raw.openAnswers,
|
|
220
|
+
revotingDisabled: this.raw.revotingDisabled,
|
|
221
|
+
shuffleAnswers: this.raw.shuffleAnswers,
|
|
222
|
+
hideResultsUntilClose: this.raw.hideResultsUntilClose,
|
|
183
223
|
hash: Long.ZERO
|
|
184
224
|
}
|
|
185
225
|
};
|
|
186
226
|
}
|
|
187
227
|
}
|
|
188
|
-
const Poll$1 = /* @__PURE__ */ memoize.memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities"]);
|
|
189
|
-
const Poll$2 = /* @__PURE__ */ inspectable.makeInspectable(Poll$1,
|
|
228
|
+
const Poll$1 = /* @__PURE__ */ memoize.memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities", "solutionMedia"]);
|
|
229
|
+
const Poll$2 = /* @__PURE__ */ inspectable.makeInspectable(Poll$1, ["attachedMedia"], ["inputMedia"]);
|
|
190
230
|
exports.Poll = Poll$2;
|
|
191
231
|
exports.PollAnswer = PollAnswer$2;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { MessageMedia } from '../messages/message-media.js';
|
|
2
3
|
import { PeersIndex } from '../peers/peers-index.js';
|
|
3
4
|
import { MessageEntity } from '../messages/message-entity.js';
|
|
4
5
|
export declare class PollAnswer {
|
|
@@ -36,13 +37,16 @@ export declare class PollAnswer {
|
|
|
36
37
|
* @default
|
|
37
38
|
*/
|
|
38
39
|
get correct(): boolean;
|
|
40
|
+
/** Media attached to this answer, if any */
|
|
41
|
+
get media(): MessageMedia | null;
|
|
39
42
|
}
|
|
40
43
|
export declare class Poll {
|
|
41
44
|
readonly raw: tl.TypePoll;
|
|
42
45
|
readonly _peers: PeersIndex;
|
|
43
46
|
readonly results?: tl.RawPollResults | undefined;
|
|
47
|
+
readonly attachedMedia?: MessageMedia | undefined;
|
|
44
48
|
readonly type: "poll";
|
|
45
|
-
constructor(raw: tl.TypePoll, _peers: PeersIndex, results?: tl.RawPollResults | undefined);
|
|
49
|
+
constructor(raw: tl.TypePoll, _peers: PeersIndex, results?: tl.RawPollResults | undefined, attachedMedia?: MessageMedia | undefined);
|
|
46
50
|
/**
|
|
47
51
|
* Unique identifier of the poll
|
|
48
52
|
*/
|
|
@@ -81,6 +85,18 @@ export declare class Poll {
|
|
|
81
85
|
* Whether this poll accepts multiple answers
|
|
82
86
|
*/
|
|
83
87
|
get isMultiple(): boolean;
|
|
88
|
+
/** Whether the current user is the creator of this poll */
|
|
89
|
+
get isCreator(): boolean;
|
|
90
|
+
/** Whether new options can be suggested to this poll */
|
|
91
|
+
get canAddAnswers(): boolean;
|
|
92
|
+
/** Whether retracting the vote is disabled in this poll */
|
|
93
|
+
get isRevotingDisabled(): boolean;
|
|
94
|
+
/** Whether answers to this poll should be shuffled before showing to the user */
|
|
95
|
+
get shuffleAnswers(): boolean;
|
|
96
|
+
/** Whether the results of this poll are hidden until the end of the poll */
|
|
97
|
+
get hideResultsUntilClose(): boolean;
|
|
98
|
+
/** Whether the poll has unread votes */
|
|
99
|
+
get hasUnreaVotes(): boolean;
|
|
84
100
|
/**
|
|
85
101
|
* Solution for the quiz, only available
|
|
86
102
|
* in case you have already answered
|
|
@@ -91,6 +107,8 @@ export declare class Poll {
|
|
|
91
107
|
* in case you have already answered
|
|
92
108
|
*/
|
|
93
109
|
get solutionEntities(): ReadonlyArray<MessageEntity> | null;
|
|
110
|
+
/** Media attached to the solution, if any */
|
|
111
|
+
get solutionMedia(): MessageMedia | null;
|
|
94
112
|
/**
|
|
95
113
|
* Input media TL object generated from this object,
|
|
96
114
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { MessageMedia } from '../messages/message-media.js';
|
|
2
3
|
import { PeersIndex } from '../peers/peers-index.js';
|
|
3
4
|
import { MessageEntity } from '../messages/message-entity.js';
|
|
4
5
|
export declare class PollAnswer {
|
|
@@ -36,13 +37,16 @@ export declare class PollAnswer {
|
|
|
36
37
|
* @default
|
|
37
38
|
*/
|
|
38
39
|
get correct(): boolean;
|
|
40
|
+
/** Media attached to this answer, if any */
|
|
41
|
+
get media(): MessageMedia | null;
|
|
39
42
|
}
|
|
40
43
|
export declare class Poll {
|
|
41
44
|
readonly raw: tl.TypePoll;
|
|
42
45
|
readonly _peers: PeersIndex;
|
|
43
46
|
readonly results?: tl.RawPollResults | undefined;
|
|
47
|
+
readonly attachedMedia?: MessageMedia | undefined;
|
|
44
48
|
readonly type: "poll";
|
|
45
|
-
constructor(raw: tl.TypePoll, _peers: PeersIndex, results?: tl.RawPollResults | undefined);
|
|
49
|
+
constructor(raw: tl.TypePoll, _peers: PeersIndex, results?: tl.RawPollResults | undefined, attachedMedia?: MessageMedia | undefined);
|
|
46
50
|
/**
|
|
47
51
|
* Unique identifier of the poll
|
|
48
52
|
*/
|
|
@@ -81,6 +85,18 @@ export declare class Poll {
|
|
|
81
85
|
* Whether this poll accepts multiple answers
|
|
82
86
|
*/
|
|
83
87
|
get isMultiple(): boolean;
|
|
88
|
+
/** Whether the current user is the creator of this poll */
|
|
89
|
+
get isCreator(): boolean;
|
|
90
|
+
/** Whether new options can be suggested to this poll */
|
|
91
|
+
get canAddAnswers(): boolean;
|
|
92
|
+
/** Whether retracting the vote is disabled in this poll */
|
|
93
|
+
get isRevotingDisabled(): boolean;
|
|
94
|
+
/** Whether answers to this poll should be shuffled before showing to the user */
|
|
95
|
+
get shuffleAnswers(): boolean;
|
|
96
|
+
/** Whether the results of this poll are hidden until the end of the poll */
|
|
97
|
+
get hideResultsUntilClose(): boolean;
|
|
98
|
+
/** Whether the poll has unread votes */
|
|
99
|
+
get hasUnreaVotes(): boolean;
|
|
84
100
|
/**
|
|
85
101
|
* Solution for the quiz, only available
|
|
86
102
|
* in case you have already answered
|
|
@@ -91,6 +107,8 @@ export declare class Poll {
|
|
|
91
107
|
* in case you have already answered
|
|
92
108
|
*/
|
|
93
109
|
get solutionEntities(): ReadonlyArray<MessageEntity> | null;
|
|
110
|
+
/** Media attached to the solution, if any */
|
|
111
|
+
get solutionMedia(): MessageMedia | null;
|
|
94
112
|
/**
|
|
95
113
|
* Input media TL object generated from this object,
|
|
96
114
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -2,6 +2,7 @@ import Long from "long";
|
|
|
2
2
|
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
3
3
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
4
4
|
import { MessageEntity as MessageEntity$2 } from "../messages/message-entity.js";
|
|
5
|
+
import { _messageMediaFromTl } from "../messages/message-media.js";
|
|
5
6
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
6
7
|
class PollAnswer {
|
|
7
8
|
constructor(raw, result) {
|
|
@@ -51,14 +52,19 @@ class PollAnswer {
|
|
|
51
52
|
get correct() {
|
|
52
53
|
return Boolean(this.result?.correct);
|
|
53
54
|
}
|
|
55
|
+
/** Media attached to this answer, if any */
|
|
56
|
+
get media() {
|
|
57
|
+
return this.raw.media ? _messageMediaFromTl(null, this.raw.media) : null;
|
|
58
|
+
}
|
|
54
59
|
}
|
|
55
|
-
const PollAnswer$1 = /* @__PURE__ */ memoizeGetters(PollAnswer, ["textEntities"]);
|
|
60
|
+
const PollAnswer$1 = /* @__PURE__ */ memoizeGetters(PollAnswer, ["textEntities", "media"]);
|
|
56
61
|
const PollAnswer$2 = /* @__PURE__ */ makeInspectable(PollAnswer$1);
|
|
57
62
|
class Poll {
|
|
58
|
-
constructor(raw, _peers, results) {
|
|
63
|
+
constructor(raw, _peers, results, attachedMedia) {
|
|
59
64
|
this.raw = raw;
|
|
60
65
|
this._peers = _peers;
|
|
61
66
|
this.results = results;
|
|
67
|
+
this.attachedMedia = attachedMedia;
|
|
62
68
|
}
|
|
63
69
|
type = "poll";
|
|
64
70
|
/**
|
|
@@ -124,6 +130,30 @@ class Poll {
|
|
|
124
130
|
get isMultiple() {
|
|
125
131
|
return this.raw.multipleChoice;
|
|
126
132
|
}
|
|
133
|
+
/** Whether the current user is the creator of this poll */
|
|
134
|
+
get isCreator() {
|
|
135
|
+
return this.raw.creator;
|
|
136
|
+
}
|
|
137
|
+
/** Whether new options can be suggested to this poll */
|
|
138
|
+
get canAddAnswers() {
|
|
139
|
+
return !this.raw.closed && !this.raw.openAnswers;
|
|
140
|
+
}
|
|
141
|
+
/** Whether retracting the vote is disabled in this poll */
|
|
142
|
+
get isRevotingDisabled() {
|
|
143
|
+
return this.raw.revotingDisabled;
|
|
144
|
+
}
|
|
145
|
+
/** Whether answers to this poll should be shuffled before showing to the user */
|
|
146
|
+
get shuffleAnswers() {
|
|
147
|
+
return this.raw.shuffleAnswers;
|
|
148
|
+
}
|
|
149
|
+
/** Whether the results of this poll are hidden until the end of the poll */
|
|
150
|
+
get hideResultsUntilClose() {
|
|
151
|
+
return this.raw.hideResultsUntilClose;
|
|
152
|
+
}
|
|
153
|
+
/** Whether the poll has unread votes */
|
|
154
|
+
get hasUnreaVotes() {
|
|
155
|
+
return this.results?.hasUnreadVotes ?? false;
|
|
156
|
+
}
|
|
127
157
|
/**
|
|
128
158
|
* Solution for the quiz, only available
|
|
129
159
|
* in case you have already answered
|
|
@@ -145,6 +175,10 @@ class Poll {
|
|
|
145
175
|
}
|
|
146
176
|
return res;
|
|
147
177
|
}
|
|
178
|
+
/** Media attached to the solution, if any */
|
|
179
|
+
get solutionMedia() {
|
|
180
|
+
return this.results?.solutionMedia ? _messageMediaFromTl(null, this.results.solutionMedia) : null;
|
|
181
|
+
}
|
|
148
182
|
/**
|
|
149
183
|
* Input media TL object generated from this object,
|
|
150
184
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -163,6 +197,8 @@ class Poll {
|
|
|
163
197
|
get inputMedia() {
|
|
164
198
|
return {
|
|
165
199
|
_: "inputMediaPoll",
|
|
200
|
+
attachedMedia: this.attachedMedia?.inputMedia,
|
|
201
|
+
solutionMedia: this.solutionMedia?.inputMedia,
|
|
166
202
|
poll: {
|
|
167
203
|
_: "poll",
|
|
168
204
|
closed: false,
|
|
@@ -173,13 +209,17 @@ class Poll {
|
|
|
173
209
|
answers: this.raw.answers,
|
|
174
210
|
closePeriod: this.raw.closePeriod,
|
|
175
211
|
closeDate: this.raw.closeDate,
|
|
212
|
+
openAnswers: this.raw.openAnswers,
|
|
213
|
+
revotingDisabled: this.raw.revotingDisabled,
|
|
214
|
+
shuffleAnswers: this.raw.shuffleAnswers,
|
|
215
|
+
hideResultsUntilClose: this.raw.hideResultsUntilClose,
|
|
176
216
|
hash: Long.ZERO
|
|
177
217
|
}
|
|
178
218
|
};
|
|
179
219
|
}
|
|
180
220
|
}
|
|
181
|
-
const Poll$1 = /* @__PURE__ */ memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities"]);
|
|
182
|
-
const Poll$2 = /* @__PURE__ */ makeInspectable(Poll$1,
|
|
221
|
+
const Poll$1 = /* @__PURE__ */ memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities", "solutionMedia"]);
|
|
222
|
+
const Poll$2 = /* @__PURE__ */ makeInspectable(Poll$1, ["attachedMedia"], ["inputMedia"]);
|
|
183
223
|
export {
|
|
184
224
|
Poll$2 as Poll,
|
|
185
225
|
PollAnswer$2 as PollAnswer
|
|
@@ -48,7 +48,12 @@ function _messageMediaFromTl(peers, m) {
|
|
|
48
48
|
if (!peers) {
|
|
49
49
|
throw new errors.MtTypeAssertionError("can't create poll without peers index", "PeersIndex", "null");
|
|
50
50
|
}
|
|
51
|
-
return new poll.Poll(
|
|
51
|
+
return new poll.Poll(
|
|
52
|
+
m.poll,
|
|
53
|
+
peers,
|
|
54
|
+
m.results,
|
|
55
|
+
m.attachedMedia ? _messageMediaFromTl(peers, m.attachedMedia) : void 0
|
|
56
|
+
);
|
|
52
57
|
case "messageMediaInvoice": {
|
|
53
58
|
const extended = m.extendedMedia?._ === "messageExtendedMedia" ? _messageMediaFromTl(peers, m.extendedMedia.media) : null;
|
|
54
59
|
return new invoice.Invoice(m, extended);
|
|
@@ -41,7 +41,12 @@ function _messageMediaFromTl(peers, m) {
|
|
|
41
41
|
if (!peers) {
|
|
42
42
|
throw new MtTypeAssertionError("can't create poll without peers index", "PeersIndex", "null");
|
|
43
43
|
}
|
|
44
|
-
return new Poll$2(
|
|
44
|
+
return new Poll$2(
|
|
45
|
+
m.poll,
|
|
46
|
+
peers,
|
|
47
|
+
m.results,
|
|
48
|
+
m.attachedMedia ? _messageMediaFromTl(peers, m.attachedMedia) : void 0
|
|
49
|
+
);
|
|
45
50
|
case "messageMediaInvoice": {
|
|
46
51
|
const extended = m.extendedMedia?._ === "messageExtendedMedia" ? _messageMediaFromTl(peers, m.extendedMedia.media) : null;
|
|
47
52
|
return new Invoice$2(m, extended);
|
|
@@ -67,6 +67,10 @@ class RepliedMessageInfo {
|
|
|
67
67
|
get todoItemId() {
|
|
68
68
|
return this.raw.todoItemId ?? null;
|
|
69
69
|
}
|
|
70
|
+
/** If this is a reply to a specific poll option, its ID */
|
|
71
|
+
get pollOption() {
|
|
72
|
+
return this.raw.pollOption ?? null;
|
|
73
|
+
}
|
|
70
74
|
/**
|
|
71
75
|
* If replied-to message is available, chat where the message was sent.
|
|
72
76
|
*
|
|
@@ -58,6 +58,8 @@ export declare class RepliedMessageInfo {
|
|
|
58
58
|
get threadId(): number | null;
|
|
59
59
|
/** If this is a reply to a specific todo item, ID of that item */
|
|
60
60
|
get todoItemId(): number | null;
|
|
61
|
+
/** If this is a reply to a specific poll option, its ID */
|
|
62
|
+
get pollOption(): Uint8Array | null;
|
|
61
63
|
/**
|
|
62
64
|
* If replied-to message is available, chat where the message was sent.
|
|
63
65
|
*
|
|
@@ -58,6 +58,8 @@ export declare class RepliedMessageInfo {
|
|
|
58
58
|
get threadId(): number | null;
|
|
59
59
|
/** If this is a reply to a specific todo item, ID of that item */
|
|
60
60
|
get todoItemId(): number | null;
|
|
61
|
+
/** If this is a reply to a specific poll option, its ID */
|
|
62
|
+
get pollOption(): Uint8Array | null;
|
|
61
63
|
/**
|
|
62
64
|
* If replied-to message is available, chat where the message was sent.
|
|
63
65
|
*
|
|
@@ -60,6 +60,10 @@ class RepliedMessageInfo {
|
|
|
60
60
|
get todoItemId() {
|
|
61
61
|
return this.raw.todoItemId ?? null;
|
|
62
62
|
}
|
|
63
|
+
/** If this is a reply to a specific poll option, its ID */
|
|
64
|
+
get pollOption() {
|
|
65
|
+
return this.raw.pollOption ?? null;
|
|
66
|
+
}
|
|
63
67
|
/**
|
|
64
68
|
* If replied-to message is available, chat where the message was sent.
|
|
65
69
|
*
|
|
@@ -28,6 +28,7 @@ const SearchFilters = {
|
|
|
28
28
|
MyMention: { _: "inputMessagesFilterMyMentions" },
|
|
29
29
|
Location: { _: "inputMessagesFilterGeo" },
|
|
30
30
|
Contact: { _: "inputMessagesFilterContacts" },
|
|
31
|
-
Pinned: { _: "inputMessagesFilterPinned" }
|
|
31
|
+
Pinned: { _: "inputMessagesFilterPinned" },
|
|
32
|
+
Polls: { _: "inputMessagesFilterPoll" }
|
|
32
33
|
};
|
|
33
34
|
exports.SearchFilters = SearchFilters;
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* - `Location`: Search for geolocations
|
|
27
27
|
* - `Contact`: Search for contacts
|
|
28
28
|
* - `Pinned`: Search for pinned messages
|
|
29
|
+
* - `Poll`: Search for polls
|
|
29
30
|
*/
|
|
30
31
|
export declare const SearchFilters: {
|
|
31
32
|
readonly Empty: {
|
|
@@ -79,4 +80,7 @@ export declare const SearchFilters: {
|
|
|
79
80
|
readonly Pinned: {
|
|
80
81
|
readonly _: "inputMessagesFilterPinned";
|
|
81
82
|
};
|
|
83
|
+
readonly Polls: {
|
|
84
|
+
readonly _: "inputMessagesFilterPoll";
|
|
85
|
+
};
|
|
82
86
|
};
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* - `Location`: Search for geolocations
|
|
27
27
|
* - `Contact`: Search for contacts
|
|
28
28
|
* - `Pinned`: Search for pinned messages
|
|
29
|
+
* - `Poll`: Search for polls
|
|
29
30
|
*/
|
|
30
31
|
export declare const SearchFilters: {
|
|
31
32
|
readonly Empty: {
|
|
@@ -79,4 +80,7 @@ export declare const SearchFilters: {
|
|
|
79
80
|
readonly Pinned: {
|
|
80
81
|
readonly _: "inputMessagesFilterPinned";
|
|
81
82
|
};
|
|
83
|
+
readonly Polls: {
|
|
84
|
+
readonly _: "inputMessagesFilterPoll";
|
|
85
|
+
};
|
|
82
86
|
};
|
|
@@ -21,7 +21,8 @@ const SearchFilters = {
|
|
|
21
21
|
MyMention: { _: "inputMessagesFilterMyMentions" },
|
|
22
22
|
Location: { _: "inputMessagesFilterGeo" },
|
|
23
23
|
Contact: { _: "inputMessagesFilterContacts" },
|
|
24
|
-
Pinned: { _: "inputMessagesFilterPinned" }
|
|
24
|
+
Pinned: { _: "inputMessagesFilterPinned" },
|
|
25
|
+
Polls: { _: "inputMessagesFilterPoll" }
|
|
25
26
|
};
|
|
26
27
|
export {
|
|
27
28
|
SearchFilters
|
package/methods.cjs
CHANGED
|
@@ -156,6 +156,7 @@ const iterInviteLinks = require("./highlevel/methods/invite-links/iter-invite-li
|
|
|
156
156
|
const revokeInviteLink = require("./highlevel/methods/invite-links/revoke-invite-link.cjs");
|
|
157
157
|
const appendTodoList = require("./highlevel/methods/messages/append-todo-list.cjs");
|
|
158
158
|
const closePoll = require("./highlevel/methods/messages/close-poll.cjs");
|
|
159
|
+
const createStreamingDraft = require("./highlevel/methods/messages/create-streaming-draft.cjs");
|
|
159
160
|
const deleteMessages = require("./highlevel/methods/messages/delete-messages.cjs");
|
|
160
161
|
const deleteScheduledMessages = require("./highlevel/methods/messages/delete-scheduled-messages.cjs");
|
|
161
162
|
const editInlineMessage = require("./highlevel/methods/messages/edit-inline-message.cjs");
|
|
@@ -441,6 +442,7 @@ exports.iterInviteLinks = iterInviteLinks.iterInviteLinks;
|
|
|
441
442
|
exports.revokeInviteLink = revokeInviteLink.revokeInviteLink;
|
|
442
443
|
exports.appendTodoList = appendTodoList.appendTodoList;
|
|
443
444
|
exports.closePoll = closePoll.closePoll;
|
|
445
|
+
exports.createStreamingDraft = createStreamingDraft.createStreamingDraft;
|
|
444
446
|
exports.deleteMessages = deleteMessages.deleteMessages;
|
|
445
447
|
exports.deleteMessagesById = deleteMessages.deleteMessagesById;
|
|
446
448
|
exports.deleteScheduledMessages = deleteScheduledMessages.deleteScheduledMessages;
|
package/methods.js
CHANGED
|
@@ -149,6 +149,7 @@ import { iterInviteLinks } from "./highlevel/methods/invite-links/iter-invite-li
|
|
|
149
149
|
import { revokeInviteLink } from "./highlevel/methods/invite-links/revoke-invite-link.js";
|
|
150
150
|
import { appendTodoList } from "./highlevel/methods/messages/append-todo-list.js";
|
|
151
151
|
import { closePoll } from "./highlevel/methods/messages/close-poll.js";
|
|
152
|
+
import { createStreamingDraft } from "./highlevel/methods/messages/create-streaming-draft.js";
|
|
152
153
|
import { deleteMessages, deleteMessagesById } from "./highlevel/methods/messages/delete-messages.js";
|
|
153
154
|
import { deleteScheduledMessages } from "./highlevel/methods/messages/delete-scheduled-messages.js";
|
|
154
155
|
import { editInlineMessage } from "./highlevel/methods/messages/edit-inline-message.js";
|
|
@@ -318,6 +319,7 @@ export {
|
|
|
318
319
|
createGroup,
|
|
319
320
|
createInviteLink,
|
|
320
321
|
createStickerSet,
|
|
322
|
+
createStreamingDraft,
|
|
321
323
|
createSupergroup,
|
|
322
324
|
deleteBusinessChatLink,
|
|
323
325
|
deleteChannel,
|