@mtcute/core 0.29.4 → 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/base.cjs +0 -1
- package/highlevel/base.js +0 -1
- package/highlevel/client.d.cts +30 -0
- package/highlevel/client.d.ts +30 -0
- package/highlevel/methods/chats/get-creator-after-leave.cjs +4 -14
- package/highlevel/methods/chats/get-creator-after-leave.js +5 -15
- package/highlevel/methods/files/normalize-input-media.cjs +37 -15
- package/highlevel/methods/files/normalize-input-media.js +37 -15
- package/highlevel/methods/messages/close-poll.cjs +2 -1
- package/highlevel/methods/messages/close-poll.js +2 -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/messages/send-vote.cjs +3 -1
- package/highlevel/methods/messages/send-vote.js +4 -2
- package/highlevel/methods.d.cts +2 -0
- package/highlevel/methods.d.ts +2 -0
- package/highlevel/storage/service/peers.cjs +1 -0
- package/highlevel/storage/service/peers.js +1 -0
- package/highlevel/types/media/input-media/types.d.cts +23 -12
- package/highlevel/types/media/input-media/types.d.ts +23 -12
- 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 +48 -5
- package/highlevel/types/media/poll.d.cts +21 -3
- package/highlevel/types/media/poll.d.ts +21 -3
- package/highlevel/types/media/poll.js +48 -5
- package/highlevel/types/messages/dialog.cjs +4 -0
- package/highlevel/types/messages/dialog.d.cts +2 -0
- package/highlevel/types/messages/dialog.d.ts +2 -0
- package/highlevel/types/messages/dialog.js +4 -0
- package/highlevel/types/messages/message-action.cjs +18 -0
- package/highlevel/types/messages/message-action.d.cts +19 -1
- package/highlevel/types/messages/message-action.d.ts +19 -1
- package/highlevel/types/messages/message-action.js +18 -0
- 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/highlevel/types/peers/forum-topic.cjs +4 -0
- package/highlevel/types/peers/forum-topic.d.cts +2 -0
- package/highlevel/types/peers/forum-topic.d.ts +2 -0
- package/highlevel/types/peers/forum-topic.js +4 -0
- package/highlevel/types/peers/full-user.cjs +8 -0
- package/highlevel/types/peers/full-user.d.cts +4 -0
- package/highlevel/types/peers/full-user.d.ts +4 -0
- package/highlevel/types/peers/full-user.js +8 -0
- package/highlevel/types/peers/user.cjs +4 -0
- package/highlevel/types/peers/user.d.cts +2 -0
- package/highlevel/types/peers/user.d.ts +2 -0
- package/highlevel/types/peers/user.js +4 -0
- package/highlevel/types/updates/poll-update.cjs +8 -2
- package/highlevel/types/updates/poll-update.js +8 -2
- package/highlevel/updates/manager.cjs +7 -0
- package/highlevel/updates/manager.js +7 -0
- package/highlevel/worker/worker.cjs +6 -1
- package/highlevel/worker/worker.d.cts +2 -1
- package/highlevel/worker/worker.d.ts +2 -1
- package/highlevel/worker/worker.js +6 -1
- package/methods.cjs +2 -0
- package/methods.js +2 -0
- package/network/middlewares/flood-waiter.cjs +2 -1
- package/network/middlewares/flood-waiter.js +2 -1
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +1 -1
- package/tl/api-schema.json +1 -1
- package/tl/binary/reader.cjs +86 -39
- package/tl/binary/reader.js +86 -39
- package/tl/binary/writer.cjs +308 -32
- package/tl/binary/writer.js +308 -32
- package/tl/compat/reader.cjs +34 -0
- package/tl/compat/reader.js +34 -0
- package/tl/index.d.cts +295 -25
- package/tl/index.d.ts +295 -25
- package/tl/inner-tl.cjs +16 -8
- package/tl/inner-tl.js +16 -8
- package/utils/binary/compat.cjs +41 -0
- package/utils/binary/compat.js +41 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
|
+
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
2
3
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
3
4
|
import { MessageEntity as MessageEntity$2 } from "../messages/message-entity.js";
|
|
5
|
+
import { _messageMediaFromTl } from "../messages/message-media.js";
|
|
4
6
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
5
7
|
class PollAnswer {
|
|
6
8
|
constructor(raw, result) {
|
|
@@ -50,14 +52,19 @@ class PollAnswer {
|
|
|
50
52
|
get correct() {
|
|
51
53
|
return Boolean(this.result?.correct);
|
|
52
54
|
}
|
|
55
|
+
/** Media attached to this answer, if any */
|
|
56
|
+
get media() {
|
|
57
|
+
return this.raw.media ? _messageMediaFromTl(null, this.raw.media) : null;
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
|
-
const PollAnswer$1 = /* @__PURE__ */ memoizeGetters(PollAnswer, ["textEntities"]);
|
|
60
|
+
const PollAnswer$1 = /* @__PURE__ */ memoizeGetters(PollAnswer, ["textEntities", "media"]);
|
|
55
61
|
const PollAnswer$2 = /* @__PURE__ */ makeInspectable(PollAnswer$1);
|
|
56
62
|
class Poll {
|
|
57
|
-
constructor(raw, _peers, results) {
|
|
63
|
+
constructor(raw, _peers, results, attachedMedia) {
|
|
58
64
|
this.raw = raw;
|
|
59
65
|
this._peers = _peers;
|
|
60
66
|
this.results = results;
|
|
67
|
+
this.attachedMedia = attachedMedia;
|
|
61
68
|
}
|
|
62
69
|
type = "poll";
|
|
63
70
|
/**
|
|
@@ -84,6 +91,7 @@ class Poll {
|
|
|
84
91
|
get answers() {
|
|
85
92
|
const results = this.results?.results;
|
|
86
93
|
return this.raw.answers.map((ans, idx) => {
|
|
94
|
+
assertTypeIs("Poll.answers", ans, "pollAnswer");
|
|
87
95
|
if (results) {
|
|
88
96
|
return new PollAnswer(ans, results[idx]);
|
|
89
97
|
}
|
|
@@ -122,6 +130,30 @@ class Poll {
|
|
|
122
130
|
get isMultiple() {
|
|
123
131
|
return this.raw.multipleChoice;
|
|
124
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
|
+
}
|
|
125
157
|
/**
|
|
126
158
|
* Solution for the quiz, only available
|
|
127
159
|
* in case you have already answered
|
|
@@ -143,6 +175,10 @@ class Poll {
|
|
|
143
175
|
}
|
|
144
176
|
return res;
|
|
145
177
|
}
|
|
178
|
+
/** Media attached to the solution, if any */
|
|
179
|
+
get solutionMedia() {
|
|
180
|
+
return this.results?.solutionMedia ? _messageMediaFromTl(null, this.results.solutionMedia) : null;
|
|
181
|
+
}
|
|
146
182
|
/**
|
|
147
183
|
* Input media TL object generated from this object,
|
|
148
184
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -161,6 +197,8 @@ class Poll {
|
|
|
161
197
|
get inputMedia() {
|
|
162
198
|
return {
|
|
163
199
|
_: "inputMediaPoll",
|
|
200
|
+
attachedMedia: this.attachedMedia?.inputMedia,
|
|
201
|
+
solutionMedia: this.solutionMedia?.inputMedia,
|
|
164
202
|
poll: {
|
|
165
203
|
_: "poll",
|
|
166
204
|
closed: false,
|
|
@@ -170,13 +208,18 @@ class Poll {
|
|
|
170
208
|
question: this.raw.question,
|
|
171
209
|
answers: this.raw.answers,
|
|
172
210
|
closePeriod: this.raw.closePeriod,
|
|
173
|
-
closeDate: this.raw.closeDate
|
|
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,
|
|
216
|
+
hash: Long.ZERO
|
|
174
217
|
}
|
|
175
218
|
};
|
|
176
219
|
}
|
|
177
220
|
}
|
|
178
|
-
const Poll$1 = /* @__PURE__ */ memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities"]);
|
|
179
|
-
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"]);
|
|
180
223
|
export {
|
|
181
224
|
Poll$2 as Poll,
|
|
182
225
|
PollAnswer$2 as PollAnswer
|
|
@@ -200,6 +200,10 @@ class Dialog {
|
|
|
200
200
|
get unreadReactionsCount() {
|
|
201
201
|
return this.raw.unreadReactionsCount;
|
|
202
202
|
}
|
|
203
|
+
/** Number of unread poll votes */
|
|
204
|
+
get unreadPollVotesCount() {
|
|
205
|
+
return this.raw.unreadPollVotesCount;
|
|
206
|
+
}
|
|
203
207
|
/**
|
|
204
208
|
* Draft message in this dialog
|
|
205
209
|
*/
|
|
@@ -193,6 +193,10 @@ class Dialog {
|
|
|
193
193
|
get unreadReactionsCount() {
|
|
194
194
|
return this.raw.unreadReactionsCount;
|
|
195
195
|
}
|
|
196
|
+
/** Number of unread poll votes */
|
|
197
|
+
get unreadPollVotesCount() {
|
|
198
|
+
return this.raw.unreadPollVotesCount;
|
|
199
|
+
}
|
|
196
200
|
/**
|
|
197
201
|
* Draft message in this dialog
|
|
198
202
|
*/
|
|
@@ -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 Long = require("long");
|
|
9
9
|
const peerUtils = require("../../../utils/peer-utils.cjs");
|
|
10
|
+
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
10
11
|
const photo = require("../media/photo.cjs");
|
|
11
12
|
const peer = require("../peers/peer.cjs");
|
|
12
13
|
const user = require("../peers/user.cjs");
|
|
@@ -453,6 +454,23 @@ function _messageActionFromTl(act) {
|
|
|
453
454
|
prevValue: act.prevValue,
|
|
454
455
|
newValue: act.newValue
|
|
455
456
|
};
|
|
457
|
+
case "messageActionPollAppendAnswer":
|
|
458
|
+
typeAssertions.assertTypeIsNot("messageActionPollAppendAnswer", act.answer, "inputPollAnswer");
|
|
459
|
+
return {
|
|
460
|
+
type: "poll_append_answer",
|
|
461
|
+
answer: act.answer
|
|
462
|
+
};
|
|
463
|
+
case "messageActionPollDeleteAnswer":
|
|
464
|
+
typeAssertions.assertTypeIsNot("messageActionPollAppendAnswer", act.answer, "inputPollAnswer");
|
|
465
|
+
return {
|
|
466
|
+
type: "poll_delete_answer",
|
|
467
|
+
answer: act.answer
|
|
468
|
+
};
|
|
469
|
+
case "messageActionManagedBotCreated":
|
|
470
|
+
return {
|
|
471
|
+
type: "managed_bot_created",
|
|
472
|
+
botId: act.botId
|
|
473
|
+
};
|
|
456
474
|
default:
|
|
457
475
|
return null;
|
|
458
476
|
}
|
|
@@ -591,6 +591,24 @@ export interface ActionNoForwardsRequest {
|
|
|
591
591
|
/** New value */
|
|
592
592
|
newValue: boolean;
|
|
593
593
|
}
|
|
594
|
+
/** An answer was appended to a poll */
|
|
595
|
+
export interface ActionPollAppendAnswer {
|
|
596
|
+
readonly type: 'poll_append_answer';
|
|
597
|
+
/** The answer that was appended */
|
|
598
|
+
readonly answer: tl.RawPollAnswer;
|
|
599
|
+
}
|
|
600
|
+
/** An answer was deleted from a poll */
|
|
601
|
+
export interface ActionPollDeleteAnswer {
|
|
602
|
+
readonly type: 'poll_delete_answer';
|
|
603
|
+
/** The answer that was deleted */
|
|
604
|
+
readonly answer: tl.RawPollAnswer;
|
|
605
|
+
}
|
|
606
|
+
/** A managed bot was created */
|
|
607
|
+
export interface ActionManagedBotCreated {
|
|
608
|
+
readonly type: 'managed_bot_created';
|
|
609
|
+
/** ID of the created bot */
|
|
610
|
+
readonly botId: number;
|
|
611
|
+
}
|
|
594
612
|
/** Group creator has left the group, and a new creator has been assigned but not yet made one */
|
|
595
613
|
export interface ActionNewCreatorPending {
|
|
596
614
|
readonly type: 'new_creator_pending';
|
|
@@ -603,7 +621,7 @@ export interface ActionChangeCreator {
|
|
|
603
621
|
/** New creator */
|
|
604
622
|
newCreator: User;
|
|
605
623
|
}
|
|
606
|
-
export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | null;
|
|
624
|
+
export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | ActionPollAppendAnswer | ActionPollDeleteAnswer | ActionManagedBotCreated | null;
|
|
607
625
|
/** @internal */
|
|
608
626
|
export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
|
|
609
627
|
export {};
|
|
@@ -591,6 +591,24 @@ export interface ActionNoForwardsRequest {
|
|
|
591
591
|
/** New value */
|
|
592
592
|
newValue: boolean;
|
|
593
593
|
}
|
|
594
|
+
/** An answer was appended to a poll */
|
|
595
|
+
export interface ActionPollAppendAnswer {
|
|
596
|
+
readonly type: 'poll_append_answer';
|
|
597
|
+
/** The answer that was appended */
|
|
598
|
+
readonly answer: tl.RawPollAnswer;
|
|
599
|
+
}
|
|
600
|
+
/** An answer was deleted from a poll */
|
|
601
|
+
export interface ActionPollDeleteAnswer {
|
|
602
|
+
readonly type: 'poll_delete_answer';
|
|
603
|
+
/** The answer that was deleted */
|
|
604
|
+
readonly answer: tl.RawPollAnswer;
|
|
605
|
+
}
|
|
606
|
+
/** A managed bot was created */
|
|
607
|
+
export interface ActionManagedBotCreated {
|
|
608
|
+
readonly type: 'managed_bot_created';
|
|
609
|
+
/** ID of the created bot */
|
|
610
|
+
readonly botId: number;
|
|
611
|
+
}
|
|
594
612
|
/** Group creator has left the group, and a new creator has been assigned but not yet made one */
|
|
595
613
|
export interface ActionNewCreatorPending {
|
|
596
614
|
readonly type: 'new_creator_pending';
|
|
@@ -603,7 +621,7 @@ export interface ActionChangeCreator {
|
|
|
603
621
|
/** New creator */
|
|
604
622
|
newCreator: User;
|
|
605
623
|
}
|
|
606
|
-
export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | null;
|
|
624
|
+
export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | ActionStarGiftCrafted | ActionNewCreatorPending | ActionChangeCreator | ActionNoForwardsToggle | ActionNoForwardsRequest | ActionPollAppendAnswer | ActionPollDeleteAnswer | ActionManagedBotCreated | null;
|
|
607
625
|
/** @internal */
|
|
608
626
|
export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
|
|
609
627
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
2
|
import { getMarkedPeerId } from "../../../utils/peer-utils.js";
|
|
3
|
+
import { assertTypeIsNot } from "../../../utils/type-assertions.js";
|
|
3
4
|
import { Photo as Photo$2 } from "../media/photo.js";
|
|
4
5
|
import { parsePeer } from "../peers/peer.js";
|
|
5
6
|
import { User as User$2 } from "../peers/user.js";
|
|
@@ -446,6 +447,23 @@ function _messageActionFromTl(act) {
|
|
|
446
447
|
prevValue: act.prevValue,
|
|
447
448
|
newValue: act.newValue
|
|
448
449
|
};
|
|
450
|
+
case "messageActionPollAppendAnswer":
|
|
451
|
+
assertTypeIsNot("messageActionPollAppendAnswer", act.answer, "inputPollAnswer");
|
|
452
|
+
return {
|
|
453
|
+
type: "poll_append_answer",
|
|
454
|
+
answer: act.answer
|
|
455
|
+
};
|
|
456
|
+
case "messageActionPollDeleteAnswer":
|
|
457
|
+
assertTypeIsNot("messageActionPollAppendAnswer", act.answer, "inputPollAnswer");
|
|
458
|
+
return {
|
|
459
|
+
type: "poll_delete_answer",
|
|
460
|
+
answer: act.answer
|
|
461
|
+
};
|
|
462
|
+
case "messageActionManagedBotCreated":
|
|
463
|
+
return {
|
|
464
|
+
type: "managed_bot_created",
|
|
465
|
+
botId: act.botId
|
|
466
|
+
};
|
|
449
467
|
default:
|
|
450
468
|
return null;
|
|
451
469
|
}
|
|
@@ -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
|
|
@@ -157,6 +157,10 @@ class ForumTopic {
|
|
|
157
157
|
get unreadReactionsCount() {
|
|
158
158
|
return this.raw.unreadReactionsCount;
|
|
159
159
|
}
|
|
160
|
+
/** Number of unread poll votes in the topic */
|
|
161
|
+
get unreadPollVotesCount() {
|
|
162
|
+
return this.raw.unreadPollVotesCount;
|
|
163
|
+
}
|
|
160
164
|
/**
|
|
161
165
|
* Draft message in the topic
|
|
162
166
|
*/
|
|
@@ -94,6 +94,8 @@ export declare class ForumTopic {
|
|
|
94
94
|
* Number of unread reactions in the topic
|
|
95
95
|
*/
|
|
96
96
|
get unreadReactionsCount(): number;
|
|
97
|
+
/** Number of unread poll votes in the topic */
|
|
98
|
+
get unreadPollVotesCount(): number;
|
|
97
99
|
/**
|
|
98
100
|
* Draft message in the topic
|
|
99
101
|
*/
|
|
@@ -94,6 +94,8 @@ export declare class ForumTopic {
|
|
|
94
94
|
* Number of unread reactions in the topic
|
|
95
95
|
*/
|
|
96
96
|
get unreadReactionsCount(): number;
|
|
97
|
+
/** Number of unread poll votes in the topic */
|
|
98
|
+
get unreadPollVotesCount(): number;
|
|
97
99
|
/**
|
|
98
100
|
* Draft message in the topic
|
|
99
101
|
*/
|
|
@@ -150,6 +150,10 @@ class ForumTopic {
|
|
|
150
150
|
get unreadReactionsCount() {
|
|
151
151
|
return this.raw.unreadReactionsCount;
|
|
152
152
|
}
|
|
153
|
+
/** Number of unread poll votes in the topic */
|
|
154
|
+
get unreadPollVotesCount() {
|
|
155
|
+
return this.raw.unreadPollVotesCount;
|
|
156
|
+
}
|
|
153
157
|
/**
|
|
154
158
|
* Draft message in the topic
|
|
155
159
|
*/
|
|
@@ -213,6 +213,14 @@ class FullUser extends user.User {
|
|
|
213
213
|
get contentProtectionIncoming() {
|
|
214
214
|
return this.full.noforwardsPeerEnabled;
|
|
215
215
|
}
|
|
216
|
+
/** Whether this user has been flagged by the server as a security risk due to using an unofficial app */
|
|
217
|
+
get unofficialSecurityRisk() {
|
|
218
|
+
return this.full.unofficialSecurityRisk;
|
|
219
|
+
}
|
|
220
|
+
/** Bot that manages this bot, if any */
|
|
221
|
+
get botManager() {
|
|
222
|
+
return this.full.botManagerId ? new user.User(this.peers.user(this.full.botManagerId)) : null;
|
|
223
|
+
}
|
|
216
224
|
/** Whether the "Gifts" tab should be shown */
|
|
217
225
|
get showGifts() {
|
|
218
226
|
return this.full.displayGiftsButton;
|
|
@@ -123,6 +123,10 @@ export declare class FullUser extends User {
|
|
|
123
123
|
* i.e. our incoming messages from this user will be `noforwards`.
|
|
124
124
|
*/
|
|
125
125
|
get contentProtectionIncoming(): boolean;
|
|
126
|
+
/** Whether this user has been flagged by the server as a security risk due to using an unofficial app */
|
|
127
|
+
get unofficialSecurityRisk(): boolean;
|
|
128
|
+
/** Bot that manages this bot, if any */
|
|
129
|
+
get botManager(): User | null;
|
|
126
130
|
/** Whether the "Gifts" tab should be shown */
|
|
127
131
|
get showGifts(): boolean;
|
|
128
132
|
/** Information about the user's gift receive settings */
|
|
@@ -123,6 +123,10 @@ export declare class FullUser extends User {
|
|
|
123
123
|
* i.e. our incoming messages from this user will be `noforwards`.
|
|
124
124
|
*/
|
|
125
125
|
get contentProtectionIncoming(): boolean;
|
|
126
|
+
/** Whether this user has been flagged by the server as a security risk due to using an unofficial app */
|
|
127
|
+
get unofficialSecurityRisk(): boolean;
|
|
128
|
+
/** Bot that manages this bot, if any */
|
|
129
|
+
get botManager(): User | null;
|
|
126
130
|
/** Whether the "Gifts" tab should be shown */
|
|
127
131
|
get showGifts(): boolean;
|
|
128
132
|
/** Information about the user's gift receive settings */
|
|
@@ -206,6 +206,14 @@ class FullUser extends User$2 {
|
|
|
206
206
|
get contentProtectionIncoming() {
|
|
207
207
|
return this.full.noforwardsPeerEnabled;
|
|
208
208
|
}
|
|
209
|
+
/** Whether this user has been flagged by the server as a security risk due to using an unofficial app */
|
|
210
|
+
get unofficialSecurityRisk() {
|
|
211
|
+
return this.full.unofficialSecurityRisk;
|
|
212
|
+
}
|
|
213
|
+
/** Bot that manages this bot, if any */
|
|
214
|
+
get botManager() {
|
|
215
|
+
return this.full.botManagerId ? new User$2(this.peers.user(this.full.botManagerId)) : null;
|
|
216
|
+
}
|
|
209
217
|
/** Whether the "Gifts" tab should be shown */
|
|
210
218
|
get showGifts() {
|
|
211
219
|
return this.full.displayGiftsButton;
|
|
@@ -114,6 +114,10 @@ class User {
|
|
|
114
114
|
get canBotManageForumTopics() {
|
|
115
115
|
return this.raw.botForumCanManageTopics;
|
|
116
116
|
}
|
|
117
|
+
/** Whether this bot can manage other bots */
|
|
118
|
+
get canBotManageBots() {
|
|
119
|
+
return this.raw.botCanManageBots;
|
|
120
|
+
}
|
|
117
121
|
/** Whether this user has been verified by Telegram */
|
|
118
122
|
get isVerified() {
|
|
119
123
|
return this.raw.verified;
|
|
@@ -85,6 +85,8 @@ export declare class User {
|
|
|
85
85
|
/** Whether this bot is forum-like (i.e. supports threads) */
|
|
86
86
|
get isBotWithForumView(): boolean;
|
|
87
87
|
get canBotManageForumTopics(): boolean;
|
|
88
|
+
/** Whether this bot can manage other bots */
|
|
89
|
+
get canBotManageBots(): boolean;
|
|
88
90
|
/** Whether this user has been verified by Telegram */
|
|
89
91
|
get isVerified(): boolean;
|
|
90
92
|
/**
|
|
@@ -85,6 +85,8 @@ export declare class User {
|
|
|
85
85
|
/** Whether this bot is forum-like (i.e. supports threads) */
|
|
86
86
|
get isBotWithForumView(): boolean;
|
|
87
87
|
get canBotManageForumTopics(): boolean;
|
|
88
|
+
/** Whether this bot can manage other bots */
|
|
89
|
+
get canBotManageBots(): boolean;
|
|
88
90
|
/** Whether this user has been verified by Telegram */
|
|
89
91
|
get isVerified(): boolean;
|
|
90
92
|
/**
|
|
@@ -107,6 +107,10 @@ class User {
|
|
|
107
107
|
get canBotManageForumTopics() {
|
|
108
108
|
return this.raw.botForumCanManageTopics;
|
|
109
109
|
}
|
|
110
|
+
/** Whether this bot can manage other bots */
|
|
111
|
+
get canBotManageBots() {
|
|
112
|
+
return this.raw.botCanManageBots;
|
|
113
|
+
}
|
|
110
114
|
/** Whether this user has been verified by Telegram */
|
|
111
115
|
get isVerified() {
|
|
112
116
|
return this.raw.verified;
|
|
@@ -5,6 +5,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const Long = require("long");
|
|
8
9
|
const memoize = require("../../utils/memoize.cjs");
|
|
9
10
|
const poll = require("../media/poll.cjs");
|
|
10
11
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
@@ -49,9 +50,14 @@ class PollUpdate {
|
|
|
49
50
|
question: { _: "textWithEntities", text: "", entities: [] },
|
|
50
51
|
answers: this.raw.results.results?.map((res) => ({
|
|
51
52
|
_: "pollAnswer",
|
|
52
|
-
text: {
|
|
53
|
+
text: {
|
|
54
|
+
_: "textWithEntities",
|
|
55
|
+
text: "",
|
|
56
|
+
entities: []
|
|
57
|
+
},
|
|
53
58
|
option: res.option
|
|
54
|
-
})) ?? []
|
|
59
|
+
})) ?? [],
|
|
60
|
+
hash: Long.ZERO
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
63
|
return new poll.Poll(poll$1, this._peers, this.raw.results);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Long from "long";
|
|
1
2
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
2
3
|
import { Poll as Poll$2 } from "../media/poll.js";
|
|
3
4
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
@@ -42,9 +43,14 @@ class PollUpdate {
|
|
|
42
43
|
question: { _: "textWithEntities", text: "", entities: [] },
|
|
43
44
|
answers: this.raw.results.results?.map((res) => ({
|
|
44
45
|
_: "pollAnswer",
|
|
45
|
-
text: {
|
|
46
|
+
text: {
|
|
47
|
+
_: "textWithEntities",
|
|
48
|
+
text: "",
|
|
49
|
+
entities: []
|
|
50
|
+
},
|
|
46
51
|
option: res.option
|
|
47
|
-
})) ?? []
|
|
52
|
+
})) ?? [],
|
|
53
|
+
hash: Long.ZERO
|
|
48
54
|
};
|
|
49
55
|
}
|
|
50
56
|
return new Poll$2(poll, this._peers, this.raw.results);
|