@mtcute/core 0.21.1 → 0.22.2
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 +13 -8
- package/client.js +13 -8
- package/highlevel/client.d.cts +27 -49
- package/highlevel/client.d.ts +27 -49
- package/highlevel/methods/auth/sign-in-qr.cjs +4 -4
- package/highlevel/methods/files/download-iterable.cjs +25 -0
- package/highlevel/methods/files/download-iterable.js +25 -0
- package/highlevel/methods/files/upload-file.js +1 -1
- package/highlevel/methods/messages/forward-messages.cjs +2 -1
- package/highlevel/methods/messages/forward-messages.d.cts +6 -0
- package/highlevel/methods/messages/forward-messages.d.ts +6 -0
- package/highlevel/methods/messages/forward-messages.js +2 -1
- package/highlevel/methods/messages/get-web-page-preview.cjs +22 -0
- package/highlevel/methods/messages/get-web-page-preview.d.cts +9 -0
- package/highlevel/methods/messages/get-web-page-preview.d.ts +9 -0
- package/highlevel/methods/messages/get-web-page-preview.js +17 -0
- package/highlevel/methods/messages/send-common.d.cts +5 -0
- package/highlevel/methods/messages/send-common.d.ts +5 -0
- package/highlevel/methods/messages/send-media-group.cjs +2 -1
- package/highlevel/methods/messages/send-media-group.js +2 -1
- package/highlevel/methods/messages/send-media.cjs +2 -1
- package/highlevel/methods/messages/send-media.js +2 -1
- package/highlevel/methods/messages/send-text.cjs +2 -1
- package/highlevel/methods/messages/send-text.js +2 -1
- package/highlevel/methods/premium/pin-star-gift.cjs +24 -0
- package/highlevel/methods/premium/pin-star-gift.d.cts +13 -0
- package/highlevel/methods/premium/pin-star-gift.d.ts +13 -0
- package/highlevel/methods/premium/pin-star-gift.js +19 -0
- package/highlevel/methods/{premium/get-star-gifts.cjs → users/get-peer-settings.cjs} +10 -6
- package/highlevel/methods/users/get-peer-settings.d.cts +4 -0
- package/highlevel/methods/users/get-peer-settings.d.ts +4 -0
- package/highlevel/methods/users/get-peer-settings.js +14 -0
- package/highlevel/methods/users/resolve-peer.cjs +16 -31
- package/highlevel/methods/users/resolve-peer.js +7 -22
- package/highlevel/methods.d.cts +3 -2
- package/highlevel/methods.d.ts +3 -2
- package/highlevel/storage/repository/peers.d.cts +2 -3
- package/highlevel/storage/repository/peers.d.ts +2 -3
- package/highlevel/storage/service/peers.cjs +10 -4
- package/highlevel/storage/service/peers.d.cts +1 -0
- package/highlevel/storage/service/peers.d.ts +1 -0
- package/highlevel/storage/service/peers.js +10 -4
- package/highlevel/types/bots/keyboards/factories.cjs +4 -4
- package/highlevel/types/media/document.cjs +1 -1
- package/highlevel/types/media/document.js +1 -1
- package/highlevel/types/media/web-page.cjs +40 -3
- package/highlevel/types/media/web-page.d.cts +23 -1
- package/highlevel/types/media/web-page.d.ts +23 -1
- package/highlevel/types/media/web-page.js +41 -4
- package/highlevel/types/messages/message-media.cjs +1 -1
- package/highlevel/types/messages/message-media.d.cts +2 -2
- package/highlevel/types/messages/message-media.d.ts +2 -2
- package/highlevel/types/messages/message-media.js +2 -2
- package/highlevel/types/messages/message.cjs +4 -0
- package/highlevel/types/messages/message.d.cts +2 -0
- package/highlevel/types/messages/message.d.ts +2 -0
- package/highlevel/types/messages/message.js +4 -0
- package/highlevel/types/peers/chat-event/actions.cjs +5 -0
- package/highlevel/types/peers/chat-event/actions.js +5 -0
- package/highlevel/types/peers/chat.cjs +4 -2
- package/highlevel/types/peers/chat.d.cts +2 -2
- package/highlevel/types/peers/chat.d.ts +2 -2
- package/highlevel/types/peers/chat.js +4 -2
- package/highlevel/types/peers/full-chat.cjs +4 -0
- package/highlevel/types/peers/full-chat.d.cts +2 -0
- package/highlevel/types/peers/full-chat.d.ts +2 -0
- package/highlevel/types/peers/full-chat.js +4 -0
- package/highlevel/types/peers/index.d.cts +1 -0
- package/highlevel/types/peers/index.d.ts +1 -0
- package/highlevel/types/peers/peer-settings.cjs +101 -0
- package/highlevel/types/peers/peer-settings.d.cts +84 -0
- package/highlevel/types/peers/peer-settings.d.ts +84 -0
- package/highlevel/types/peers/peer-settings.js +96 -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/premium/saved-star-gift.cjs +4 -1
- package/highlevel/types/premium/saved-star-gift.d.cts +2 -3
- package/highlevel/types/premium/saved-star-gift.d.ts +2 -3
- package/highlevel/types/premium/saved-star-gift.js +5 -2
- package/highlevel/types/premium/stars-transaction.cjs +14 -0
- package/highlevel/types/premium/stars-transaction.d.cts +14 -0
- package/highlevel/types/premium/stars-transaction.d.ts +14 -0
- package/highlevel/types/premium/stars-transaction.js +14 -0
- package/highlevel/types/stories/story-viewer.cjs +1 -1
- package/highlevel/types/stories/story-viewer.js +1 -1
- package/highlevel/types/updates/history-read-update.cjs +1 -0
- package/highlevel/types/updates/history-read-update.js +1 -0
- package/highlevel/updates/manager.js +2 -2
- package/highlevel/utils/file-utils.js +1 -1
- package/highlevel/utils/inline-utils.cjs +5 -5
- package/highlevel/utils/inline-utils.js +1 -1
- package/highlevel/worker/storage.cjs +2 -0
- package/highlevel/worker/storage.d.cts +1 -0
- package/highlevel/worker/storage.d.ts +1 -0
- package/highlevel/worker/storage.js +2 -0
- package/index.cjs +3 -1
- package/index.js +5 -3
- package/methods.cjs +6 -4
- package/methods.js +6 -4
- package/network/authorization.js +2 -2
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/network/persistent-connection.cjs +6 -4
- package/network/persistent-connection.js +6 -4
- package/network/session-connection.cjs +14 -7
- package/network/session-connection.d.cts +1 -1
- package/network/session-connection.d.ts +1 -1
- package/network/session-connection.js +15 -8
- package/package.json +4 -4
- package/storage/memory/repository/peers.cjs +2 -2
- package/storage/memory/repository/peers.d.cts +1 -1
- package/storage/memory/repository/peers.d.ts +1 -1
- package/storage/memory/repository/peers.js +2 -2
- package/storage/sqlite/repository/peers.cjs +3 -5
- package/storage/sqlite/repository/peers.d.cts +1 -2
- package/storage/sqlite/repository/peers.d.ts +1 -2
- package/storage/sqlite/repository/peers.js +3 -5
- package/utils/binary/asn1-parser.js +1 -1
- package/utils/binary/compat.cjs +150 -0
- package/utils/binary/compat.d.cts +13 -0
- package/utils/binary/compat.d.ts +13 -0
- package/utils/binary/compat.js +145 -0
- package/utils/binary/compat.test.d.cts +1 -0
- package/utils/binary/compat.test.d.ts +1 -0
- package/utils/binary/serialization.cjs +59 -0
- package/utils/binary/serialization.d.cts +10 -0
- package/utils/binary/serialization.d.ts +10 -0
- package/utils/binary/serialization.js +54 -0
- package/utils/index.d.cts +2 -0
- package/utils/index.d.ts +2 -0
- package/utils/long-utils.js +1 -1
- package/utils/peer-utils.js +1 -1
- package/utils.cjs +8 -0
- package/utils.js +8 -0
- package/highlevel/methods/premium/get-star-gifts.d.cts +0 -23
- package/highlevel/methods/premium/get-star-gifts.d.ts +0 -23
- package/highlevel/methods/premium/get-star-gifts.js +0 -10
- package/highlevel/methods/premium/iter-star-gifts.cjs +0 -29
- package/highlevel/methods/premium/iter-star-gifts.d.cts +0 -26
- package/highlevel/methods/premium/iter-star-gifts.d.ts +0 -26
- package/highlevel/methods/premium/iter-star-gifts.js +0 -24
|
@@ -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 utils = require("@fuman/utils");
|
|
8
9
|
const errors = require("../../../types/errors.cjs");
|
|
9
10
|
const memoize = require("../../utils/memoize.cjs");
|
|
10
11
|
const documentUtils = require("./document-utils.cjs");
|
|
@@ -14,7 +15,6 @@ class WebPage {
|
|
|
14
15
|
constructor(raw) {
|
|
15
16
|
this.raw = raw;
|
|
16
17
|
}
|
|
17
|
-
type = "webpage";
|
|
18
18
|
/**
|
|
19
19
|
* Unique ID of the preview
|
|
20
20
|
*/
|
|
@@ -172,6 +172,42 @@ class WebPage {
|
|
|
172
172
|
}
|
|
173
173
|
return documentUtils.parseDocument(this.raw.document);
|
|
174
174
|
}
|
|
175
|
+
}
|
|
176
|
+
const WebPage$1 = /* @__PURE__ */ memoize.memoizeGetters(WebPage, ["photo", "document"]);
|
|
177
|
+
const WebPage$2 = /* @__PURE__ */ inspectable.makeInspectable(WebPage$1);
|
|
178
|
+
class WebPageMedia {
|
|
179
|
+
constructor(raw) {
|
|
180
|
+
this.raw = raw;
|
|
181
|
+
}
|
|
182
|
+
type = "webpage";
|
|
183
|
+
/** Web page preview */
|
|
184
|
+
get preview() {
|
|
185
|
+
utils.assert(this.raw.webpage._ === "webPage");
|
|
186
|
+
return new WebPage(this.raw.webpage);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Size in which the client should display whatever contained in the webpage
|
|
190
|
+
*
|
|
191
|
+
* - `small`: small square thumbnail on the right
|
|
192
|
+
* - `large`: large thumbnail below the webpage content
|
|
193
|
+
* - `default`: default behaviour (depending on the og tags)
|
|
194
|
+
*/
|
|
195
|
+
get displaySize() {
|
|
196
|
+
if (this.raw.forceLargeMedia) return "large";
|
|
197
|
+
if (this.raw.forceSmallMedia) return "small";
|
|
198
|
+
return "default";
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Whether the webpage was manually set, and the link might not be present
|
|
202
|
+
* at all in the actual message
|
|
203
|
+
*/
|
|
204
|
+
get manual() {
|
|
205
|
+
return this.raw.manual;
|
|
206
|
+
}
|
|
207
|
+
/** Whether it's safe to open the URL without the user confirmation */
|
|
208
|
+
get safe() {
|
|
209
|
+
return this.raw.safe;
|
|
210
|
+
}
|
|
175
211
|
/**
|
|
176
212
|
* Input media TL object generated from this object,
|
|
177
213
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -185,6 +221,7 @@ class WebPage {
|
|
|
185
221
|
throw new errors.MtArgumentError("WebPage cannot provide an InputMedia");
|
|
186
222
|
}
|
|
187
223
|
}
|
|
188
|
-
const
|
|
189
|
-
const
|
|
224
|
+
const WebPageMedia$1 = /* @__PURE__ */ inspectable.makeInspectable(WebPageMedia, void 0, ["inputMedia"]);
|
|
225
|
+
const WebPageMedia$2 = /* @__PURE__ */ memoize.memoizeGetters(WebPageMedia$1, ["preview"]);
|
|
190
226
|
exports.WebPage = WebPage$2;
|
|
227
|
+
exports.WebPageMedia = WebPageMedia$2;
|
|
@@ -13,7 +13,6 @@ import { Photo } from './photo.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class WebPage {
|
|
15
15
|
readonly raw: tl.RawWebPage;
|
|
16
|
-
readonly type: "webpage";
|
|
17
16
|
constructor(raw: tl.RawWebPage);
|
|
18
17
|
/**
|
|
19
18
|
* Unique ID of the preview
|
|
@@ -138,6 +137,29 @@ export declare class WebPage {
|
|
|
138
137
|
* {@link Audio}, {@link Document}.
|
|
139
138
|
*/
|
|
140
139
|
get document(): RawDocument | null;
|
|
140
|
+
}
|
|
141
|
+
/** Information about a web page preview in a message */
|
|
142
|
+
export declare class WebPageMedia {
|
|
143
|
+
readonly raw: tl.RawMessageMediaWebPage;
|
|
144
|
+
readonly type: "webpage";
|
|
145
|
+
constructor(raw: tl.RawMessageMediaWebPage);
|
|
146
|
+
/** Web page preview */
|
|
147
|
+
get preview(): WebPage;
|
|
148
|
+
/**
|
|
149
|
+
* Size in which the client should display whatever contained in the webpage
|
|
150
|
+
*
|
|
151
|
+
* - `small`: small square thumbnail on the right
|
|
152
|
+
* - `large`: large thumbnail below the webpage content
|
|
153
|
+
* - `default`: default behaviour (depending on the og tags)
|
|
154
|
+
*/
|
|
155
|
+
get displaySize(): 'small' | 'large' | 'default';
|
|
156
|
+
/**
|
|
157
|
+
* Whether the webpage was manually set, and the link might not be present
|
|
158
|
+
* at all in the actual message
|
|
159
|
+
*/
|
|
160
|
+
get manual(): boolean;
|
|
161
|
+
/** Whether it's safe to open the URL without the user confirmation */
|
|
162
|
+
get safe(): boolean;
|
|
141
163
|
/**
|
|
142
164
|
* Input media TL object generated from this object,
|
|
143
165
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -13,7 +13,6 @@ import { Photo } from './photo.js';
|
|
|
13
13
|
*/
|
|
14
14
|
export declare class WebPage {
|
|
15
15
|
readonly raw: tl.RawWebPage;
|
|
16
|
-
readonly type: "webpage";
|
|
17
16
|
constructor(raw: tl.RawWebPage);
|
|
18
17
|
/**
|
|
19
18
|
* Unique ID of the preview
|
|
@@ -138,6 +137,29 @@ export declare class WebPage {
|
|
|
138
137
|
* {@link Audio}, {@link Document}.
|
|
139
138
|
*/
|
|
140
139
|
get document(): RawDocument | null;
|
|
140
|
+
}
|
|
141
|
+
/** Information about a web page preview in a message */
|
|
142
|
+
export declare class WebPageMedia {
|
|
143
|
+
readonly raw: tl.RawMessageMediaWebPage;
|
|
144
|
+
readonly type: "webpage";
|
|
145
|
+
constructor(raw: tl.RawMessageMediaWebPage);
|
|
146
|
+
/** Web page preview */
|
|
147
|
+
get preview(): WebPage;
|
|
148
|
+
/**
|
|
149
|
+
* Size in which the client should display whatever contained in the webpage
|
|
150
|
+
*
|
|
151
|
+
* - `small`: small square thumbnail on the right
|
|
152
|
+
* - `large`: large thumbnail below the webpage content
|
|
153
|
+
* - `default`: default behaviour (depending on the og tags)
|
|
154
|
+
*/
|
|
155
|
+
get displaySize(): 'small' | 'large' | 'default';
|
|
156
|
+
/**
|
|
157
|
+
* Whether the webpage was manually set, and the link might not be present
|
|
158
|
+
* at all in the actual message
|
|
159
|
+
*/
|
|
160
|
+
get manual(): boolean;
|
|
161
|
+
/** Whether it's safe to open the URL without the user confirmation */
|
|
162
|
+
get safe(): boolean;
|
|
141
163
|
/**
|
|
142
164
|
* Input media TL object generated from this object,
|
|
143
165
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assert } from "@fuman/utils";
|
|
1
2
|
import { MtArgumentError } from "../../../types/errors.js";
|
|
2
3
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
3
4
|
import { parseDocument } from "./document-utils.js";
|
|
@@ -7,7 +8,6 @@ class WebPage {
|
|
|
7
8
|
constructor(raw) {
|
|
8
9
|
this.raw = raw;
|
|
9
10
|
}
|
|
10
|
-
type = "webpage";
|
|
11
11
|
/**
|
|
12
12
|
* Unique ID of the preview
|
|
13
13
|
*/
|
|
@@ -165,6 +165,42 @@ class WebPage {
|
|
|
165
165
|
}
|
|
166
166
|
return parseDocument(this.raw.document);
|
|
167
167
|
}
|
|
168
|
+
}
|
|
169
|
+
const WebPage$1 = /* @__PURE__ */ memoizeGetters(WebPage, ["photo", "document"]);
|
|
170
|
+
const WebPage$2 = /* @__PURE__ */ makeInspectable(WebPage$1);
|
|
171
|
+
class WebPageMedia {
|
|
172
|
+
constructor(raw) {
|
|
173
|
+
this.raw = raw;
|
|
174
|
+
}
|
|
175
|
+
type = "webpage";
|
|
176
|
+
/** Web page preview */
|
|
177
|
+
get preview() {
|
|
178
|
+
assert(this.raw.webpage._ === "webPage");
|
|
179
|
+
return new WebPage(this.raw.webpage);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Size in which the client should display whatever contained in the webpage
|
|
183
|
+
*
|
|
184
|
+
* - `small`: small square thumbnail on the right
|
|
185
|
+
* - `large`: large thumbnail below the webpage content
|
|
186
|
+
* - `default`: default behaviour (depending on the og tags)
|
|
187
|
+
*/
|
|
188
|
+
get displaySize() {
|
|
189
|
+
if (this.raw.forceLargeMedia) return "large";
|
|
190
|
+
if (this.raw.forceSmallMedia) return "small";
|
|
191
|
+
return "default";
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Whether the webpage was manually set, and the link might not be present
|
|
195
|
+
* at all in the actual message
|
|
196
|
+
*/
|
|
197
|
+
get manual() {
|
|
198
|
+
return this.raw.manual;
|
|
199
|
+
}
|
|
200
|
+
/** Whether it's safe to open the URL without the user confirmation */
|
|
201
|
+
get safe() {
|
|
202
|
+
return this.raw.safe;
|
|
203
|
+
}
|
|
168
204
|
/**
|
|
169
205
|
* Input media TL object generated from this object,
|
|
170
206
|
* to be used inside {@link InputMediaLike} and
|
|
@@ -178,8 +214,9 @@ class WebPage {
|
|
|
178
214
|
throw new MtArgumentError("WebPage cannot provide an InputMedia");
|
|
179
215
|
}
|
|
180
216
|
}
|
|
181
|
-
const
|
|
182
|
-
const
|
|
217
|
+
const WebPageMedia$1 = /* @__PURE__ */ makeInspectable(WebPageMedia, void 0, ["inputMedia"]);
|
|
218
|
+
const WebPageMedia$2 = /* @__PURE__ */ memoizeGetters(WebPageMedia$1, ["preview"]);
|
|
183
219
|
export {
|
|
184
|
-
WebPage$2 as WebPage
|
|
220
|
+
WebPage$2 as WebPage,
|
|
221
|
+
WebPageMedia$2 as WebPageMedia
|
|
185
222
|
};
|
|
@@ -40,7 +40,7 @@ function _messageMediaFromTl(peers, m) {
|
|
|
40
40
|
return new game.Game(m.game);
|
|
41
41
|
case "messageMediaWebPage":
|
|
42
42
|
if (!(m.webpage._ === "webPage")) return null;
|
|
43
|
-
return new webPage.
|
|
43
|
+
return new webPage.WebPageMedia(m);
|
|
44
44
|
case "messageMediaVenue":
|
|
45
45
|
return new venue.Venue(m);
|
|
46
46
|
case "messageMediaPoll":
|
|
@@ -15,9 +15,9 @@ import { Photo } from '../media/photo.js';
|
|
|
15
15
|
import { Poll } from '../media/poll.js';
|
|
16
16
|
import { MediaStory } from '../media/story.js';
|
|
17
17
|
import { Venue } from '../media/venue.js';
|
|
18
|
-
import {
|
|
18
|
+
import { WebPageMedia } from '../media/web-page.js';
|
|
19
19
|
/** A media inside of a {@link Message} */
|
|
20
|
-
export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game |
|
|
20
|
+
export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game | WebPageMedia | Venue | Poll | Invoice | MediaStory | PaidMedia | null;
|
|
21
21
|
export type MessageMediaType = Exclude<MessageMedia, null>['type'];
|
|
22
22
|
/** @internal */
|
|
23
23
|
export declare function _messageMediaFromTl(peers: PeersIndex | null, m: tl.TypeMessageMedia): MessageMedia;
|
|
@@ -15,9 +15,9 @@ import { Photo } from '../media/photo.js';
|
|
|
15
15
|
import { Poll } from '../media/poll.js';
|
|
16
16
|
import { MediaStory } from '../media/story.js';
|
|
17
17
|
import { Venue } from '../media/venue.js';
|
|
18
|
-
import {
|
|
18
|
+
import { WebPageMedia } from '../media/web-page.js';
|
|
19
19
|
/** A media inside of a {@link Message} */
|
|
20
|
-
export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game |
|
|
20
|
+
export type MessageMedia = Photo | Dice | Contact | Audio | Voice | Sticker | Document | Video | Location | LiveLocation | Game | WebPageMedia | Venue | Poll | Invoice | MediaStory | PaidMedia | null;
|
|
21
21
|
export type MessageMediaType = Exclude<MessageMedia, null>['type'];
|
|
22
22
|
/** @internal */
|
|
23
23
|
export declare function _messageMediaFromTl(peers: PeersIndex | null, m: tl.TypeMessageMedia): MessageMedia;
|
|
@@ -10,7 +10,7 @@ import { Photo as Photo$2 } from "../media/photo.js";
|
|
|
10
10
|
import { Poll as Poll$2 } from "../media/poll.js";
|
|
11
11
|
import { MediaStory as MediaStory$1 } from "../media/story.js";
|
|
12
12
|
import { Venue as Venue$2 } from "../media/venue.js";
|
|
13
|
-
import {
|
|
13
|
+
import { WebPageMedia as WebPageMedia$2 } from "../media/web-page.js";
|
|
14
14
|
function _messageMediaFromTl(peers, m) {
|
|
15
15
|
switch (m._) {
|
|
16
16
|
case "messageMediaPhoto":
|
|
@@ -33,7 +33,7 @@ function _messageMediaFromTl(peers, m) {
|
|
|
33
33
|
return new Game$2(m.game);
|
|
34
34
|
case "messageMediaWebPage":
|
|
35
35
|
if (!(m.webpage._ === "webPage")) return null;
|
|
36
|
-
return new
|
|
36
|
+
return new WebPageMedia$2(m);
|
|
37
37
|
case "messageMediaVenue":
|
|
38
38
|
return new Venue$2(m);
|
|
39
39
|
case "messageMediaPoll":
|
|
@@ -422,6 +422,10 @@ class Message {
|
|
|
422
422
|
get videoProcessingPending() {
|
|
423
423
|
return this.raw._ === "message" && this.raw.videoProcessingPending;
|
|
424
424
|
}
|
|
425
|
+
/** If this message was paid, the number of stars spent sending it */
|
|
426
|
+
get sendPrice() {
|
|
427
|
+
return this.raw._ === "message" ? this.raw.paidMessageStars ?? null : null;
|
|
428
|
+
}
|
|
425
429
|
/**
|
|
426
430
|
* Generated permalink to this message, only for groups and channels
|
|
427
431
|
*
|
|
@@ -247,6 +247,8 @@ export declare class Message {
|
|
|
247
247
|
get effectId(): tl.Long | null;
|
|
248
248
|
/** Whether this message has a video that is still being processed */
|
|
249
249
|
get videoProcessingPending(): boolean;
|
|
250
|
+
/** If this message was paid, the number of stars spent sending it */
|
|
251
|
+
get sendPrice(): tl.Long | null;
|
|
250
252
|
/**
|
|
251
253
|
* Generated permalink to this message, only for groups and channels
|
|
252
254
|
*
|
|
@@ -247,6 +247,8 @@ export declare class Message {
|
|
|
247
247
|
get effectId(): tl.Long | null;
|
|
248
248
|
/** Whether this message has a video that is still being processed */
|
|
249
249
|
get videoProcessingPending(): boolean;
|
|
250
|
+
/** If this message was paid, the number of stars spent sending it */
|
|
251
|
+
get sendPrice(): tl.Long | null;
|
|
250
252
|
/**
|
|
251
253
|
* Generated permalink to this message, only for groups and channels
|
|
252
254
|
*
|
|
@@ -415,6 +415,10 @@ class Message {
|
|
|
415
415
|
get videoProcessingPending() {
|
|
416
416
|
return this.raw._ === "message" && this.raw.videoProcessingPending;
|
|
417
417
|
}
|
|
418
|
+
/** If this message was paid, the number of stars spent sending it */
|
|
419
|
+
get sendPrice() {
|
|
420
|
+
return this.raw._ === "message" ? this.raw.paidMessageStars ?? null : null;
|
|
421
|
+
}
|
|
418
422
|
/**
|
|
419
423
|
* Generated permalink to this message, only for groups and channels
|
|
420
424
|
*
|
|
@@ -189,6 +189,9 @@ function _actionFromTl(e, peers) {
|
|
|
189
189
|
link: new chatInviteLink.ChatInviteLink(e.invite, peers),
|
|
190
190
|
approvedBy: new user.User(peers.user(e.approvedBy))
|
|
191
191
|
};
|
|
192
|
+
// channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction;
|
|
193
|
+
// channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic
|
|
194
|
+
// channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction;
|
|
192
195
|
case "channelAdminLogEventActionToggleForum":
|
|
193
196
|
return {
|
|
194
197
|
type: "forum_toggled",
|
|
@@ -219,6 +222,8 @@ function _actionFromTl(e, peers) {
|
|
|
219
222
|
type: "no_forwards_toggled",
|
|
220
223
|
enabled: e.newValue
|
|
221
224
|
};
|
|
225
|
+
// case 'channelAdminLogEventActionPinTopic'
|
|
226
|
+
// ^ looks like it is not used, and pinned topics are not at all presented in the event log
|
|
222
227
|
case "channelAdminLogEventActionToggleSignatureProfiles":
|
|
223
228
|
return {
|
|
224
229
|
type: "signature_profiles_toggled",
|
|
@@ -182,6 +182,9 @@ function _actionFromTl(e, peers) {
|
|
|
182
182
|
link: new ChatInviteLink$2(e.invite, peers),
|
|
183
183
|
approvedBy: new User$2(peers.user(e.approvedBy))
|
|
184
184
|
};
|
|
185
|
+
// channelAdminLogEventActionCreateTopic#58707d28 topic:ForumTopic = ChannelAdminLogEventAction;
|
|
186
|
+
// channelAdminLogEventActionEditTopic#f06fe208 prev_topic:ForumTopic new_topic:ForumTopic
|
|
187
|
+
// channelAdminLogEventActionDeleteTopic#ae168909 topic:ForumTopic = ChannelAdminLogEventAction;
|
|
185
188
|
case "channelAdminLogEventActionToggleForum":
|
|
186
189
|
return {
|
|
187
190
|
type: "forum_toggled",
|
|
@@ -212,6 +215,8 @@ function _actionFromTl(e, peers) {
|
|
|
212
215
|
type: "no_forwards_toggled",
|
|
213
216
|
enabled: e.newValue
|
|
214
217
|
};
|
|
218
|
+
// case 'channelAdminLogEventActionPinTopic'
|
|
219
|
+
// ^ looks like it is not used, and pinned topics are not at all presented in the event log
|
|
215
220
|
case "channelAdminLogEventActionToggleSignatureProfiles":
|
|
216
221
|
return {
|
|
217
222
|
type: "signature_profiles_toggled",
|
|
@@ -193,8 +193,6 @@ class Chat {
|
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Whether the current user is a member of the chat.
|
|
196
|
-
*
|
|
197
|
-
* For users, this is always `true`.
|
|
198
196
|
*/
|
|
199
197
|
get isMember() {
|
|
200
198
|
switch (this.raw._) {
|
|
@@ -400,6 +398,10 @@ class Chat {
|
|
|
400
398
|
if (!this.raw.migratedTo) return null;
|
|
401
399
|
return peerUtils.getMarkedPeerId(this.raw.migratedTo);
|
|
402
400
|
}
|
|
401
|
+
/** If this chat has paid messages enabled, price of one message in stars */
|
|
402
|
+
get paidMessagePrice() {
|
|
403
|
+
return this.raw._ === "channel" ? this.raw.sendPaidMessagesStars ?? null : null;
|
|
404
|
+
}
|
|
403
405
|
/**
|
|
404
406
|
* Create a mention for the chat.
|
|
405
407
|
*
|
|
@@ -110,8 +110,6 @@ export declare class Chat {
|
|
|
110
110
|
get isLikelyUnavailable(): boolean;
|
|
111
111
|
/**
|
|
112
112
|
* Whether the current user is a member of the chat.
|
|
113
|
-
*
|
|
114
|
-
* For users, this is always `true`.
|
|
115
113
|
*/
|
|
116
114
|
get isMember(): boolean;
|
|
117
115
|
/** Whether this chat has a call/livestrean active */
|
|
@@ -227,6 +225,8 @@ export declare class Chat {
|
|
|
227
225
|
* this field will contain the marked ID of that supergroup.
|
|
228
226
|
*/
|
|
229
227
|
get migratedToId(): number | null;
|
|
228
|
+
/** If this chat has paid messages enabled, price of one message in stars */
|
|
229
|
+
get paidMessagePrice(): tl.Long | null;
|
|
230
230
|
/**
|
|
231
231
|
* Create a mention for the chat.
|
|
232
232
|
*
|
|
@@ -110,8 +110,6 @@ export declare class Chat {
|
|
|
110
110
|
get isLikelyUnavailable(): boolean;
|
|
111
111
|
/**
|
|
112
112
|
* Whether the current user is a member of the chat.
|
|
113
|
-
*
|
|
114
|
-
* For users, this is always `true`.
|
|
115
113
|
*/
|
|
116
114
|
get isMember(): boolean;
|
|
117
115
|
/** Whether this chat has a call/livestrean active */
|
|
@@ -227,6 +225,8 @@ export declare class Chat {
|
|
|
227
225
|
* this field will contain the marked ID of that supergroup.
|
|
228
226
|
*/
|
|
229
227
|
get migratedToId(): number | null;
|
|
228
|
+
/** If this chat has paid messages enabled, price of one message in stars */
|
|
229
|
+
get paidMessagePrice(): tl.Long | null;
|
|
230
230
|
/**
|
|
231
231
|
* Create a mention for the chat.
|
|
232
232
|
*
|
|
@@ -186,8 +186,6 @@ class Chat {
|
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* Whether the current user is a member of the chat.
|
|
189
|
-
*
|
|
190
|
-
* For users, this is always `true`.
|
|
191
189
|
*/
|
|
192
190
|
get isMember() {
|
|
193
191
|
switch (this.raw._) {
|
|
@@ -393,6 +391,10 @@ class Chat {
|
|
|
393
391
|
if (!this.raw.migratedTo) return null;
|
|
394
392
|
return getMarkedPeerId(this.raw.migratedTo);
|
|
395
393
|
}
|
|
394
|
+
/** If this chat has paid messages enabled, price of one message in stars */
|
|
395
|
+
get paidMessagePrice() {
|
|
396
|
+
return this.raw._ === "channel" ? this.raw.sendPaidMessagesStars ?? null : null;
|
|
397
|
+
}
|
|
396
398
|
/**
|
|
397
399
|
* Create a mention for the chat.
|
|
398
400
|
*
|
|
@@ -306,6 +306,10 @@ class FullChat extends chat.Chat {
|
|
|
306
306
|
get starGiftsCount() {
|
|
307
307
|
return this.full._ === "channelFull" ? this.full.stargiftsCount ?? 0 : 0;
|
|
308
308
|
}
|
|
309
|
+
/** Whether you can enable paid messages in this chat */
|
|
310
|
+
get paidMessagesAvailable() {
|
|
311
|
+
return this.full._ === "channelFull" && this.full.paidMessagesAvailable;
|
|
312
|
+
}
|
|
309
313
|
}
|
|
310
314
|
const FullChat$1 = /* @__PURE__ */ memoize.memoizeGetters(FullChat, [
|
|
311
315
|
"fullPhoto",
|
|
@@ -165,4 +165,6 @@ export declare class FullChat extends Chat {
|
|
|
165
165
|
get starGiftsAvailable(): boolean;
|
|
166
166
|
/** Number of star gifts available in this chat */
|
|
167
167
|
get starGiftsCount(): number;
|
|
168
|
+
/** Whether you can enable paid messages in this chat */
|
|
169
|
+
get paidMessagesAvailable(): boolean;
|
|
168
170
|
}
|
|
@@ -165,4 +165,6 @@ export declare class FullChat extends Chat {
|
|
|
165
165
|
get starGiftsAvailable(): boolean;
|
|
166
166
|
/** Number of star gifts available in this chat */
|
|
167
167
|
get starGiftsCount(): number;
|
|
168
|
+
/** Whether you can enable paid messages in this chat */
|
|
169
|
+
get paidMessagesAvailable(): boolean;
|
|
168
170
|
}
|
|
@@ -299,6 +299,10 @@ class FullChat extends Chat$2 {
|
|
|
299
299
|
get starGiftsCount() {
|
|
300
300
|
return this.full._ === "channelFull" ? this.full.stargiftsCount ?? 0 : 0;
|
|
301
301
|
}
|
|
302
|
+
/** Whether you can enable paid messages in this chat */
|
|
303
|
+
get paidMessagesAvailable() {
|
|
304
|
+
return this.full._ === "channelFull" && this.full.paidMessagesAvailable;
|
|
305
|
+
}
|
|
302
306
|
}
|
|
303
307
|
const FullChat$1 = /* @__PURE__ */ memoizeGetters(FullChat, [
|
|
304
308
|
"fullPhoto",
|
|
@@ -14,6 +14,7 @@ export * from './chatlist-preview.js';
|
|
|
14
14
|
export * from './forum-topic.js';
|
|
15
15
|
export * from './full-chat.js';
|
|
16
16
|
export * from './full-user.js';
|
|
17
|
+
export * from './peer-settings.js';
|
|
17
18
|
export * from './peer.js';
|
|
18
19
|
export * from './peers-index.js';
|
|
19
20
|
export * from './typing-status.js';
|
|
@@ -14,6 +14,7 @@ export * from './chatlist-preview.js';
|
|
|
14
14
|
export * from './forum-topic.js';
|
|
15
15
|
export * from './full-chat.js';
|
|
16
16
|
export * from './full-user.js';
|
|
17
|
+
export * from './peer-settings.js';
|
|
17
18
|
export * from './peer.js';
|
|
18
19
|
export * from './peers-index.js';
|
|
19
20
|
export * from './typing-status.js';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS support is deprecated and will be removed in 0.25.0. 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 inspectable = require("../../utils/inspectable.cjs");
|
|
9
|
+
const memoize = require("../../utils/memoize.cjs");
|
|
10
|
+
const user = require("./user.cjs");
|
|
11
|
+
class PeerSettings {
|
|
12
|
+
constructor(raw, _peers) {
|
|
13
|
+
this.raw = raw;
|
|
14
|
+
this._peers = _peers;
|
|
15
|
+
}
|
|
16
|
+
/** Action bar that should be displayed in the chat with the user */
|
|
17
|
+
get actionBar() {
|
|
18
|
+
if (this.raw.requestChatTitle) {
|
|
19
|
+
return {
|
|
20
|
+
type: "join_request",
|
|
21
|
+
chatTitle: this.raw.requestChatTitle,
|
|
22
|
+
isBroadcast: this.raw.requestChatBroadcast,
|
|
23
|
+
requestDate: new Date(this.raw.requestChatDate ?? 0)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (this.raw.reportGeo) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
if (this.raw.inviteMembers) {
|
|
30
|
+
return { type: "invite_members" };
|
|
31
|
+
}
|
|
32
|
+
if (this.raw.shareContact) {
|
|
33
|
+
return { type: "share_phone_number" };
|
|
34
|
+
}
|
|
35
|
+
if (this.raw.blockContact || this.raw.reportSpam) {
|
|
36
|
+
return {
|
|
37
|
+
type: "add_or_report",
|
|
38
|
+
canReportSpam: this.raw.reportSpam,
|
|
39
|
+
canUnarchive: this.raw.autoarchived
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (this.raw.addContact) {
|
|
43
|
+
return {
|
|
44
|
+
type: "add_contact",
|
|
45
|
+
needPhoneNumberPrivacyException: this.raw.needContactsException
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (this.raw.businessBotId && this._peers) {
|
|
49
|
+
return {
|
|
50
|
+
type: "business_bot",
|
|
51
|
+
bot: new user.User(this._peers.user(this.raw.businessBotId)),
|
|
52
|
+
manageUrl: this.raw.businessBotManageUrl ?? ""
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
/** Distance in meters between us and the user */
|
|
58
|
+
get geoDistance() {
|
|
59
|
+
return this.raw.geoDistance ?? null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Price of paid messages to this peer for the current user
|
|
63
|
+
* (note that this might differ from {@link User.paidMessagePrice},
|
|
64
|
+
* because the user might have added us to their contacts or wrote first,
|
|
65
|
+
* in which case the messages are free regardless)
|
|
66
|
+
*/
|
|
67
|
+
get paidMessagePrice() {
|
|
68
|
+
return this.raw.chargePaidMessageStars ?? null;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Month and year when the user registered.
|
|
72
|
+
* Only available for users who contacted us first.
|
|
73
|
+
*/
|
|
74
|
+
get registrationDate() {
|
|
75
|
+
return this.raw.registrationMonth ?? null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* ISO country code of the user's phone number.
|
|
79
|
+
* Only available for users who contacted us first.
|
|
80
|
+
*/
|
|
81
|
+
get phoneCountry() {
|
|
82
|
+
return this.raw.phoneCountry ?? null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Date when the user has last changed their name.
|
|
86
|
+
* Only available for users who contacted us first.
|
|
87
|
+
*/
|
|
88
|
+
get nameChangeDate() {
|
|
89
|
+
return this.raw.nameChangeDate ? new Date(this.raw.nameChangeDate * 1e3) : null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Date when the user has last changed their photo.
|
|
93
|
+
* Only available for users who contacted us first.
|
|
94
|
+
*/
|
|
95
|
+
get photoChangeDate() {
|
|
96
|
+
return this.raw.photoChangeDate ? new Date(this.raw.photoChangeDate * 1e3) : null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const PeerSettings$1 = /* @__PURE__ */ inspectable.makeInspectable(PeerSettings);
|
|
100
|
+
const PeerSettings$2 = /* @__PURE__ */ memoize.memoizeGetters(PeerSettings$1, ["actionBar"]);
|
|
101
|
+
exports.PeerSettings = PeerSettings$2;
|