@mtcute/core 0.19.7 → 0.20.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/client.cjs +24 -0
- package/client.js +24 -0
- package/highlevel/base.cjs +2 -2
- package/highlevel/base.js +2 -2
- package/highlevel/client.d.cts +68 -9
- package/highlevel/client.d.ts +68 -9
- package/highlevel/methods/files/normalize-input-media.cjs +12 -2
- package/highlevel/methods/files/normalize-input-media.js +12 -2
- package/highlevel/methods/messages/forward-messages.cjs +4 -2
- package/highlevel/methods/messages/forward-messages.d.cts +2 -0
- package/highlevel/methods/messages/forward-messages.d.ts +2 -0
- package/highlevel/methods/messages/forward-messages.js +4 -2
- package/highlevel/methods/premium/_normalize-input-star-gift.cjs +23 -0
- package/highlevel/methods/premium/_normalize-input-star-gift.d.cts +4 -0
- package/highlevel/methods/premium/_normalize-input-star-gift.d.ts +4 -0
- package/highlevel/methods/premium/_normalize-input-star-gift.js +18 -0
- package/highlevel/methods/premium/accept-star-gift.cjs +4 -3
- package/highlevel/methods/premium/accept-star-gift.d.cts +3 -3
- package/highlevel/methods/premium/accept-star-gift.d.ts +3 -3
- package/highlevel/methods/premium/accept-star-gift.js +4 -3
- package/highlevel/methods/premium/get-saved-star-gifts-by-id.cjs +21 -0
- package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.cts +6 -0
- package/highlevel/methods/premium/get-saved-star-gifts-by-id.d.ts +6 -0
- package/highlevel/methods/premium/get-saved-star-gifts-by-id.js +16 -0
- package/highlevel/methods/premium/get-saved-star-gifts.cjs +32 -0
- package/highlevel/methods/premium/get-saved-star-gifts.d.cts +24 -0
- package/highlevel/methods/premium/get-saved-star-gifts.d.ts +24 -0
- package/highlevel/methods/premium/get-saved-star-gifts.js +27 -0
- package/highlevel/methods/premium/get-star-gift-withdrawal-url.cjs +23 -0
- package/highlevel/methods/premium/get-star-gift-withdrawal-url.d.cts +8 -0
- package/highlevel/methods/premium/get-star-gift-withdrawal-url.d.ts +8 -0
- package/highlevel/methods/premium/get-star-gift-withdrawal-url.js +18 -0
- package/highlevel/methods/premium/get-unique-star-gift.cjs +20 -0
- package/highlevel/methods/premium/get-unique-star-gift.d.cts +6 -0
- package/highlevel/methods/premium/get-unique-star-gift.d.ts +6 -0
- package/highlevel/methods/premium/get-unique-star-gift.js +15 -0
- package/highlevel/methods/premium/iter-saved-star-gifts.cjs +33 -0
- package/highlevel/methods/premium/iter-saved-star-gifts.d.cts +27 -0
- package/highlevel/methods/premium/iter-saved-star-gifts.d.ts +27 -0
- package/highlevel/methods/premium/iter-saved-star-gifts.js +28 -0
- package/highlevel/methods/premium/send-star-gift.cjs +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/methods/premium/send-star-gift.js +3 -3
- package/highlevel/methods/premium/transfer-star-gift.cjs +4 -4
- package/highlevel/methods/premium/transfer-star-gift.d.cts +3 -3
- package/highlevel/methods/premium/transfer-star-gift.d.ts +3 -3
- package/highlevel/methods/premium/transfer-star-gift.js +5 -5
- package/highlevel/methods/premium/upgrade-star-gift.cjs +3 -3
- package/highlevel/methods/premium/upgrade-star-gift.d.cts +2 -2
- package/highlevel/methods/premium/upgrade-star-gift.d.ts +2 -2
- package/highlevel/methods/premium/upgrade-star-gift.js +3 -3
- package/highlevel/methods/users/set-emoji-status.cjs +8 -1
- package/highlevel/methods/users/set-emoji-status.d.cts +2 -0
- package/highlevel/methods/users/set-emoji-status.d.ts +2 -0
- package/highlevel/methods/users/set-emoji-status.js +8 -1
- package/highlevel/methods.d.cts +6 -0
- package/highlevel/methods.d.ts +6 -0
- package/highlevel/types/media/input-media/types.d.cts +4 -0
- package/highlevel/types/media/input-media/types.d.ts +4 -0
- package/highlevel/types/media/video.cjs +8 -0
- package/highlevel/types/media/video.d.cts +3 -0
- package/highlevel/types/media/video.d.ts +3 -0
- package/highlevel/types/media/video.js +8 -0
- package/highlevel/types/messages/message-action.cjs +22 -1
- package/highlevel/types/messages/message-action.d.cts +4 -0
- package/highlevel/types/messages/message-action.d.ts +4 -0
- package/highlevel/types/messages/message-action.js +22 -1
- package/highlevel/types/peers/chat.cjs +3 -1
- package/highlevel/types/peers/chat.js +3 -1
- package/highlevel/types/peers/full-chat.cjs +8 -0
- package/highlevel/types/peers/full-chat.d.cts +4 -0
- package/highlevel/types/peers/full-chat.d.ts +4 -0
- package/highlevel/types/peers/full-chat.js +8 -0
- package/highlevel/types/peers/user.cjs +3 -1
- package/highlevel/types/peers/user.js +3 -1
- package/highlevel/types/premium/index.d.cts +1 -0
- package/highlevel/types/premium/index.d.ts +1 -0
- package/highlevel/types/premium/saved-star-gift.cjs +80 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +39 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +39 -0
- package/highlevel/types/premium/saved-star-gift.js +75 -0
- package/highlevel/types/premium/stars-gift-unique.cjs +18 -5
- package/highlevel/types/premium/stars-gift-unique.d.cts +11 -5
- package/highlevel/types/premium/stars-gift-unique.d.ts +11 -5
- package/highlevel/types/premium/stars-gift-unique.js +18 -5
- package/highlevel/types/premium/stars-gift.d.cts +12 -1
- package/highlevel/types/premium/stars-gift.d.ts +12 -1
- package/highlevel/types/reactions/emoji-status.cjs +38 -1
- package/highlevel/types/reactions/emoji-status.d.cts +23 -2
- package/highlevel/types/reactions/emoji-status.d.ts +23 -2
- package/highlevel/types/reactions/emoji-status.js +39 -2
- package/highlevel/types/stories/interactive/index.cjs +4 -0
- package/highlevel/types/stories/interactive/index.d.cts +3 -2
- package/highlevel/types/stories/interactive/index.d.ts +3 -2
- package/highlevel/types/stories/interactive/index.js +4 -0
- package/highlevel/types/stories/interactive/star-gift.cjs +22 -0
- package/highlevel/types/stories/interactive/star-gift.d.cts +12 -0
- package/highlevel/types/stories/interactive/star-gift.d.ts +12 -0
- package/highlevel/types/stories/interactive/star-gift.js +17 -0
- package/highlevel/updates/manager.cjs +11 -9
- package/highlevel/updates/manager.d.cts +1 -3
- package/highlevel/updates/manager.d.ts +1 -3
- package/highlevel/updates/manager.js +11 -9
- package/index.cjs +5 -0
- package/index.js +6 -1
- package/methods.cjs +12 -0
- package/methods.js +12 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +2 -2
|
@@ -5,17 +5,18 @@ 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 _normalizeInputStarGift = require("./_normalize-input-star-gift.cjs");
|
|
8
9
|
async function acceptStarGift(client, params) {
|
|
9
10
|
const { action } = params;
|
|
10
|
-
const
|
|
11
|
+
const inputStarGift = await _normalizeInputStarGift._normalizeInputStarGift(client, params.gift);
|
|
11
12
|
return client.call(
|
|
12
13
|
action === "convert" ? {
|
|
13
14
|
_: "payments.convertStarGift",
|
|
14
|
-
|
|
15
|
+
stargift: inputStarGift
|
|
15
16
|
} : {
|
|
16
17
|
_: "payments.saveStarGift",
|
|
17
18
|
unsave: action === "hide",
|
|
18
|
-
|
|
19
|
+
stargift: inputStarGift
|
|
19
20
|
}
|
|
20
21
|
);
|
|
21
22
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { InputStarGift } from '../../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Accept, hide or convert a star gift.
|
|
5
5
|
*
|
|
6
6
|
* @returns Whether the action was successful
|
|
7
7
|
*/
|
|
8
8
|
export declare function acceptStarGift(client: ITelegramClient, params: {
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/** Input star gift to accept */
|
|
10
|
+
gift: InputStarGift;
|
|
11
11
|
/**
|
|
12
12
|
* Action to perform on the gift.
|
|
13
13
|
* - `save` - save the gift to your profile
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
-
import {
|
|
2
|
+
import { InputStarGift } from '../../types/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Accept, hide or convert a star gift.
|
|
5
5
|
*
|
|
6
6
|
* @returns Whether the action was successful
|
|
7
7
|
*/
|
|
8
8
|
export declare function acceptStarGift(client: ITelegramClient, params: {
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/** Input star gift to accept */
|
|
10
|
+
gift: InputStarGift;
|
|
11
11
|
/**
|
|
12
12
|
* Action to perform on the gift.
|
|
13
13
|
* - `save` - save the gift to your profile
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { _normalizeInputStarGift } from "./_normalize-input-star-gift.js";
|
|
1
2
|
async function acceptStarGift(client, params) {
|
|
2
3
|
const { action } = params;
|
|
3
|
-
const
|
|
4
|
+
const inputStarGift = await _normalizeInputStarGift(client, params.gift);
|
|
4
5
|
return client.call(
|
|
5
6
|
action === "convert" ? {
|
|
6
7
|
_: "payments.convertStarGift",
|
|
7
|
-
|
|
8
|
+
stargift: inputStarGift
|
|
8
9
|
} : {
|
|
9
10
|
_: "payments.saveStarGift",
|
|
10
11
|
unsave: action === "hide",
|
|
11
|
-
|
|
12
|
+
stargift: inputStarGift
|
|
12
13
|
}
|
|
13
14
|
);
|
|
14
15
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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 utils = require("@fuman/utils");
|
|
9
|
+
const _normalizeInputStarGift = require("./_normalize-input-star-gift.cjs");
|
|
10
|
+
const savedStarGift = require("../../types/premium/saved-star-gift.cjs");
|
|
11
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
12
|
+
async function getSavedStarGiftsById(client, gifts) {
|
|
13
|
+
if (!Array.isArray(gifts)) gifts = [gifts];
|
|
14
|
+
const res = await client.call({
|
|
15
|
+
_: "payments.getSavedStarGift",
|
|
16
|
+
stargift: await utils.parallelMap(gifts, (it) => _normalizeInputStarGift._normalizeInputStarGift(client, it), { limit: 10 })
|
|
17
|
+
});
|
|
18
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
19
|
+
return res.gifts.map((it) => new savedStarGift.SavedStarGift(it, peers));
|
|
20
|
+
}
|
|
21
|
+
exports.getSavedStarGiftsById = getSavedStarGiftsById;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputStarGift } from '../../types/premium/stars-gift.js';
|
|
3
|
+
import { MaybeArray } from '@fuman/utils';
|
|
4
|
+
import { SavedStarGift } from '../../types/index.js';
|
|
5
|
+
/** Get one or more saved star gifts by their IDs */
|
|
6
|
+
export declare function getSavedStarGiftsById(client: ITelegramClient, gifts: MaybeArray<InputStarGift>): Promise<SavedStarGift[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputStarGift } from '../../types/premium/stars-gift.js';
|
|
3
|
+
import { MaybeArray } from '@fuman/utils';
|
|
4
|
+
import { SavedStarGift } from '../../types/index.js';
|
|
5
|
+
/** Get one or more saved star gifts by their IDs */
|
|
6
|
+
export declare function getSavedStarGiftsById(client: ITelegramClient, gifts: MaybeArray<InputStarGift>): Promise<SavedStarGift[]>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { parallelMap } from "@fuman/utils";
|
|
2
|
+
import { _normalizeInputStarGift } from "./_normalize-input-star-gift.js";
|
|
3
|
+
import { SavedStarGift as SavedStarGift$2 } from "../../types/premium/saved-star-gift.js";
|
|
4
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
5
|
+
async function getSavedStarGiftsById(client, gifts) {
|
|
6
|
+
if (!Array.isArray(gifts)) gifts = [gifts];
|
|
7
|
+
const res = await client.call({
|
|
8
|
+
_: "payments.getSavedStarGift",
|
|
9
|
+
stargift: await parallelMap(gifts, (it) => _normalizeInputStarGift(client, it), { limit: 10 })
|
|
10
|
+
});
|
|
11
|
+
const peers = PeersIndex.from(res);
|
|
12
|
+
return res.gifts.map((it) => new SavedStarGift$2(it, peers));
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getSavedStarGiftsById
|
|
16
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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 savedStarGift = require("../../types/premium/saved-star-gift.cjs");
|
|
9
|
+
const miscUtils = require("../../utils/misc-utils.cjs");
|
|
10
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
11
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
12
|
+
async function getSavedStarGifts(client, params) {
|
|
13
|
+
const res = await client.call({
|
|
14
|
+
_: "payments.getSavedStarGifts",
|
|
15
|
+
peer: await resolvePeer.resolvePeer(client, params.owner),
|
|
16
|
+
excludeUnsaved: params.excludeHidden,
|
|
17
|
+
excludeSaved: params.excludePublic,
|
|
18
|
+
excludeUnlimited: params.excludeUnlimited,
|
|
19
|
+
excludeLimited: params.excludeLimited,
|
|
20
|
+
excludeUnique: params.excludeUnique,
|
|
21
|
+
sortByValue: params.sortByValue,
|
|
22
|
+
offset: params.offset ?? "",
|
|
23
|
+
limit: params.limit ?? 100
|
|
24
|
+
});
|
|
25
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
26
|
+
return miscUtils.makeArrayPaginated(
|
|
27
|
+
res.gifts.map((it) => new savedStarGift.SavedStarGift(it, peers)),
|
|
28
|
+
res.count,
|
|
29
|
+
res.nextOffset
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
exports.getSavedStarGifts = getSavedStarGifts;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { ArrayPaginated, InputPeerLike } from '../../types/index.js';
|
|
3
|
+
import { SavedStarGift } from '../../types/premium/saved-star-gift.js';
|
|
4
|
+
/** Get a list of saved star gifts of a user */
|
|
5
|
+
export declare function getSavedStarGifts(client: ITelegramClient, params: {
|
|
6
|
+
/** Peer to get saved gifts from */
|
|
7
|
+
owner: InputPeerLike;
|
|
8
|
+
/** Whether to exclude hidden gifts */
|
|
9
|
+
excludeHidden?: boolean;
|
|
10
|
+
/** Whether to exclude publicly visible gifts */
|
|
11
|
+
excludePublic?: boolean;
|
|
12
|
+
/** Whether to exclude gifts with unlimited availability */
|
|
13
|
+
excludeUnlimited?: boolean;
|
|
14
|
+
/** Whether to exclude gifts with limited availability */
|
|
15
|
+
excludeLimited?: boolean;
|
|
16
|
+
/** Whether to exclude unique gifts */
|
|
17
|
+
excludeUnique?: boolean;
|
|
18
|
+
/** Whether to sort by value */
|
|
19
|
+
sortByValue?: boolean;
|
|
20
|
+
/** Offset for pagination */
|
|
21
|
+
offset?: string;
|
|
22
|
+
/** Limit for pagination */
|
|
23
|
+
limit?: number;
|
|
24
|
+
}): Promise<ArrayPaginated<SavedStarGift, string>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { ArrayPaginated, InputPeerLike } from '../../types/index.js';
|
|
3
|
+
import { SavedStarGift } from '../../types/premium/saved-star-gift.js';
|
|
4
|
+
/** Get a list of saved star gifts of a user */
|
|
5
|
+
export declare function getSavedStarGifts(client: ITelegramClient, params: {
|
|
6
|
+
/** Peer to get saved gifts from */
|
|
7
|
+
owner: InputPeerLike;
|
|
8
|
+
/** Whether to exclude hidden gifts */
|
|
9
|
+
excludeHidden?: boolean;
|
|
10
|
+
/** Whether to exclude publicly visible gifts */
|
|
11
|
+
excludePublic?: boolean;
|
|
12
|
+
/** Whether to exclude gifts with unlimited availability */
|
|
13
|
+
excludeUnlimited?: boolean;
|
|
14
|
+
/** Whether to exclude gifts with limited availability */
|
|
15
|
+
excludeLimited?: boolean;
|
|
16
|
+
/** Whether to exclude unique gifts */
|
|
17
|
+
excludeUnique?: boolean;
|
|
18
|
+
/** Whether to sort by value */
|
|
19
|
+
sortByValue?: boolean;
|
|
20
|
+
/** Offset for pagination */
|
|
21
|
+
offset?: string;
|
|
22
|
+
/** Limit for pagination */
|
|
23
|
+
limit?: number;
|
|
24
|
+
}): Promise<ArrayPaginated<SavedStarGift, string>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SavedStarGift as SavedStarGift$2 } from "../../types/premium/saved-star-gift.js";
|
|
2
|
+
import { makeArrayPaginated } from "../../utils/misc-utils.js";
|
|
3
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
4
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
5
|
+
async function getSavedStarGifts(client, params) {
|
|
6
|
+
const res = await client.call({
|
|
7
|
+
_: "payments.getSavedStarGifts",
|
|
8
|
+
peer: await resolvePeer(client, params.owner),
|
|
9
|
+
excludeUnsaved: params.excludeHidden,
|
|
10
|
+
excludeSaved: params.excludePublic,
|
|
11
|
+
excludeUnlimited: params.excludeUnlimited,
|
|
12
|
+
excludeLimited: params.excludeLimited,
|
|
13
|
+
excludeUnique: params.excludeUnique,
|
|
14
|
+
sortByValue: params.sortByValue,
|
|
15
|
+
offset: params.offset ?? "",
|
|
16
|
+
limit: params.limit ?? 100
|
|
17
|
+
});
|
|
18
|
+
const peers = PeersIndex.from(res);
|
|
19
|
+
return makeArrayPaginated(
|
|
20
|
+
res.gifts.map((it) => new SavedStarGift$2(it, peers)),
|
|
21
|
+
res.count,
|
|
22
|
+
res.nextOffset
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
getSavedStarGifts
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 _normalizeInputStarGift = require("./_normalize-input-star-gift.cjs");
|
|
9
|
+
async function getStarGiftWithdrawalUrl(client, params) {
|
|
10
|
+
const password = await client.computeSrpParams(
|
|
11
|
+
await client.call({
|
|
12
|
+
_: "account.getPassword"
|
|
13
|
+
}),
|
|
14
|
+
params.password
|
|
15
|
+
);
|
|
16
|
+
const res = await client.call({
|
|
17
|
+
_: "payments.getStarGiftWithdrawalUrl",
|
|
18
|
+
stargift: await _normalizeInputStarGift._normalizeInputStarGift(client, params.gift),
|
|
19
|
+
password
|
|
20
|
+
});
|
|
21
|
+
return res.url;
|
|
22
|
+
}
|
|
23
|
+
exports.getStarGiftWithdrawalUrl = getStarGiftWithdrawalUrl;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputStarGift } from '../../types/index.js';
|
|
3
|
+
export declare function getStarGiftWithdrawalUrl(client: ITelegramClient, params: {
|
|
4
|
+
/** The star gift to withdraw */
|
|
5
|
+
gift: InputStarGift;
|
|
6
|
+
/** 2FA password */
|
|
7
|
+
password: string;
|
|
8
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputStarGift } from '../../types/index.js';
|
|
3
|
+
export declare function getStarGiftWithdrawalUrl(client: ITelegramClient, params: {
|
|
4
|
+
/** The star gift to withdraw */
|
|
5
|
+
gift: InputStarGift;
|
|
6
|
+
/** 2FA password */
|
|
7
|
+
password: string;
|
|
8
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { _normalizeInputStarGift } from "./_normalize-input-star-gift.js";
|
|
2
|
+
async function getStarGiftWithdrawalUrl(client, params) {
|
|
3
|
+
const password = await client.computeSrpParams(
|
|
4
|
+
await client.call({
|
|
5
|
+
_: "account.getPassword"
|
|
6
|
+
}),
|
|
7
|
+
params.password
|
|
8
|
+
);
|
|
9
|
+
const res = await client.call({
|
|
10
|
+
_: "payments.getStarGiftWithdrawalUrl",
|
|
11
|
+
stargift: await _normalizeInputStarGift(client, params.gift),
|
|
12
|
+
password
|
|
13
|
+
});
|
|
14
|
+
return res.url;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
getStarGiftWithdrawalUrl
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 utils = require("@fuman/utils");
|
|
9
|
+
const starsGiftUnique = require("../../types/premium/stars-gift-unique.cjs");
|
|
10
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
11
|
+
async function getUniqueStarGift(client, slug) {
|
|
12
|
+
const res = await client.call({
|
|
13
|
+
_: "payments.getUniqueStarGift",
|
|
14
|
+
slug
|
|
15
|
+
});
|
|
16
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
17
|
+
utils.assert(res.gift._ === "starGiftUnique");
|
|
18
|
+
return new starsGiftUnique.StarGiftUnique(res.gift, peers);
|
|
19
|
+
}
|
|
20
|
+
exports.getUniqueStarGift = getUniqueStarGift;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { StarGiftUnique } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get information about a unique star gift by its slug
|
|
5
|
+
*/
|
|
6
|
+
export declare function getUniqueStarGift(client: ITelegramClient, slug: string): Promise<StarGiftUnique>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { StarGiftUnique } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get information about a unique star gift by its slug
|
|
5
|
+
*/
|
|
6
|
+
export declare function getUniqueStarGift(client: ITelegramClient, slug: string): Promise<StarGiftUnique>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { assert } from "@fuman/utils";
|
|
2
|
+
import { StarGiftUnique as StarGiftUnique$2 } from "../../types/premium/stars-gift-unique.js";
|
|
3
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
4
|
+
async function getUniqueStarGift(client, slug) {
|
|
5
|
+
const res = await client.call({
|
|
6
|
+
_: "payments.getUniqueStarGift",
|
|
7
|
+
slug
|
|
8
|
+
});
|
|
9
|
+
const peers = PeersIndex.from(res);
|
|
10
|
+
assert(res.gift._ === "starGiftUnique");
|
|
11
|
+
return new StarGiftUnique$2(res.gift, peers);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
getUniqueStarGift
|
|
15
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 savedStarGift = require("../../types/premium/saved-star-gift.cjs");
|
|
9
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
10
|
+
const peersIndex = require("../../types/peers/peers-index.cjs");
|
|
11
|
+
async function* iterSavedStarGifts(client, params) {
|
|
12
|
+
const owner = await resolvePeer.resolvePeer(client, params.owner);
|
|
13
|
+
let offset = "";
|
|
14
|
+
while (true) {
|
|
15
|
+
const res = await client.call({
|
|
16
|
+
_: "payments.getSavedStarGifts",
|
|
17
|
+
peer: owner,
|
|
18
|
+
excludeUnsaved: params.excludeUnsaved,
|
|
19
|
+
excludeSaved: params.excludeSaved,
|
|
20
|
+
excludeUnlimited: params.excludeUnlimited,
|
|
21
|
+
excludeLimited: params.excludeLimited,
|
|
22
|
+
excludeUnique: params.excludeUnique,
|
|
23
|
+
sortByValue: params.sortByValue,
|
|
24
|
+
offset,
|
|
25
|
+
limit: params.limit ?? 100
|
|
26
|
+
});
|
|
27
|
+
const peers = peersIndex.PeersIndex.from(res);
|
|
28
|
+
yield* res.gifts.map((it) => new savedStarGift.SavedStarGift(it, peers));
|
|
29
|
+
if (!res.nextOffset) break;
|
|
30
|
+
offset = res.nextOffset;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.iterSavedStarGifts = iterSavedStarGifts;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
import { SavedStarGift } from '../../types/premium/saved-star-gift.js';
|
|
4
|
+
/**
|
|
5
|
+
* Iterate over saved star gifts of a user,
|
|
6
|
+
* wrapper over {@link getSavedStarGifts}
|
|
7
|
+
*/
|
|
8
|
+
export declare function iterSavedStarGifts(client: ITelegramClient, params: {
|
|
9
|
+
/** Peer to get saved gifts from */
|
|
10
|
+
owner: InputPeerLike;
|
|
11
|
+
/** Whether to exclude unsaved gifts */
|
|
12
|
+
excludeUnsaved?: boolean;
|
|
13
|
+
/** Whether to exclude saved gifts */
|
|
14
|
+
excludeSaved?: boolean;
|
|
15
|
+
/** Whether to exclude gifts with unlimited availability */
|
|
16
|
+
excludeUnlimited?: boolean;
|
|
17
|
+
/** Whether to exclude gifts with limited availability */
|
|
18
|
+
excludeLimited?: boolean;
|
|
19
|
+
/** Whether to exclude unique gifts */
|
|
20
|
+
excludeUnique?: boolean;
|
|
21
|
+
/** Whether to sort by value */
|
|
22
|
+
sortByValue?: boolean;
|
|
23
|
+
/** Offset for pagination */
|
|
24
|
+
offset?: string;
|
|
25
|
+
/** Limit for pagination */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}): AsyncIterableIterator<SavedStarGift>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { InputPeerLike } from '../../types/index.js';
|
|
3
|
+
import { SavedStarGift } from '../../types/premium/saved-star-gift.js';
|
|
4
|
+
/**
|
|
5
|
+
* Iterate over saved star gifts of a user,
|
|
6
|
+
* wrapper over {@link getSavedStarGifts}
|
|
7
|
+
*/
|
|
8
|
+
export declare function iterSavedStarGifts(client: ITelegramClient, params: {
|
|
9
|
+
/** Peer to get saved gifts from */
|
|
10
|
+
owner: InputPeerLike;
|
|
11
|
+
/** Whether to exclude unsaved gifts */
|
|
12
|
+
excludeUnsaved?: boolean;
|
|
13
|
+
/** Whether to exclude saved gifts */
|
|
14
|
+
excludeSaved?: boolean;
|
|
15
|
+
/** Whether to exclude gifts with unlimited availability */
|
|
16
|
+
excludeUnlimited?: boolean;
|
|
17
|
+
/** Whether to exclude gifts with limited availability */
|
|
18
|
+
excludeLimited?: boolean;
|
|
19
|
+
/** Whether to exclude unique gifts */
|
|
20
|
+
excludeUnique?: boolean;
|
|
21
|
+
/** Whether to sort by value */
|
|
22
|
+
sortByValue?: boolean;
|
|
23
|
+
/** Offset for pagination */
|
|
24
|
+
offset?: string;
|
|
25
|
+
/** Limit for pagination */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}): AsyncIterableIterator<SavedStarGift>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SavedStarGift as SavedStarGift$2 } from "../../types/premium/saved-star-gift.js";
|
|
2
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
3
|
+
import { PeersIndex } from "../../types/peers/peers-index.js";
|
|
4
|
+
async function* iterSavedStarGifts(client, params) {
|
|
5
|
+
const owner = await resolvePeer(client, params.owner);
|
|
6
|
+
let offset = "";
|
|
7
|
+
while (true) {
|
|
8
|
+
const res = await client.call({
|
|
9
|
+
_: "payments.getSavedStarGifts",
|
|
10
|
+
peer: owner,
|
|
11
|
+
excludeUnsaved: params.excludeUnsaved,
|
|
12
|
+
excludeSaved: params.excludeSaved,
|
|
13
|
+
excludeUnlimited: params.excludeUnlimited,
|
|
14
|
+
excludeLimited: params.excludeLimited,
|
|
15
|
+
excludeUnique: params.excludeUnique,
|
|
16
|
+
sortByValue: params.sortByValue,
|
|
17
|
+
offset,
|
|
18
|
+
limit: params.limit ?? 100
|
|
19
|
+
});
|
|
20
|
+
const peers = PeersIndex.from(res);
|
|
21
|
+
yield* res.gifts.map((it) => new SavedStarGift$2(it, peers));
|
|
22
|
+
if (!res.nextOffset) break;
|
|
23
|
+
offset = res.nextOffset;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
iterSavedStarGifts
|
|
28
|
+
};
|
|
@@ -12,7 +12,7 @@ const findInUpdate = require("../messages/find-in-update.cjs");
|
|
|
12
12
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
13
13
|
async function sendStarGift(client, params) {
|
|
14
14
|
const {
|
|
15
|
-
|
|
15
|
+
peerId,
|
|
16
16
|
gift,
|
|
17
17
|
anonymous,
|
|
18
18
|
message,
|
|
@@ -22,7 +22,7 @@ async function sendStarGift(client, params) {
|
|
|
22
22
|
const invoice = {
|
|
23
23
|
_: "inputInvoiceStarGift",
|
|
24
24
|
hideName: anonymous,
|
|
25
|
-
|
|
25
|
+
peer: await resolvePeer.resolvePeer(client, peerId),
|
|
26
26
|
giftId: Long.isLong(gift) ? gift : gift.id,
|
|
27
27
|
message: message ? entities.inputTextToTl(message) : void 0,
|
|
28
28
|
includeUpgrade: withUpgrade
|
|
@@ -15,8 +15,8 @@ import { InputText } from '../../types/misc/entities.js';
|
|
|
15
15
|
* @returns Service message about the sent gift
|
|
16
16
|
*/
|
|
17
17
|
export declare function sendStarGift(client: ITelegramClient, params: {
|
|
18
|
-
/** ID of the
|
|
19
|
-
|
|
18
|
+
/** ID of the peer to send the gift to */
|
|
19
|
+
peerId: InputPeerLike;
|
|
20
20
|
/** ID of the gift to send */
|
|
21
21
|
gift: Long | StarGift;
|
|
22
22
|
/**
|
|
@@ -15,8 +15,8 @@ import { InputText } from '../../types/misc/entities.js';
|
|
|
15
15
|
* @returns Service message about the sent gift
|
|
16
16
|
*/
|
|
17
17
|
export declare function sendStarGift(client: ITelegramClient, params: {
|
|
18
|
-
/** ID of the
|
|
19
|
-
|
|
18
|
+
/** ID of the peer to send the gift to */
|
|
19
|
+
peerId: InputPeerLike;
|
|
20
20
|
/** ID of the gift to send */
|
|
21
21
|
gift: Long | StarGift;
|
|
22
22
|
/**
|
|
@@ -2,10 +2,10 @@ import Long from "long";
|
|
|
2
2
|
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
3
3
|
import { inputTextToTl } from "../../types/misc/entities.js";
|
|
4
4
|
import { _findMessageInUpdate } from "../messages/find-in-update.js";
|
|
5
|
-
import {
|
|
5
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
6
6
|
async function sendStarGift(client, params) {
|
|
7
7
|
const {
|
|
8
|
-
|
|
8
|
+
peerId,
|
|
9
9
|
gift,
|
|
10
10
|
anonymous,
|
|
11
11
|
message,
|
|
@@ -15,7 +15,7 @@ async function sendStarGift(client, params) {
|
|
|
15
15
|
const invoice = {
|
|
16
16
|
_: "inputInvoiceStarGift",
|
|
17
17
|
hideName: anonymous,
|
|
18
|
-
|
|
18
|
+
peer: await resolvePeer(client, peerId),
|
|
19
19
|
giftId: Long.isLong(gift) ? gift : gift.id,
|
|
20
20
|
message: message ? inputTextToTl(message) : void 0,
|
|
21
21
|
includeUpgrade: withUpgrade
|
|
@@ -8,13 +8,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
8
8
|
const typeAssertions = require("../../../utils/type-assertions.cjs");
|
|
9
9
|
const findInUpdate = require("../messages/find-in-update.cjs");
|
|
10
10
|
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
11
|
+
const _normalizeInputStarGift = require("./_normalize-input-star-gift.cjs");
|
|
11
12
|
async function transferStarGift(client, params) {
|
|
12
|
-
const {
|
|
13
|
-
const msgId = typeof message === "number" ? message : message.id;
|
|
13
|
+
const { gift, recepient, shouldDispatch } = params;
|
|
14
14
|
const invoice = {
|
|
15
15
|
_: "inputInvoiceStarGiftTransfer",
|
|
16
|
-
|
|
17
|
-
toId: await resolvePeer.
|
|
16
|
+
stargift: await _normalizeInputStarGift._normalizeInputStarGift(client, gift),
|
|
17
|
+
toId: await resolvePeer.resolvePeer(client, recepient)
|
|
18
18
|
};
|
|
19
19
|
const form = await client.call({
|
|
20
20
|
_: "payments.getPaymentForm",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
-
import { InputPeerLike } from '../../types/index.js';
|
|
2
|
+
import { InputPeerLike, InputStarGift } from '../../types/index.js';
|
|
3
3
|
import { Message } from '../../types/messages/message.js';
|
|
4
4
|
/**
|
|
5
5
|
* Transfer a unique star gift.
|
|
@@ -12,8 +12,8 @@ import { Message } from '../../types/messages/message.js';
|
|
|
12
12
|
* @returns Service message about the transferred gift
|
|
13
13
|
*/
|
|
14
14
|
export declare function transferStarGift(client: ITelegramClient, params: {
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/** Star gift to transfer */
|
|
16
|
+
gift: InputStarGift;
|
|
17
17
|
/** ID of the user to transfer the gift to */
|
|
18
18
|
recepient: InputPeerLike;
|
|
19
19
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
-
import { InputPeerLike } from '../../types/index.js';
|
|
2
|
+
import { InputPeerLike, InputStarGift } from '../../types/index.js';
|
|
3
3
|
import { Message } from '../../types/messages/message.js';
|
|
4
4
|
/**
|
|
5
5
|
* Transfer a unique star gift.
|
|
@@ -12,8 +12,8 @@ import { Message } from '../../types/messages/message.js';
|
|
|
12
12
|
* @returns Service message about the transferred gift
|
|
13
13
|
*/
|
|
14
14
|
export declare function transferStarGift(client: ITelegramClient, params: {
|
|
15
|
-
/**
|
|
16
|
-
|
|
15
|
+
/** Star gift to transfer */
|
|
16
|
+
gift: InputStarGift;
|
|
17
17
|
/** ID of the user to transfer the gift to */
|
|
18
18
|
recepient: InputPeerLike;
|
|
19
19
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { assertTypeIs } from "../../../utils/type-assertions.js";
|
|
2
2
|
import { _findMessageInUpdate } from "../messages/find-in-update.js";
|
|
3
|
-
import {
|
|
3
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
4
|
+
import { _normalizeInputStarGift } from "./_normalize-input-star-gift.js";
|
|
4
5
|
async function transferStarGift(client, params) {
|
|
5
|
-
const {
|
|
6
|
-
const msgId = typeof message === "number" ? message : message.id;
|
|
6
|
+
const { gift, recepient, shouldDispatch } = params;
|
|
7
7
|
const invoice = {
|
|
8
8
|
_: "inputInvoiceStarGiftTransfer",
|
|
9
|
-
|
|
10
|
-
toId: await
|
|
9
|
+
stargift: await _normalizeInputStarGift(client, gift),
|
|
10
|
+
toId: await resolvePeer(client, recepient)
|
|
11
11
|
};
|
|
12
12
|
const form = await client.call({
|
|
13
13
|
_: "payments.getPaymentForm",
|