@mtcute/core 0.26.2 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/highlevel/methods/bots/open-webview.d.cts +1 -1
- package/highlevel/methods/bots/open-webview.d.ts +1 -1
- package/highlevel/methods/messages/append-todo-list.d.cts +1 -1
- package/highlevel/methods/messages/append-todo-list.d.ts +1 -1
- package/highlevel/methods/misc/with-params.cjs +18 -12
- package/highlevel/methods/misc/with-params.js +18 -12
- package/highlevel/methods/premium/get-resale-star-gifts.cjs +5 -5
- package/highlevel/methods/premium/get-resale-star-gifts.d.cts +1 -1
- package/highlevel/methods/premium/get-resale-star-gifts.d.ts +1 -1
- package/highlevel/methods/premium/get-resale-star-gifts.js +1 -1
- package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.cts +2 -2
- package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.ts +2 -2
- package/highlevel/methods/premium/get-star-gift-options.cjs +2 -2
- package/highlevel/methods/premium/get-star-gift-options.d.cts +1 -1
- package/highlevel/methods/premium/get-star-gift-options.d.ts +1 -1
- package/highlevel/methods/premium/get-star-gift-options.js +1 -1
- package/highlevel/methods/premium/get-unique-star-gift.cjs +2 -2
- package/highlevel/methods/premium/get-unique-star-gift.js +1 -1
- package/highlevel/methods/premium/pin-star-gift.d.cts +2 -2
- package/highlevel/methods/premium/pin-star-gift.d.ts +2 -2
- package/highlevel/methods/premium/send-star-gift.d.cts +2 -2
- package/highlevel/methods/premium/send-star-gift.d.ts +2 -2
- package/highlevel/types/files/utils.d.cts +1 -1
- package/highlevel/types/files/utils.d.ts +1 -1
- package/highlevel/types/media/todo.cjs +4 -4
- package/highlevel/types/media/todo.d.cts +2 -2
- package/highlevel/types/media/todo.d.ts +2 -2
- package/highlevel/types/media/todo.js +3 -3
- package/highlevel/types/messages/message-action.cjs +9 -8
- package/highlevel/types/messages/message-action.d.cts +8 -4
- package/highlevel/types/messages/message-action.d.ts +8 -4
- package/highlevel/types/messages/message-action.js +5 -4
- 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/messages/replied-message.d.cts +1 -1
- package/highlevel/types/messages/replied-message.d.ts +1 -1
- package/highlevel/types/peers/chat.cjs +1 -1
- package/highlevel/types/peers/chat.d.cts +1 -1
- package/highlevel/types/peers/chat.d.ts +1 -1
- package/highlevel/types/peers/chat.js +1 -1
- package/highlevel/types/peers/full-chat.cjs +1 -1
- package/highlevel/types/peers/full-chat.js +1 -1
- package/highlevel/types/peers/user.cjs +1 -1
- package/highlevel/types/peers/user.d.cts +1 -1
- package/highlevel/types/peers/user.d.ts +1 -1
- package/highlevel/types/peers/user.js +1 -1
- package/highlevel/types/premium/index.d.cts +2 -2
- package/highlevel/types/premium/index.d.ts +2 -2
- package/highlevel/types/premium/saved-star-gift.cjs +4 -4
- package/highlevel/types/premium/saved-star-gift.d.cts +2 -2
- package/highlevel/types/premium/saved-star-gift.d.ts +2 -2
- package/highlevel/types/premium/saved-star-gift.js +2 -2
- package/highlevel/types/premium/{stars-gift.cjs → star-gift.cjs} +8 -0
- package/highlevel/types/premium/{stars-gift.d.ts → star-gift.d.cts} +6 -1
- package/highlevel/types/premium/{stars-gift.d.cts → star-gift.d.ts} +6 -1
- package/highlevel/types/premium/{stars-gift.js → star-gift.js} +8 -0
- package/highlevel/types/premium/stars-transaction.cjs +8 -8
- package/highlevel/types/premium/stars-transaction.d.cts +3 -3
- package/highlevel/types/premium/stars-transaction.d.ts +3 -3
- package/highlevel/types/premium/stars-transaction.js +2 -2
- package/highlevel/types/reactions/peer-reaction.d.cts +1 -1
- package/highlevel/types/reactions/peer-reaction.d.ts +1 -1
- package/highlevel/updates/manager.d.cts +1 -1
- package/highlevel/updates/manager.d.ts +1 -1
- package/highlevel/utils/misc-utils.cjs +1 -1
- package/highlevel/utils/misc-utils.js +1 -1
- package/index.cjs +9 -9
- package/index.js +2 -2
- package/network/mtproto-session.d.cts +1 -1
- package/network/mtproto-session.d.ts +1 -1
- package/network/mtproxy/_fake-tls.d.cts +1 -1
- package/network/mtproxy/_fake-tls.d.ts +1 -1
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.d.cts +1 -1
- package/network/network-manager.d.ts +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +6 -6
- package/utils/binary/compat.cjs +2 -0
- package/utils/binary/compat.js +2 -0
- /package/highlevel/types/premium/{stars-gift-unique.cjs → star-gift-unique.cjs} +0 -0
- /package/highlevel/types/premium/{stars-gift-unique.d.cts → star-gift-unique.d.cts} +0 -0
- /package/highlevel/types/premium/{stars-gift-unique.d.ts → star-gift-unique.d.ts} +0 -0
- /package/highlevel/types/premium/{stars-gift-unique.js → star-gift-unique.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
-
import { InputPeerLike } from '../../types/index.js';
|
|
4
3
|
import { InputWebview, WebviewResult } from '../../types/bots/webview.js';
|
|
4
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Open a webview.
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
-
import { InputPeerLike } from '../../types/index.js';
|
|
4
3
|
import { InputWebview, WebviewResult } from '../../types/bots/webview.js';
|
|
4
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
5
5
|
/**
|
|
6
6
|
* Open a webview.
|
|
7
7
|
*/
|
|
@@ -6,18 +6,24 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
function withParams(client, params) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const wrappedClientsMap = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
function wrapClient(client2) {
|
|
11
|
+
const existing = wrappedClientsMap.get(client2);
|
|
12
|
+
if (existing) return existing;
|
|
13
|
+
const wrappedCall = (message, extraParams) => client2.call(message, extraParams ? { ...params, ...extraParams } : params);
|
|
14
|
+
const wrapped = new Proxy(client2, {
|
|
15
|
+
get: (target, prop, receiver) => {
|
|
16
|
+
if (prop === "call") return wrappedCall;
|
|
17
|
+
const res = Reflect.get(target, prop, receiver);
|
|
18
|
+
if (res && typeof res === "object" && "storage" in res && "call" in res) {
|
|
19
|
+
return wrapClient(res);
|
|
20
|
+
}
|
|
21
|
+
return res;
|
|
14
22
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
return proxy;
|
|
23
|
+
});
|
|
24
|
+
wrappedClientsMap.set(client2, wrapped);
|
|
25
|
+
return wrapped;
|
|
26
|
+
}
|
|
27
|
+
return wrapClient(client);
|
|
22
28
|
}
|
|
23
29
|
exports.withParams = withParams;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
function withParams(client, params) {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
const wrappedClientsMap = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function wrapClient(client2) {
|
|
4
|
+
const existing = wrappedClientsMap.get(client2);
|
|
5
|
+
if (existing) return existing;
|
|
6
|
+
const wrappedCall = (message, extraParams) => client2.call(message, extraParams ? { ...params, ...extraParams } : params);
|
|
7
|
+
const wrapped = new Proxy(client2, {
|
|
8
|
+
get: (target, prop, receiver) => {
|
|
9
|
+
if (prop === "call") return wrappedCall;
|
|
10
|
+
const res = Reflect.get(target, prop, receiver);
|
|
11
|
+
if (res && typeof res === "object" && "storage" in res && "call" in res) {
|
|
12
|
+
return wrapClient(res);
|
|
13
|
+
}
|
|
14
|
+
return res;
|
|
7
15
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
return proxy;
|
|
16
|
+
});
|
|
17
|
+
wrappedClientsMap.set(client2, wrapped);
|
|
18
|
+
return wrapped;
|
|
19
|
+
}
|
|
20
|
+
return wrapClient(client);
|
|
15
21
|
}
|
|
16
22
|
export {
|
|
17
23
|
withParams
|
|
@@ -9,7 +9,7 @@ const utils = require("@fuman/utils");
|
|
|
9
9
|
const Long = require("long");
|
|
10
10
|
const longUtils = require("../../../utils/long-utils.cjs");
|
|
11
11
|
const miscUtils = require("../../utils/misc-utils.cjs");
|
|
12
|
-
const
|
|
12
|
+
const starGiftUnique = require("../../types/premium/star-gift-unique.cjs");
|
|
13
13
|
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
14
14
|
function _normalizeResaleAttributes(attrs) {
|
|
15
15
|
if (Array.isArray(attrs)) {
|
|
@@ -82,17 +82,17 @@ async function getStarGiftResaleOptions(client, params) {
|
|
|
82
82
|
};
|
|
83
83
|
for (const attr of res.attributes ?? []) {
|
|
84
84
|
if (attr._ === "starGiftAttributeModel") {
|
|
85
|
-
attributes.model.set(attr.document.id, new
|
|
85
|
+
attributes.model.set(attr.document.id, new starGiftUnique.StarGiftUniqueAttribute(attr));
|
|
86
86
|
} else if (attr._ === "starGiftAttributePattern") {
|
|
87
|
-
attributes.pattern.set(attr.document.id, new
|
|
87
|
+
attributes.pattern.set(attr.document.id, new starGiftUnique.StarGiftUniqueAttribute(attr));
|
|
88
88
|
} else if (attr._ === "starGiftAttributeBackdrop") {
|
|
89
|
-
attributes.backdrop.set(attr.backdropId, new
|
|
89
|
+
attributes.backdrop.set(attr.backdropId, new starGiftUnique.StarGiftUniqueBackdrop(attr));
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
return miscUtils.makeArrayPaginatedWithMeta(
|
|
93
93
|
res.gifts.map((it) => {
|
|
94
94
|
utils.assert(it._ === "starGiftUnique");
|
|
95
|
-
return new
|
|
95
|
+
return new starGiftUnique.StarGiftUnique(it, peers);
|
|
96
96
|
}),
|
|
97
97
|
res.count,
|
|
98
98
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MaybeArray } from '@fuman/utils';
|
|
1
2
|
import { tl } from '@mtcute/tl';
|
|
2
3
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
4
|
import { ArrayPaginatedWithMeta, StarGiftUnique, StarGiftUniqueAttribute, StarGiftUniqueBackdrop } from '../../types/index.js';
|
|
4
|
-
import { MaybeArray } from '@fuman/utils';
|
|
5
5
|
import { default as Long } from 'long';
|
|
6
6
|
import { LongMap } from '../../../utils/long-utils.js';
|
|
7
7
|
export interface InputStarGiftAttributeIds {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MaybeArray } from '@fuman/utils';
|
|
1
2
|
import { tl } from '@mtcute/tl';
|
|
2
3
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
4
|
import { ArrayPaginatedWithMeta, StarGiftUnique, StarGiftUniqueAttribute, StarGiftUniqueBackdrop } from '../../types/index.js';
|
|
4
|
-
import { MaybeArray } from '@fuman/utils';
|
|
5
5
|
import { default as Long } from 'long';
|
|
6
6
|
import { LongMap } from '../../../utils/long-utils.js';
|
|
7
7
|
export interface InputStarGiftAttributeIds {
|
|
@@ -2,7 +2,7 @@ import { assert } from "@fuman/utils";
|
|
|
2
2
|
import Long from "long";
|
|
3
3
|
import { LongMap } from "../../../utils/long-utils.js";
|
|
4
4
|
import { makeArrayPaginatedWithMeta } from "../../utils/misc-utils.js";
|
|
5
|
-
import { StarGiftUniqueAttribute as StarGiftUniqueAttribute$2, StarGiftUniqueBackdrop as StarGiftUniqueBackdrop$1, StarGiftUnique as StarGiftUnique$2 } from "../../types/premium/
|
|
5
|
+
import { StarGiftUniqueAttribute as StarGiftUniqueAttribute$2, StarGiftUniqueBackdrop as StarGiftUniqueBackdrop$1, StarGiftUnique as StarGiftUnique$2 } from "../../types/premium/star-gift-unique.js";
|
|
6
6
|
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
7
7
|
function _normalizeResaleAttributes(attrs) {
|
|
8
8
|
if (Array.isArray(attrs)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
-
import { InputStarGift } from '../../types/premium/stars-gift.js';
|
|
3
1
|
import { MaybeArray } from '@fuman/utils';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { InputStarGift } from '../../types/premium/star-gift.js';
|
|
4
4
|
import { SavedStarGift } from '../../types/index.js';
|
|
5
5
|
/** Get one or more saved star gifts by their IDs */
|
|
6
6
|
export declare function getSavedStarGiftsById(client: ITelegramClient, gifts: MaybeArray<InputStarGift>): Promise<SavedStarGift[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
-
import { InputStarGift } from '../../types/premium/stars-gift.js';
|
|
3
1
|
import { MaybeArray } from '@fuman/utils';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { InputStarGift } from '../../types/premium/star-gift.js';
|
|
4
4
|
import { SavedStarGift } from '../../types/index.js';
|
|
5
5
|
/** Get one or more saved star gifts by their IDs */
|
|
6
6
|
export declare function getSavedStarGiftsById(client: ITelegramClient, gifts: MaybeArray<InputStarGift>): Promise<SavedStarGift[]>;
|
|
@@ -6,7 +6,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
9
|
-
const
|
|
9
|
+
const starGift = require("../../types/premium/star-gift.cjs");
|
|
10
10
|
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
11
11
|
async function getStarGiftOptions(client) {
|
|
12
12
|
const res = await client.call({
|
|
@@ -18,7 +18,7 @@ async function getStarGiftOptions(client) {
|
|
|
18
18
|
const ret = [];
|
|
19
19
|
for (const gift of res.gifts) {
|
|
20
20
|
if (gift._ === "starGift") {
|
|
21
|
-
ret.push(new
|
|
21
|
+
ret.push(new starGift.StarGift(gift, peers));
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
return ret;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertTypeIsNot } from "../../../utils/type-assertions.js";
|
|
2
|
-
import { StarGift as StarGift$2 } from "../../types/premium/
|
|
2
|
+
import { StarGift as StarGift$2 } from "../../types/premium/star-gift.js";
|
|
3
3
|
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
4
4
|
async function getStarGiftOptions(client) {
|
|
5
5
|
const res = await client.call({
|
|
@@ -7,7 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const utils = require("@fuman/utils");
|
|
9
9
|
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
10
|
-
const
|
|
10
|
+
const starGiftUnique = require("../../types/premium/star-gift-unique.cjs");
|
|
11
11
|
async function getUniqueStarGift(client, slug) {
|
|
12
12
|
const res = await client.call({
|
|
13
13
|
_: "payments.getUniqueStarGift",
|
|
@@ -15,6 +15,6 @@ async function getUniqueStarGift(client, slug) {
|
|
|
15
15
|
});
|
|
16
16
|
const peers = peersIndex.PeersIndex.from(res);
|
|
17
17
|
utils.assert(res.gift._ === "starGiftUnique");
|
|
18
|
-
return new
|
|
18
|
+
return new starGiftUnique.StarGiftUnique(res.gift, peers);
|
|
19
19
|
}
|
|
20
20
|
exports.getUniqueStarGift = getUniqueStarGift;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from "@fuman/utils";
|
|
2
2
|
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
3
|
-
import { StarGiftUnique as StarGiftUnique$2 } from "../../types/premium/
|
|
3
|
+
import { StarGiftUnique as StarGiftUnique$2 } from "../../types/premium/star-gift-unique.js";
|
|
4
4
|
async function getUniqueStarGift(client, slug) {
|
|
5
5
|
const res = await client.call({
|
|
6
6
|
_: "payments.getUniqueStarGift",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MaybeArray } from '@fuman/utils';
|
|
1
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
3
|
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
|
-
import { InputStarGift } from '../../types/premium/
|
|
4
|
-
import { MaybeArray } from '@fuman/utils';
|
|
4
|
+
import { InputStarGift } from '../../types/premium/star-gift.js';
|
|
5
5
|
/**
|
|
6
6
|
* Toggles whether one or more star gift is pinned to the top of the list
|
|
7
7
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { MaybeArray } from '@fuman/utils';
|
|
1
2
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
3
|
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
3
|
-
import { InputStarGift } from '../../types/premium/
|
|
4
|
-
import { MaybeArray } from '@fuman/utils';
|
|
4
|
+
import { InputStarGift } from '../../types/premium/star-gift.js';
|
|
5
5
|
/**
|
|
6
6
|
* Toggles whether one or more star gift is pinned to the top of the list
|
|
7
7
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { Message } from '../../types/messages/message.js';
|
|
3
|
+
import { InputText } from '../../types/misc/entities.js';
|
|
3
4
|
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
4
|
-
import { StarGift } from '../../types/premium/
|
|
5
|
+
import { StarGift } from '../../types/premium/star-gift.js';
|
|
5
6
|
import { default as Long } from 'long';
|
|
6
|
-
import { InputText } from '../../types/misc/entities.js';
|
|
7
7
|
/**
|
|
8
8
|
* Send a star gift to a user.
|
|
9
9
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
2
|
import { Message } from '../../types/messages/message.js';
|
|
3
|
+
import { InputText } from '../../types/misc/entities.js';
|
|
3
4
|
import { InputPeerLike } from '../../types/peers/peer.js';
|
|
4
|
-
import { StarGift } from '../../types/premium/
|
|
5
|
+
import { StarGift } from '../../types/premium/star-gift.js';
|
|
5
6
|
import { default as Long } from 'long';
|
|
6
|
-
import { InputText } from '../../types/misc/entities.js';
|
|
7
7
|
/**
|
|
8
8
|
* Send a star gift to a user.
|
|
9
9
|
*
|
|
@@ -18,7 +18,7 @@ import { UploadedFile } from './uploaded-file.js';
|
|
|
18
18
|
* - `Readable` (Node.js/Bun readable stream)
|
|
19
19
|
* - `Response` (from `window.fetch`)
|
|
20
20
|
*/
|
|
21
|
-
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response
|
|
21
|
+
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response>;
|
|
22
22
|
/**
|
|
23
23
|
* Describes types that can be used as an input
|
|
24
24
|
* to any methods that send media (like {@link TelegramClient.sendPhoto})
|
|
@@ -18,7 +18,7 @@ import { UploadedFile } from './uploaded-file.js';
|
|
|
18
18
|
* - `Readable` (Node.js/Bun readable stream)
|
|
19
19
|
* - `Response` (from `window.fetch`)
|
|
20
20
|
*/
|
|
21
|
-
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response
|
|
21
|
+
export type UploadFileLike = URL | Uint8Array | File | Blob | string | IReadable | AnyToNever<import('node:fs').ReadStream> | AnyToNever<ReadableStream<Uint8Array>> | AnyToNever<NodeJS.ReadableStream> | AnyToNever<Response>;
|
|
22
22
|
/**
|
|
23
23
|
* Describes types that can be used as an input
|
|
24
24
|
* to any methods that send media (like {@link TelegramClient.sendPhoto})
|
|
@@ -7,7 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const inspectable = require("../../utils/inspectable.cjs");
|
|
9
9
|
const memoize = require("../../utils/memoize.cjs");
|
|
10
|
-
const
|
|
10
|
+
const peer = require("../peers/peer.cjs");
|
|
11
11
|
class TodoItem {
|
|
12
12
|
constructor(raw, _peers, completion) {
|
|
13
13
|
this.raw = raw;
|
|
@@ -25,9 +25,9 @@ class TodoItem {
|
|
|
25
25
|
}
|
|
26
26
|
get completedBy() {
|
|
27
27
|
if (!this.completion) return null;
|
|
28
|
-
const peer =
|
|
29
|
-
if (!peer) return null;
|
|
30
|
-
return
|
|
28
|
+
const peer$1 = peer.parsePeer(this.completion.completedBy, this._peers);
|
|
29
|
+
if (!peer$1) return null;
|
|
30
|
+
return peer$1;
|
|
31
31
|
}
|
|
32
32
|
get completedDate() {
|
|
33
33
|
if (!this.completion) return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
import { TextWithEntities } from '../misc/entities.js';
|
|
3
|
+
import { Peer } from '../peers/peer.js';
|
|
3
4
|
import { PeersIndex } from '../peers/peers-index.js';
|
|
4
|
-
import { User } from '../peers/user.js';
|
|
5
5
|
export declare class TodoItem {
|
|
6
6
|
readonly raw: tl.TypeTodoItem;
|
|
7
7
|
readonly _peers: PeersIndex;
|
|
@@ -10,7 +10,7 @@ export declare class TodoItem {
|
|
|
10
10
|
get id(): number;
|
|
11
11
|
get text(): TextWithEntities;
|
|
12
12
|
get isCompleted(): boolean;
|
|
13
|
-
get completedBy():
|
|
13
|
+
get completedBy(): Peer | null;
|
|
14
14
|
get completedDate(): Date | null;
|
|
15
15
|
}
|
|
16
16
|
export declare class TodoList {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tl } from '@mtcute/tl';
|
|
2
2
|
import { TextWithEntities } from '../misc/entities.js';
|
|
3
|
+
import { Peer } from '../peers/peer.js';
|
|
3
4
|
import { PeersIndex } from '../peers/peers-index.js';
|
|
4
|
-
import { User } from '../peers/user.js';
|
|
5
5
|
export declare class TodoItem {
|
|
6
6
|
readonly raw: tl.TypeTodoItem;
|
|
7
7
|
readonly _peers: PeersIndex;
|
|
@@ -10,7 +10,7 @@ export declare class TodoItem {
|
|
|
10
10
|
get id(): number;
|
|
11
11
|
get text(): TextWithEntities;
|
|
12
12
|
get isCompleted(): boolean;
|
|
13
|
-
get completedBy():
|
|
13
|
+
get completedBy(): Peer | null;
|
|
14
14
|
get completedDate(): Date | null;
|
|
15
15
|
}
|
|
16
16
|
export declare class TodoList {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { makeInspectable } from "../../utils/inspectable.js";
|
|
2
2
|
import { memoizeGetters } from "../../utils/memoize.js";
|
|
3
|
-
import {
|
|
3
|
+
import { parsePeer } from "../peers/peer.js";
|
|
4
4
|
class TodoItem {
|
|
5
5
|
constructor(raw, _peers, completion) {
|
|
6
6
|
this.raw = raw;
|
|
@@ -18,9 +18,9 @@ class TodoItem {
|
|
|
18
18
|
}
|
|
19
19
|
get completedBy() {
|
|
20
20
|
if (!this.completion) return null;
|
|
21
|
-
const peer =
|
|
21
|
+
const peer = parsePeer(this.completion.completedBy, this._peers);
|
|
22
22
|
if (!peer) return null;
|
|
23
|
-
return
|
|
23
|
+
return peer;
|
|
24
24
|
}
|
|
25
25
|
get completedDate() {
|
|
26
26
|
if (!this.completion) return null;
|
|
@@ -10,8 +10,8 @@ const Long = require("long");
|
|
|
10
10
|
const peerUtils = require("../../../utils/peer-utils.cjs");
|
|
11
11
|
const photo = require("../media/photo.cjs");
|
|
12
12
|
const peer = require("../peers/peer.cjs");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const starGiftUnique = require("../premium/star-gift-unique.cjs");
|
|
14
|
+
const starGift = require("../premium/star-gift.cjs");
|
|
15
15
|
function _messageActionFromTl(act) {
|
|
16
16
|
switch (act._) {
|
|
17
17
|
case "messageActionChatCreate":
|
|
@@ -188,7 +188,7 @@ function _messageActionFromTl(act) {
|
|
|
188
188
|
utils.assert(act.theme.gift._ === "starGiftUnique");
|
|
189
189
|
return {
|
|
190
190
|
type: "theme_changed_unique",
|
|
191
|
-
gift: new
|
|
191
|
+
gift: new starGiftUnique.StarGiftUnique(act.theme.gift, this._peers),
|
|
192
192
|
themeSettings: act.theme.themeSettings
|
|
193
193
|
};
|
|
194
194
|
}
|
|
@@ -216,7 +216,7 @@ function _messageActionFromTl(act) {
|
|
|
216
216
|
type: "premium_gifted",
|
|
217
217
|
currency: act.currency,
|
|
218
218
|
amount: act.amount.toNumber(),
|
|
219
|
-
|
|
219
|
+
days: act.days,
|
|
220
220
|
crypto: act.cryptoAmount ? {
|
|
221
221
|
currency: act.cryptoCurrency,
|
|
222
222
|
amount: act.cryptoAmount.toNumber()
|
|
@@ -295,13 +295,12 @@ function _messageActionFromTl(act) {
|
|
|
295
295
|
boostPeer: peer.parsePeer(act.boostPeer, this._peers),
|
|
296
296
|
giveawayMessageId: act.giveawayMsgId
|
|
297
297
|
};
|
|
298
|
-
// todo: cleanup in the next breaking update
|
|
299
298
|
case "messageActionStarGift":
|
|
300
299
|
utils.assert(act.gift._ === "starGift");
|
|
301
300
|
if (act.prepaidUpgrade) {
|
|
302
301
|
return {
|
|
303
302
|
type: "star_gift_upgrade_paid",
|
|
304
|
-
gift: new
|
|
303
|
+
gift: new starGift.StarGift(act.gift, this._peers),
|
|
305
304
|
giftMsgId: act.giftMsgId ?? void 0,
|
|
306
305
|
upgradeMsgId: act.upgradeMsgId ?? null
|
|
307
306
|
};
|
|
@@ -313,12 +312,14 @@ function _messageActionFromTl(act) {
|
|
|
313
312
|
converted: act.converted,
|
|
314
313
|
convertStars: act.convertStars ?? Long.ZERO,
|
|
315
314
|
refunded: act.refunded,
|
|
316
|
-
gift: new
|
|
315
|
+
gift: new starGift.StarGift(act.gift, this._peers),
|
|
317
316
|
message: act.message ?? null,
|
|
318
317
|
canUpgrade: act.canUpgrade,
|
|
319
318
|
upgraded: act.upgraded,
|
|
320
319
|
upgradeStars: act.upgradeStars ?? Long.ZERO,
|
|
321
320
|
upgradeMsgId: act.upgradeMsgId ?? null,
|
|
321
|
+
fromAuction: act.auctionAcquired,
|
|
322
|
+
toId: act.toId ? peer.parsePeer(act.toId, this._peers) : null,
|
|
322
323
|
savedId: act.savedId,
|
|
323
324
|
prepaidUpgradeHash: act.prepaidUpgradeHash ?? void 0
|
|
324
325
|
};
|
|
@@ -327,7 +328,7 @@ function _messageActionFromTl(act) {
|
|
|
327
328
|
const common = {
|
|
328
329
|
saved: act.saved,
|
|
329
330
|
refunded: act.refunded,
|
|
330
|
-
gift: new
|
|
331
|
+
gift: new starGiftUnique.StarGiftUnique(act.gift, this._peers),
|
|
331
332
|
canTransferAt: act.canTransferAt ? new Date(act.canTransferAt * 1e3) : void 0,
|
|
332
333
|
canResellAt: act.canResellAt ? new Date(act.canResellAt * 1e3) : void 0,
|
|
333
334
|
canExportAt: act.canExportAt ? new Date(act.canExportAt * 1e3) : void 0,
|
|
@@ -3,8 +3,8 @@ import { TextWithEntities } from '../misc/entities.js';
|
|
|
3
3
|
import { Peer } from '../peers/peer.js';
|
|
4
4
|
import { Message } from './message.js';
|
|
5
5
|
import { Photo } from '../media/photo.js';
|
|
6
|
-
import { StarGiftUnique } from '../premium/
|
|
7
|
-
import { StarGift } from '../premium/
|
|
6
|
+
import { StarGiftUnique } from '../premium/star-gift-unique.js';
|
|
7
|
+
import { StarGift } from '../premium/star-gift.js';
|
|
8
8
|
/** Group was created */
|
|
9
9
|
export interface ActionChatCreated {
|
|
10
10
|
readonly type: 'chat_created';
|
|
@@ -281,8 +281,8 @@ export interface ActionPremiumGifted {
|
|
|
281
281
|
* `US$ 1.45`, `amount = 145`
|
|
282
282
|
*/
|
|
283
283
|
amount: number;
|
|
284
|
-
/** Duration of the gifted subscription in
|
|
285
|
-
|
|
284
|
+
/** Duration of the gifted subscription in days */
|
|
285
|
+
days: number;
|
|
286
286
|
/** If the subscription was bought with crypto, information about it */
|
|
287
287
|
crypto?: {
|
|
288
288
|
/** Crypto currency name */
|
|
@@ -435,6 +435,10 @@ export interface ActionStarGiftSent {
|
|
|
435
435
|
upgradeStars: tl.Long;
|
|
436
436
|
/** If the gift was upgraded, ID of the message where this happened */
|
|
437
437
|
upgradeMsgId: number | null;
|
|
438
|
+
/** Whether this gift was purchased on an auction */
|
|
439
|
+
fromAuction: boolean;
|
|
440
|
+
/** Recipient of the gift */
|
|
441
|
+
toId: Peer | null;
|
|
438
442
|
/** ID of the related saved profile gift */
|
|
439
443
|
savedId?: tl.Long;
|
|
440
444
|
/** If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade` */
|
|
@@ -3,8 +3,8 @@ import { TextWithEntities } from '../misc/entities.js';
|
|
|
3
3
|
import { Peer } from '../peers/peer.js';
|
|
4
4
|
import { Message } from './message.js';
|
|
5
5
|
import { Photo } from '../media/photo.js';
|
|
6
|
-
import { StarGiftUnique } from '../premium/
|
|
7
|
-
import { StarGift } from '../premium/
|
|
6
|
+
import { StarGiftUnique } from '../premium/star-gift-unique.js';
|
|
7
|
+
import { StarGift } from '../premium/star-gift.js';
|
|
8
8
|
/** Group was created */
|
|
9
9
|
export interface ActionChatCreated {
|
|
10
10
|
readonly type: 'chat_created';
|
|
@@ -281,8 +281,8 @@ export interface ActionPremiumGifted {
|
|
|
281
281
|
* `US$ 1.45`, `amount = 145`
|
|
282
282
|
*/
|
|
283
283
|
amount: number;
|
|
284
|
-
/** Duration of the gifted subscription in
|
|
285
|
-
|
|
284
|
+
/** Duration of the gifted subscription in days */
|
|
285
|
+
days: number;
|
|
286
286
|
/** If the subscription was bought with crypto, information about it */
|
|
287
287
|
crypto?: {
|
|
288
288
|
/** Crypto currency name */
|
|
@@ -435,6 +435,10 @@ export interface ActionStarGiftSent {
|
|
|
435
435
|
upgradeStars: tl.Long;
|
|
436
436
|
/** If the gift was upgraded, ID of the message where this happened */
|
|
437
437
|
upgradeMsgId: number | null;
|
|
438
|
+
/** Whether this gift was purchased on an auction */
|
|
439
|
+
fromAuction: boolean;
|
|
440
|
+
/** Recipient of the gift */
|
|
441
|
+
toId: Peer | null;
|
|
438
442
|
/** ID of the related saved profile gift */
|
|
439
443
|
savedId?: tl.Long;
|
|
440
444
|
/** If available, you can pay for this gift's upgrade by passing this hash to `prepayStarGiftUpgrade` */
|
|
@@ -3,8 +3,8 @@ import Long from "long";
|
|
|
3
3
|
import { getMarkedPeerId } from "../../../utils/peer-utils.js";
|
|
4
4
|
import { Photo as Photo$2 } from "../media/photo.js";
|
|
5
5
|
import { parsePeer } from "../peers/peer.js";
|
|
6
|
-
import { StarGiftUnique as StarGiftUnique$2 } from "../premium/
|
|
7
|
-
import { StarGift as StarGift$2 } from "../premium/
|
|
6
|
+
import { StarGiftUnique as StarGiftUnique$2 } from "../premium/star-gift-unique.js";
|
|
7
|
+
import { StarGift as StarGift$2 } from "../premium/star-gift.js";
|
|
8
8
|
function _messageActionFromTl(act) {
|
|
9
9
|
switch (act._) {
|
|
10
10
|
case "messageActionChatCreate":
|
|
@@ -209,7 +209,7 @@ function _messageActionFromTl(act) {
|
|
|
209
209
|
type: "premium_gifted",
|
|
210
210
|
currency: act.currency,
|
|
211
211
|
amount: act.amount.toNumber(),
|
|
212
|
-
|
|
212
|
+
days: act.days,
|
|
213
213
|
crypto: act.cryptoAmount ? {
|
|
214
214
|
currency: act.cryptoCurrency,
|
|
215
215
|
amount: act.cryptoAmount.toNumber()
|
|
@@ -288,7 +288,6 @@ function _messageActionFromTl(act) {
|
|
|
288
288
|
boostPeer: parsePeer(act.boostPeer, this._peers),
|
|
289
289
|
giveawayMessageId: act.giveawayMsgId
|
|
290
290
|
};
|
|
291
|
-
// todo: cleanup in the next breaking update
|
|
292
291
|
case "messageActionStarGift":
|
|
293
292
|
assert(act.gift._ === "starGift");
|
|
294
293
|
if (act.prepaidUpgrade) {
|
|
@@ -312,6 +311,8 @@ function _messageActionFromTl(act) {
|
|
|
312
311
|
upgraded: act.upgraded,
|
|
313
312
|
upgradeStars: act.upgradeStars ?? Long.ZERO,
|
|
314
313
|
upgradeMsgId: act.upgradeMsgId ?? null,
|
|
314
|
+
fromAuction: act.auctionAcquired,
|
|
315
|
+
toId: act.toId ? parsePeer(act.toId, this._peers) : null,
|
|
315
316
|
savedId: act.savedId,
|
|
316
317
|
prepaidUpgradeHash: act.prepaidUpgradeHash ?? void 0
|
|
317
318
|
};
|
|
@@ -107,6 +107,10 @@ class Message {
|
|
|
107
107
|
get isFromScheduled() {
|
|
108
108
|
return this.raw._ === "message" && this.raw.fromScheduled;
|
|
109
109
|
}
|
|
110
|
+
/** If this message is a scheduled message, the repeat period in seconds */
|
|
111
|
+
get scheduleRepeatPeriod() {
|
|
112
|
+
return this.raw._ === "message" ? this.raw.scheduleRepeatPeriod ?? null : null;
|
|
113
|
+
}
|
|
110
114
|
/** Whether the message is pinned in the current chat */
|
|
111
115
|
get isPinned() {
|
|
112
116
|
return this.raw._ === "message" && this.raw.pinned;
|
|
@@ -82,6 +82,8 @@ export declare class Message {
|
|
|
82
82
|
* **Note**: for messages sent by other users, this is always `false`.
|
|
83
83
|
*/
|
|
84
84
|
get isFromScheduled(): boolean;
|
|
85
|
+
/** If this message is a scheduled message, the repeat period in seconds */
|
|
86
|
+
get scheduleRepeatPeriod(): number | null;
|
|
85
87
|
/** Whether the message is pinned in the current chat */
|
|
86
88
|
get isPinned(): boolean;
|
|
87
89
|
/** Whether the message should be considered unedited, even if {@link editDate} ≠ null */
|
|
@@ -82,6 +82,8 @@ export declare class Message {
|
|
|
82
82
|
* **Note**: for messages sent by other users, this is always `false`.
|
|
83
83
|
*/
|
|
84
84
|
get isFromScheduled(): boolean;
|
|
85
|
+
/** If this message is a scheduled message, the repeat period in seconds */
|
|
86
|
+
get scheduleRepeatPeriod(): number | null;
|
|
85
87
|
/** Whether the message is pinned in the current chat */
|
|
86
88
|
get isPinned(): boolean;
|
|
87
89
|
/** Whether the message should be considered unedited, even if {@link editDate} ≠ null */
|
|
@@ -100,6 +100,10 @@ class Message {
|
|
|
100
100
|
get isFromScheduled() {
|
|
101
101
|
return this.raw._ === "message" && this.raw.fromScheduled;
|
|
102
102
|
}
|
|
103
|
+
/** If this message is a scheduled message, the repeat period in seconds */
|
|
104
|
+
get scheduleRepeatPeriod() {
|
|
105
|
+
return this.raw._ === "message" ? this.raw.scheduleRepeatPeriod ?? null : null;
|
|
106
|
+
}
|
|
103
107
|
/** Whether the message is pinned in the current chat */
|
|
104
108
|
get isPinned() {
|
|
105
109
|
return this.raw._ === "message" && this.raw.pinned;
|