@mtcute/core 0.29.5 → 0.29.7
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 +12 -0
- package/client.js +12 -0
- package/highlevel/client.d.cts +49 -1
- package/highlevel/client.d.ts +49 -1
- package/highlevel/methods/bots/answer-bot-guest-chat-query.cjs +26 -0
- package/highlevel/methods/bots/answer-bot-guest-chat-query.d.cts +12 -0
- package/highlevel/methods/bots/answer-bot-guest-chat-query.d.ts +12 -0
- package/highlevel/methods/bots/answer-bot-guest-chat-query.js +21 -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-copy-group.cjs +5 -9
- package/highlevel/methods/messages/send-copy-group.js +5 -9
- 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 +3 -0
- package/highlevel/methods.d.ts +3 -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 +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 +58 -4
- package/highlevel/types/media/poll.d.cts +25 -1
- package/highlevel/types/media/poll.d.ts +25 -1
- package/highlevel/types/media/poll.js +58 -4
- package/highlevel/types/messages/message-media.cjs +6 -1
- package/highlevel/types/messages/message-media.js +6 -1
- package/highlevel/types/messages/message.cjs +10 -1
- package/highlevel/types/messages/message.d.cts +5 -0
- package/highlevel/types/messages/message.d.ts +5 -0
- package/highlevel/types/messages/message.js +10 -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/chat-permissions.cjs +6 -0
- package/highlevel/types/peers/chat-permissions.d.cts +4 -0
- package/highlevel/types/peers/chat-permissions.d.ts +4 -0
- package/highlevel/types/peers/chat-permissions.js +6 -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/bot-guest-chat-query.cjs +39 -0
- package/highlevel/types/updates/bot-guest-chat-query.d.cts +21 -0
- package/highlevel/types/updates/bot-guest-chat-query.d.ts +21 -0
- package/highlevel/types/updates/bot-guest-chat-query.js +34 -0
- package/highlevel/types/updates/index.d.cts +5 -1
- package/highlevel/types/updates/index.d.ts +5 -1
- package/highlevel/types/updates/parse-update.cjs +3 -0
- package/highlevel/types/updates/parse-update.js +3 -0
- package/highlevel/updates/manager.cjs +23 -3
- package/highlevel/updates/manager.d.cts +1 -0
- package/highlevel/updates/manager.d.ts +1 -0
- package/highlevel/updates/manager.js +23 -3
- package/index.cjs +2 -0
- package/index.js +2 -0
- package/methods.cjs +4 -0
- package/methods.js +4 -0
- 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 +85 -40
- package/tl/binary/reader.js +85 -40
- package/tl/binary/writer.cjs +349 -143
- package/tl/binary/writer.js +349 -143
- package/tl/compat/reader.cjs +8 -0
- package/tl/compat/reader.js +8 -0
- package/tl/index.d.cts +2071 -179
- package/tl/index.d.ts +2071 -179
- package/tl/inner-tl.cjs +17 -5
- package/tl/inner-tl.js +17 -5
- package/utils/binary/compat.cjs +5 -0
- package/utils/binary/compat.js +5 -0
|
@@ -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,24 @@ 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;
|
|
100
|
+
/** Whether voting in this poll is restricted to channel subscribers */
|
|
101
|
+
get isSubscribersOnly(): boolean;
|
|
102
|
+
/** ISO2 country codes the poll is restricted to */
|
|
103
|
+
get countries(): ReadonlyArray<string> | null;
|
|
104
|
+
/** Whether the current user can view extended statistics for this poll */
|
|
105
|
+
get canViewStats(): boolean;
|
|
84
106
|
/**
|
|
85
107
|
* Solution for the quiz, only available
|
|
86
108
|
* in case you have already answered
|
|
@@ -91,6 +113,8 @@ export declare class Poll {
|
|
|
91
113
|
* in case you have already answered
|
|
92
114
|
*/
|
|
93
115
|
get solutionEntities(): ReadonlyArray<MessageEntity> | null;
|
|
116
|
+
/** Media attached to the solution, if any */
|
|
117
|
+
get solutionMedia(): MessageMedia | null;
|
|
94
118
|
/**
|
|
95
119
|
* Input media TL object generated from this object,
|
|
96
120
|
* 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,42 @@ 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
|
+
}
|
|
157
|
+
/** Whether voting in this poll is restricted to channel subscribers */
|
|
158
|
+
get isSubscribersOnly() {
|
|
159
|
+
return this.raw.subscribersOnly;
|
|
160
|
+
}
|
|
161
|
+
/** ISO2 country codes the poll is restricted to */
|
|
162
|
+
get countries() {
|
|
163
|
+
return this.raw.countriesIso2 ?? null;
|
|
164
|
+
}
|
|
165
|
+
/** Whether the current user can view extended statistics for this poll */
|
|
166
|
+
get canViewStats() {
|
|
167
|
+
return this.results?.canViewStats ?? false;
|
|
168
|
+
}
|
|
127
169
|
/**
|
|
128
170
|
* Solution for the quiz, only available
|
|
129
171
|
* in case you have already answered
|
|
@@ -145,6 +187,10 @@ class Poll {
|
|
|
145
187
|
}
|
|
146
188
|
return res;
|
|
147
189
|
}
|
|
190
|
+
/** Media attached to the solution, if any */
|
|
191
|
+
get solutionMedia() {
|
|
192
|
+
return this.results?.solutionMedia ? _messageMediaFromTl(null, this.results.solutionMedia) : null;
|
|
193
|
+
}
|
|
148
194
|
/**
|
|
149
195
|
* Input media TL object generated from this object,
|
|
150
196
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -163,6 +209,8 @@ class Poll {
|
|
|
163
209
|
get inputMedia() {
|
|
164
210
|
return {
|
|
165
211
|
_: "inputMediaPoll",
|
|
212
|
+
attachedMedia: this.attachedMedia?.inputMedia,
|
|
213
|
+
solutionMedia: this.solutionMedia?.inputMedia,
|
|
166
214
|
poll: {
|
|
167
215
|
_: "poll",
|
|
168
216
|
closed: false,
|
|
@@ -173,13 +221,19 @@ class Poll {
|
|
|
173
221
|
answers: this.raw.answers,
|
|
174
222
|
closePeriod: this.raw.closePeriod,
|
|
175
223
|
closeDate: this.raw.closeDate,
|
|
224
|
+
openAnswers: this.raw.openAnswers,
|
|
225
|
+
revotingDisabled: this.raw.revotingDisabled,
|
|
226
|
+
shuffleAnswers: this.raw.shuffleAnswers,
|
|
227
|
+
hideResultsUntilClose: this.raw.hideResultsUntilClose,
|
|
228
|
+
subscribersOnly: this.raw.subscribersOnly,
|
|
229
|
+
countriesIso2: this.raw.countriesIso2,
|
|
176
230
|
hash: Long.ZERO
|
|
177
231
|
}
|
|
178
232
|
};
|
|
179
233
|
}
|
|
180
234
|
}
|
|
181
|
-
const Poll$1 = /* @__PURE__ */ memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities"]);
|
|
182
|
-
const Poll$2 = /* @__PURE__ */ makeInspectable(Poll$1,
|
|
235
|
+
const Poll$1 = /* @__PURE__ */ memoizeGetters(Poll, ["answers", "solutionEntities", "questionEntities", "solutionMedia"]);
|
|
236
|
+
const Poll$2 = /* @__PURE__ */ makeInspectable(Poll$1, ["attachedMedia"], ["inputMedia"]);
|
|
183
237
|
export {
|
|
184
238
|
Poll$2 as Poll,
|
|
185
239
|
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);
|
|
@@ -282,6 +282,14 @@ class Message {
|
|
|
282
282
|
}
|
|
283
283
|
return new user.User(this._peers.user(this.raw.viaBusinessBotId));
|
|
284
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* For messages sent via a bot guest chat,
|
|
287
|
+
* the peer who initiated it
|
|
288
|
+
*/
|
|
289
|
+
get guestChatViaFrom() {
|
|
290
|
+
if (this.raw._ !== "message" || !this.raw.guestchatViaFrom) return null;
|
|
291
|
+
return peer.parsePeer(this.raw.guestchatViaFrom, this._peers);
|
|
292
|
+
}
|
|
285
293
|
/**
|
|
286
294
|
* Message text or media caption.
|
|
287
295
|
*
|
|
@@ -478,7 +486,8 @@ const Message$1 = /* @__PURE__ */ memoize.memoizeGetters(Message, [
|
|
|
478
486
|
"markup",
|
|
479
487
|
"reactions",
|
|
480
488
|
"factCheck",
|
|
481
|
-
"suggestedPost"
|
|
489
|
+
"suggestedPost",
|
|
490
|
+
"guestChatViaFrom"
|
|
482
491
|
]);
|
|
483
492
|
const Message$2 = /* @__PURE__ */ inspectable.makeInspectable(Message$1, ["isScheduled"], ["link"]);
|
|
484
493
|
exports.Message = Message$2;
|
|
@@ -185,6 +185,11 @@ export declare class Message {
|
|
|
185
185
|
* **Note**: only available to the business account and the bot itself.
|
|
186
186
|
*/
|
|
187
187
|
get viaBusinessBot(): User | null;
|
|
188
|
+
/**
|
|
189
|
+
* For messages sent via a bot guest chat,
|
|
190
|
+
* the peer who initiated it
|
|
191
|
+
*/
|
|
192
|
+
get guestChatViaFrom(): Peer | null;
|
|
188
193
|
/**
|
|
189
194
|
* Message text or media caption.
|
|
190
195
|
*
|
|
@@ -185,6 +185,11 @@ export declare class Message {
|
|
|
185
185
|
* **Note**: only available to the business account and the bot itself.
|
|
186
186
|
*/
|
|
187
187
|
get viaBusinessBot(): User | null;
|
|
188
|
+
/**
|
|
189
|
+
* For messages sent via a bot guest chat,
|
|
190
|
+
* the peer who initiated it
|
|
191
|
+
*/
|
|
192
|
+
get guestChatViaFrom(): Peer | null;
|
|
188
193
|
/**
|
|
189
194
|
* Message text or media caption.
|
|
190
195
|
*
|
|
@@ -275,6 +275,14 @@ class Message {
|
|
|
275
275
|
}
|
|
276
276
|
return new User$2(this._peers.user(this.raw.viaBusinessBotId));
|
|
277
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* For messages sent via a bot guest chat,
|
|
280
|
+
* the peer who initiated it
|
|
281
|
+
*/
|
|
282
|
+
get guestChatViaFrom() {
|
|
283
|
+
if (this.raw._ !== "message" || !this.raw.guestchatViaFrom) return null;
|
|
284
|
+
return parsePeer(this.raw.guestchatViaFrom, this._peers);
|
|
285
|
+
}
|
|
278
286
|
/**
|
|
279
287
|
* Message text or media caption.
|
|
280
288
|
*
|
|
@@ -471,7 +479,8 @@ const Message$1 = /* @__PURE__ */ memoizeGetters(Message, [
|
|
|
471
479
|
"markup",
|
|
472
480
|
"reactions",
|
|
473
481
|
"factCheck",
|
|
474
|
-
"suggestedPost"
|
|
482
|
+
"suggestedPost",
|
|
483
|
+
"guestChatViaFrom"
|
|
475
484
|
]);
|
|
476
485
|
const Message$2 = /* @__PURE__ */ makeInspectable(Message$1, ["isScheduled"], ["link"]);
|
|
477
486
|
export {
|
|
@@ -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
|
|
@@ -137,6 +137,12 @@ class ChatPermissions {
|
|
|
137
137
|
get canSendPolls() {
|
|
138
138
|
return !this.raw.sendPolls;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Whether users can react to messages.
|
|
142
|
+
*/
|
|
143
|
+
get canSendReactions() {
|
|
144
|
+
return !this.raw.sendReactions;
|
|
145
|
+
}
|
|
140
146
|
/**
|
|
141
147
|
* Whether users can change the chat title,
|
|
142
148
|
* photo and other settings.
|
|
@@ -99,6 +99,10 @@ export declare class ChatPermissions {
|
|
|
99
99
|
* Implies {@link canSendMessages}
|
|
100
100
|
*/
|
|
101
101
|
get canSendPolls(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether users can react to messages.
|
|
104
|
+
*/
|
|
105
|
+
get canSendReactions(): boolean;
|
|
102
106
|
/**
|
|
103
107
|
* Whether users can change the chat title,
|
|
104
108
|
* photo and other settings.
|
|
@@ -99,6 +99,10 @@ export declare class ChatPermissions {
|
|
|
99
99
|
* Implies {@link canSendMessages}
|
|
100
100
|
*/
|
|
101
101
|
get canSendPolls(): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether users can react to messages.
|
|
104
|
+
*/
|
|
105
|
+
get canSendReactions(): boolean;
|
|
102
106
|
/**
|
|
103
107
|
* Whether users can change the chat title,
|
|
104
108
|
* photo and other settings.
|
|
@@ -130,6 +130,12 @@ class ChatPermissions {
|
|
|
130
130
|
get canSendPolls() {
|
|
131
131
|
return !this.raw.sendPolls;
|
|
132
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Whether users can react to messages.
|
|
135
|
+
*/
|
|
136
|
+
get canSendReactions() {
|
|
137
|
+
return !this.raw.sendReactions;
|
|
138
|
+
}
|
|
133
139
|
/**
|
|
134
140
|
* Whether users can change the chat title,
|
|
135
141
|
* photo and other settings.
|
|
@@ -118,6 +118,10 @@ class User {
|
|
|
118
118
|
get canBotManageBots() {
|
|
119
119
|
return this.raw.botCanManageBots;
|
|
120
120
|
}
|
|
121
|
+
/** Whether this bot supports bot guest chats */
|
|
122
|
+
get isBotWithGuestChat() {
|
|
123
|
+
return this.raw.botGuestchat;
|
|
124
|
+
}
|
|
121
125
|
/** Whether this user has been verified by Telegram */
|
|
122
126
|
get isVerified() {
|
|
123
127
|
return this.raw.verified;
|
|
@@ -87,6 +87,8 @@ export declare class User {
|
|
|
87
87
|
get canBotManageForumTopics(): boolean;
|
|
88
88
|
/** Whether this bot can manage other bots */
|
|
89
89
|
get canBotManageBots(): boolean;
|
|
90
|
+
/** Whether this bot supports bot guest chats */
|
|
91
|
+
get isBotWithGuestChat(): boolean;
|
|
90
92
|
/** Whether this user has been verified by Telegram */
|
|
91
93
|
get isVerified(): boolean;
|
|
92
94
|
/**
|
|
@@ -87,6 +87,8 @@ export declare class User {
|
|
|
87
87
|
get canBotManageForumTopics(): boolean;
|
|
88
88
|
/** Whether this bot can manage other bots */
|
|
89
89
|
get canBotManageBots(): boolean;
|
|
90
|
+
/** Whether this bot supports bot guest chats */
|
|
91
|
+
get isBotWithGuestChat(): boolean;
|
|
90
92
|
/** Whether this user has been verified by Telegram */
|
|
91
93
|
get isVerified(): boolean;
|
|
92
94
|
/**
|
|
@@ -111,6 +111,10 @@ class User {
|
|
|
111
111
|
get canBotManageBots() {
|
|
112
112
|
return this.raw.botCanManageBots;
|
|
113
113
|
}
|
|
114
|
+
/** Whether this bot supports bot guest chats */
|
|
115
|
+
get isBotWithGuestChat() {
|
|
116
|
+
return this.raw.botGuestchat;
|
|
117
|
+
}
|
|
114
118
|
/** Whether this user has been verified by Telegram */
|
|
115
119
|
get isVerified() {
|
|
116
120
|
return this.raw.verified;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const memoize = require("../../utils/memoize.cjs");
|
|
9
|
+
const message = require("../messages/message.cjs");
|
|
10
|
+
const inspectable = require("../../utils/inspectable.cjs");
|
|
11
|
+
class BotGuestChatQuery {
|
|
12
|
+
constructor(raw, _peers) {
|
|
13
|
+
this.raw = raw;
|
|
14
|
+
this._peers = _peers;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Unique query ID
|
|
18
|
+
*/
|
|
19
|
+
get id() {
|
|
20
|
+
return this.raw.queryId;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Message containing the query that was sent to the bot
|
|
24
|
+
*/
|
|
25
|
+
get message() {
|
|
26
|
+
return new message.Message(this.raw.message, this._peers);
|
|
27
|
+
}
|
|
28
|
+
/** Message that {@link message} is a reply to, if available */
|
|
29
|
+
get replyToMessage() {
|
|
30
|
+
if (!this.message.replyToMessage || !this.raw.referenceMessages) return null;
|
|
31
|
+
if (!this.message.replyToMessage.originIs("same_chat")) return null;
|
|
32
|
+
const replyToId = this.message.replyToMessage.id;
|
|
33
|
+
const raw = this.raw.referenceMessages.find((it) => it.id === replyToId);
|
|
34
|
+
return raw ? new message.Message(raw, this._peers) : null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const BotGuestChatQuery$1 = /* @__PURE__ */ memoize.memoizeGetters(BotGuestChatQuery, ["message", "replyToMessage"]);
|
|
38
|
+
const BotGuestChatQuery$2 = /* @__PURE__ */ inspectable.makeInspectable(BotGuestChatQuery$1);
|
|
39
|
+
exports.BotGuestChatQuery = BotGuestChatQuery$2;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { PeersIndex } from '../peers/index.js';
|
|
3
|
+
import { Message } from '../messages/message.js';
|
|
4
|
+
/**
|
|
5
|
+
* Query received in a bot guest chat
|
|
6
|
+
*/
|
|
7
|
+
export declare class BotGuestChatQuery {
|
|
8
|
+
readonly raw: tl.RawUpdateBotGuestChatQuery;
|
|
9
|
+
readonly _peers: PeersIndex;
|
|
10
|
+
constructor(raw: tl.RawUpdateBotGuestChatQuery, _peers: PeersIndex);
|
|
11
|
+
/**
|
|
12
|
+
* Unique query ID
|
|
13
|
+
*/
|
|
14
|
+
get id(): tl.Long;
|
|
15
|
+
/**
|
|
16
|
+
* Message containing the query that was sent to the bot
|
|
17
|
+
*/
|
|
18
|
+
get message(): Message;
|
|
19
|
+
/** Message that {@link message} is a reply to, if available */
|
|
20
|
+
get replyToMessage(): Message | null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { tl } from '../../../tl/index.js';
|
|
2
|
+
import { PeersIndex } from '../peers/index.js';
|
|
3
|
+
import { Message } from '../messages/message.js';
|
|
4
|
+
/**
|
|
5
|
+
* Query received in a bot guest chat
|
|
6
|
+
*/
|
|
7
|
+
export declare class BotGuestChatQuery {
|
|
8
|
+
readonly raw: tl.RawUpdateBotGuestChatQuery;
|
|
9
|
+
readonly _peers: PeersIndex;
|
|
10
|
+
constructor(raw: tl.RawUpdateBotGuestChatQuery, _peers: PeersIndex);
|
|
11
|
+
/**
|
|
12
|
+
* Unique query ID
|
|
13
|
+
*/
|
|
14
|
+
get id(): tl.Long;
|
|
15
|
+
/**
|
|
16
|
+
* Message containing the query that was sent to the bot
|
|
17
|
+
*/
|
|
18
|
+
get message(): Message;
|
|
19
|
+
/** Message that {@link message} is a reply to, if available */
|
|
20
|
+
get replyToMessage(): Message | null;
|
|
21
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { memoizeGetters } from "../../utils/memoize.js";
|
|
2
|
+
import { Message as Message$2 } from "../messages/message.js";
|
|
3
|
+
import { makeInspectable } from "../../utils/inspectable.js";
|
|
4
|
+
class BotGuestChatQuery {
|
|
5
|
+
constructor(raw, _peers) {
|
|
6
|
+
this.raw = raw;
|
|
7
|
+
this._peers = _peers;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Unique query ID
|
|
11
|
+
*/
|
|
12
|
+
get id() {
|
|
13
|
+
return this.raw.queryId;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Message containing the query that was sent to the bot
|
|
17
|
+
*/
|
|
18
|
+
get message() {
|
|
19
|
+
return new Message$2(this.raw.message, this._peers);
|
|
20
|
+
}
|
|
21
|
+
/** Message that {@link message} is a reply to, if available */
|
|
22
|
+
get replyToMessage() {
|
|
23
|
+
if (!this.message.replyToMessage || !this.raw.referenceMessages) return null;
|
|
24
|
+
if (!this.message.replyToMessage.originIs("same_chat")) return null;
|
|
25
|
+
const replyToId = this.message.replyToMessage.id;
|
|
26
|
+
const raw = this.raw.referenceMessages.find((it) => it.id === replyToId);
|
|
27
|
+
return raw ? new Message$2(raw, this._peers) : null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const BotGuestChatQuery$1 = /* @__PURE__ */ memoizeGetters(BotGuestChatQuery, ["message", "replyToMessage"]);
|
|
31
|
+
const BotGuestChatQuery$2 = /* @__PURE__ */ makeInspectable(BotGuestChatQuery$1);
|
|
32
|
+
export {
|
|
33
|
+
BotGuestChatQuery$2 as BotGuestChatQuery
|
|
34
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BusinessConnection, Message } from '../../types/index.js';
|
|
2
2
|
import { BotChatJoinRequestUpdate } from './bot-chat-join-request.js';
|
|
3
|
+
import { BotGuestChatQuery } from './bot-guest-chat-query.js';
|
|
3
4
|
import { BotReactionCountUpdate, BotReactionUpdate } from './bot-reaction.js';
|
|
4
5
|
import { BotStoppedUpdate } from './bot-stopped.js';
|
|
5
6
|
import { BusinessMessage } from './business-message.js';
|
|
@@ -19,7 +20,7 @@ import { StoryUpdate } from './story-update.js';
|
|
|
19
20
|
import { UserStatusUpdate } from './user-status-update.js';
|
|
20
21
|
import { UserTypingUpdate } from './user-typing-update.js';
|
|
21
22
|
export type { ChatMemberUpdateType } from './chat-member-update.js';
|
|
22
|
-
export { BotChatJoinRequestUpdate, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessMessage, CallbackQuery, ChatJoinRequestUpdate, ChatMemberUpdate, ChosenInlineResult, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, PollUpdate, PollVoteUpdate, PreCheckoutQuery, StoryUpdate, UserStatusUpdate, UserTypingUpdate, };
|
|
23
|
+
export { BotChatJoinRequestUpdate, BotGuestChatQuery, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessMessage, CallbackQuery, ChatJoinRequestUpdate, ChatMemberUpdate, ChosenInlineResult, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, PollUpdate, PollVoteUpdate, PreCheckoutQuery, StoryUpdate, UserStatusUpdate, UserTypingUpdate, };
|
|
23
24
|
export type ParsedUpdate = {
|
|
24
25
|
name: 'new_message';
|
|
25
26
|
data: Message;
|
|
@@ -38,6 +39,9 @@ export type ParsedUpdate = {
|
|
|
38
39
|
} | {
|
|
39
40
|
name: 'inline_query';
|
|
40
41
|
data: InlineQuery;
|
|
42
|
+
} | {
|
|
43
|
+
name: 'bot_guest_chat_query';
|
|
44
|
+
data: BotGuestChatQuery;
|
|
41
45
|
} | {
|
|
42
46
|
name: 'chosen_inline_result';
|
|
43
47
|
data: ChosenInlineResult;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BusinessConnection, Message } from '../../types/index.js';
|
|
2
2
|
import { BotChatJoinRequestUpdate } from './bot-chat-join-request.js';
|
|
3
|
+
import { BotGuestChatQuery } from './bot-guest-chat-query.js';
|
|
3
4
|
import { BotReactionCountUpdate, BotReactionUpdate } from './bot-reaction.js';
|
|
4
5
|
import { BotStoppedUpdate } from './bot-stopped.js';
|
|
5
6
|
import { BusinessMessage } from './business-message.js';
|
|
@@ -19,7 +20,7 @@ import { StoryUpdate } from './story-update.js';
|
|
|
19
20
|
import { UserStatusUpdate } from './user-status-update.js';
|
|
20
21
|
import { UserTypingUpdate } from './user-typing-update.js';
|
|
21
22
|
export type { ChatMemberUpdateType } from './chat-member-update.js';
|
|
22
|
-
export { BotChatJoinRequestUpdate, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessMessage, CallbackQuery, ChatJoinRequestUpdate, ChatMemberUpdate, ChosenInlineResult, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, PollUpdate, PollVoteUpdate, PreCheckoutQuery, StoryUpdate, UserStatusUpdate, UserTypingUpdate, };
|
|
23
|
+
export { BotChatJoinRequestUpdate, BotGuestChatQuery, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessMessage, CallbackQuery, ChatJoinRequestUpdate, ChatMemberUpdate, ChosenInlineResult, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, PollUpdate, PollVoteUpdate, PreCheckoutQuery, StoryUpdate, UserStatusUpdate, UserTypingUpdate, };
|
|
23
24
|
export type ParsedUpdate = {
|
|
24
25
|
name: 'new_message';
|
|
25
26
|
data: Message;
|
|
@@ -38,6 +39,9 @@ export type ParsedUpdate = {
|
|
|
38
39
|
} | {
|
|
39
40
|
name: 'inline_query';
|
|
40
41
|
data: InlineQuery;
|
|
42
|
+
} | {
|
|
43
|
+
name: 'bot_guest_chat_query';
|
|
44
|
+
data: BotGuestChatQuery;
|
|
41
45
|
} | {
|
|
42
46
|
name: 'chosen_inline_result';
|
|
43
47
|
data: ChosenInlineResult;
|