@mtcute/core 0.27.1 → 0.27.3
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 +92 -68
- package/client.js +93 -69
- package/highlevel/base.cjs +4 -0
- package/highlevel/base.d.cts +1 -0
- package/highlevel/base.d.ts +1 -0
- package/highlevel/base.js +4 -0
- package/highlevel/client.d.cts +497 -412
- package/highlevel/client.d.ts +497 -412
- package/highlevel/client.test.d.cts +1 -0
- package/highlevel/client.test.d.ts +1 -0
- package/highlevel/methods/contacts/set-contact-note.cjs +21 -0
- package/highlevel/methods/contacts/set-contact-note.js +16 -0
- package/highlevel/methods/files/download-chunk.cjs +63 -0
- package/highlevel/methods/files/download-chunk.d.cts +29 -0
- package/highlevel/methods/files/download-chunk.d.ts +29 -0
- package/highlevel/methods/files/download-chunk.js +58 -0
- package/highlevel/methods/files/download-chunk.test.d.cts +1 -0
- package/highlevel/methods/files/download-chunk.test.d.ts +1 -0
- package/highlevel/methods/files/download-iterable.cjs +39 -23
- package/highlevel/methods/files/download-iterable.d.cts +6 -0
- package/highlevel/methods/files/download-iterable.d.ts +6 -0
- package/highlevel/methods/files/download-iterable.js +33 -17
- package/highlevel/methods/forums/reorder-pinned-forum-topics.cjs +2 -2
- package/highlevel/methods/forums/reorder-pinned-forum-topics.js +3 -3
- package/highlevel/methods/forums/toggle-forum-topic-closed.cjs +2 -2
- package/highlevel/methods/forums/toggle-forum-topic-closed.js +3 -3
- package/highlevel/methods/forums/toggle-forum-topic-pinned.cjs +2 -2
- package/highlevel/methods/forums/toggle-forum-topic-pinned.js +3 -3
- package/highlevel/methods/gifts/get-star-gift-upgrade-options.cjs +30 -0
- package/highlevel/methods/gifts/get-star-gift-upgrade-options.d.cts +12 -0
- package/highlevel/methods/gifts/get-star-gift-upgrade-options.d.ts +12 -0
- package/highlevel/methods/gifts/get-star-gift-upgrade-options.js +25 -0
- package/highlevel/methods/gifts/resolve-star-gift-offer.cjs +17 -0
- package/highlevel/methods/gifts/resolve-star-gift-offer.d.cts +18 -0
- package/highlevel/methods/gifts/resolve-star-gift-offer.d.ts +18 -0
- package/highlevel/methods/gifts/resolve-star-gift-offer.js +12 -0
- package/highlevel/methods/gifts/send-star-gift-offer.cjs +26 -0
- package/highlevel/methods/gifts/send-star-gift-offer.d.cts +26 -0
- package/highlevel/methods/gifts/send-star-gift-offer.d.ts +26 -0
- package/highlevel/methods/gifts/send-star-gift-offer.js +21 -0
- package/highlevel/methods/{premium → gifts}/set-gift-resale-price.cjs +2 -5
- package/highlevel/methods/{premium → gifts}/set-gift-resale-price.d.cts +2 -2
- package/highlevel/methods/{premium → gifts}/set-gift-resale-price.d.ts +2 -2
- package/highlevel/methods/{premium → gifts}/set-gift-resale-price.js +2 -5
- package/highlevel/methods/premium/_normalize-stars-amount.cjs +18 -0
- package/highlevel/methods/premium/_normalize-stars-amount.d.cts +12 -0
- package/highlevel/methods/premium/_normalize-stars-amount.d.ts +12 -0
- package/highlevel/methods/premium/_normalize-stars-amount.js +13 -0
- package/highlevel/methods.d.cts +26 -18
- package/highlevel/methods.d.ts +26 -18
- package/highlevel/types/messages/message-action.cjs +27 -4
- package/highlevel/types/messages/message-action.d.cts +28 -1
- package/highlevel/types/messages/message-action.d.ts +28 -1
- package/highlevel/types/messages/message-action.js +27 -4
- package/highlevel/types/premium/saved-star-gift.cjs +4 -0
- package/highlevel/types/premium/saved-star-gift.d.cts +2 -0
- package/highlevel/types/premium/saved-star-gift.d.ts +2 -0
- package/highlevel/types/premium/saved-star-gift.js +4 -0
- package/highlevel/types/premium/star-gift-unique.cjs +8 -0
- package/highlevel/types/premium/star-gift-unique.d.cts +4 -0
- package/highlevel/types/premium/star-gift-unique.d.ts +4 -0
- package/highlevel/types/premium/star-gift-unique.js +8 -0
- package/highlevel/types/premium/star-gift.cjs +17 -4
- package/highlevel/types/premium/star-gift.d.cts +8 -1
- package/highlevel/types/premium/star-gift.d.ts +8 -1
- package/highlevel/types/premium/star-gift.js +17 -4
- package/highlevel/types/premium/stars-transaction.cjs +6 -0
- package/highlevel/types/premium/stars-transaction.d.cts +6 -0
- package/highlevel/types/premium/stars-transaction.d.ts +6 -0
- package/highlevel/types/premium/stars-transaction.js +6 -0
- package/highlevel/updates/manager.cjs +7 -0
- package/highlevel/updates/manager.js +7 -0
- package/methods.cjs +45 -34
- package/methods.js +29 -18
- package/network/middlewares/internal-errors.cjs +5 -0
- package/network/middlewares/internal-errors.js +5 -0
- package/network/network-manager.cjs +1 -1
- package/network/network-manager.js +1 -1
- package/package.json +2 -2
- package/utils/binary/compat.cjs +12 -0
- package/utils/binary/compat.js +12 -0
- /package/highlevel/methods/{premium → gifts}/_normalize-input-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/_normalize-input-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/_normalize-input-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/_normalize-input-star-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/accept-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/accept-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/accept-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/accept-star-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/buy-resale-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/buy-resale-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/buy-resale-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/buy-resale-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-resale-star-gifts.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-resale-star-gifts.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-resale-star-gifts.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-resale-star-gifts.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts-by-id.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts-by-id.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts-by-id.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts-by-id.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-saved-star-gifts.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-options.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-options.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-options.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-options.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-value.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-value.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-value.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-value.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-withdrawal-url.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-withdrawal-url.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-withdrawal-url.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-star-gift-withdrawal-url.js +0 -0
- /package/highlevel/methods/{premium → gifts}/get-unique-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/get-unique-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-unique-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/get-unique-star-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/iter-saved-star-gifts.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/iter-saved-star-gifts.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/iter-saved-star-gifts.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/iter-saved-star-gifts.js +0 -0
- /package/highlevel/methods/{premium → gifts}/pin-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/pin-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/pin-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/pin-star-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/prepay-star-gift-upgrade.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/prepay-star-gift-upgrade.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/prepay-star-gift-upgrade.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/prepay-star-gift-upgrade.js +0 -0
- /package/highlevel/methods/{premium → gifts}/send-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/send-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/send-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/send-star-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/transfer-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/transfer-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/transfer-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/transfer-star-gift.js +0 -0
- /package/highlevel/methods/{premium → gifts}/upgrade-star-gift.cjs +0 -0
- /package/highlevel/methods/{premium → gifts}/upgrade-star-gift.d.cts +0 -0
- /package/highlevel/methods/{premium → gifts}/upgrade-star-gift.d.ts +0 -0
- /package/highlevel/methods/{premium → gifts}/upgrade-star-gift.js +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const findInUpdate = require("../messages/find-in-update.cjs");
|
|
9
|
+
async function resolveStarGiftOffer(client, options) {
|
|
10
|
+
const { message, shouldDispatch } = options;
|
|
11
|
+
const res = await client.call({
|
|
12
|
+
_: "payments.resolveStarGiftOffer",
|
|
13
|
+
offerMsgId: message
|
|
14
|
+
});
|
|
15
|
+
return findInUpdate._findMessageInUpdate(client, res, false, !shouldDispatch, false);
|
|
16
|
+
}
|
|
17
|
+
exports.resolveStarGiftOffer = resolveStarGiftOffer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { Message } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Accept or decline a purchase offer for a star gift
|
|
5
|
+
*
|
|
6
|
+
* @returns The generated service message
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveStarGiftOffer(client: ITelegramClient, options: {
|
|
9
|
+
/** ID of the message containing the offer */
|
|
10
|
+
message: number;
|
|
11
|
+
/** Whether to accept or decline the offer */
|
|
12
|
+
action: 'accept' | 'decline';
|
|
13
|
+
/**
|
|
14
|
+
* Whether to dispatch the new message event
|
|
15
|
+
* to the client's update handler.
|
|
16
|
+
*/
|
|
17
|
+
shouldDispatch?: true;
|
|
18
|
+
}): Promise<Message>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
2
|
+
import { Message } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Accept or decline a purchase offer for a star gift
|
|
5
|
+
*
|
|
6
|
+
* @returns The generated service message
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveStarGiftOffer(client: ITelegramClient, options: {
|
|
9
|
+
/** ID of the message containing the offer */
|
|
10
|
+
message: number;
|
|
11
|
+
/** Whether to accept or decline the offer */
|
|
12
|
+
action: 'accept' | 'decline';
|
|
13
|
+
/**
|
|
14
|
+
* Whether to dispatch the new message event
|
|
15
|
+
* to the client's update handler.
|
|
16
|
+
*/
|
|
17
|
+
shouldDispatch?: true;
|
|
18
|
+
}): Promise<Message>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { _findMessageInUpdate } from "../messages/find-in-update.js";
|
|
2
|
+
async function resolveStarGiftOffer(client, options) {
|
|
3
|
+
const { message, shouldDispatch } = options;
|
|
4
|
+
const res = await client.call({
|
|
5
|
+
_: "payments.resolveStarGiftOffer",
|
|
6
|
+
offerMsgId: message
|
|
7
|
+
});
|
|
8
|
+
return _findMessageInUpdate(client, res, false, !shouldDispatch, false);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
resolveStarGiftOffer
|
|
12
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const longUtils = require("../../../utils/long-utils.cjs");
|
|
9
|
+
const findInUpdate = require("../messages/find-in-update.cjs");
|
|
10
|
+
const _normalizeStarsAmount = require("../premium/_normalize-stars-amount.cjs");
|
|
11
|
+
const resolvePeer = require("../users/resolve-peer.cjs");
|
|
12
|
+
async function sendStarGiftOffer(client, params) {
|
|
13
|
+
const { peerId, slug, price, duration, allowPaidMessages, shouldDispatch } = params;
|
|
14
|
+
const randomId = longUtils.randomLong();
|
|
15
|
+
const res = await client.call({
|
|
16
|
+
_: "payments.sendStarGiftOffer",
|
|
17
|
+
peer: await resolvePeer.resolvePeer(client, peerId),
|
|
18
|
+
slug,
|
|
19
|
+
price: _normalizeStarsAmount._normalizeStarsAmount(price),
|
|
20
|
+
duration,
|
|
21
|
+
randomId,
|
|
22
|
+
allowPaidStars: allowPaidMessages
|
|
23
|
+
});
|
|
24
|
+
return findInUpdate._findMessageInUpdate(client, res, false, !shouldDispatch, false, randomId);
|
|
25
|
+
}
|
|
26
|
+
exports.sendStarGiftOffer = sendStarGiftOffer;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { InputPeerLike, Message } from '../../types/index.js';
|
|
4
|
+
import { InputStarsAmount } from '../premium/_normalize-stars-amount.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create a purchase offer for a unique star gift
|
|
7
|
+
* @param client
|
|
8
|
+
* @param params
|
|
9
|
+
*/
|
|
10
|
+
export declare function sendStarGiftOffer(client: ITelegramClient, params: {
|
|
11
|
+
/** ID of the peer to send the offer to */
|
|
12
|
+
peerId: InputPeerLike;
|
|
13
|
+
/** Slug of the star gift to create an offer for */
|
|
14
|
+
slug: string;
|
|
15
|
+
/** Amount of stars to offer */
|
|
16
|
+
price: InputStarsAmount;
|
|
17
|
+
/** Duration of the offer in seconds */
|
|
18
|
+
duration: number;
|
|
19
|
+
/** When the recipient has paid messages enabled, the maximum number of stars that you are willing to spend */
|
|
20
|
+
allowPaidMessages?: tl.Long;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to dispatch the new message event
|
|
23
|
+
* to the client's update handler.
|
|
24
|
+
*/
|
|
25
|
+
shouldDispatch?: true;
|
|
26
|
+
}): Promise<Message>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { InputPeerLike, Message } from '../../types/index.js';
|
|
4
|
+
import { InputStarsAmount } from '../premium/_normalize-stars-amount.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create a purchase offer for a unique star gift
|
|
7
|
+
* @param client
|
|
8
|
+
* @param params
|
|
9
|
+
*/
|
|
10
|
+
export declare function sendStarGiftOffer(client: ITelegramClient, params: {
|
|
11
|
+
/** ID of the peer to send the offer to */
|
|
12
|
+
peerId: InputPeerLike;
|
|
13
|
+
/** Slug of the star gift to create an offer for */
|
|
14
|
+
slug: string;
|
|
15
|
+
/** Amount of stars to offer */
|
|
16
|
+
price: InputStarsAmount;
|
|
17
|
+
/** Duration of the offer in seconds */
|
|
18
|
+
duration: number;
|
|
19
|
+
/** When the recipient has paid messages enabled, the maximum number of stars that you are willing to spend */
|
|
20
|
+
allowPaidMessages?: tl.Long;
|
|
21
|
+
/**
|
|
22
|
+
* Whether to dispatch the new message event
|
|
23
|
+
* to the client's update handler.
|
|
24
|
+
*/
|
|
25
|
+
shouldDispatch?: true;
|
|
26
|
+
}): Promise<Message>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { randomLong } from "../../../utils/long-utils.js";
|
|
2
|
+
import { _findMessageInUpdate } from "../messages/find-in-update.js";
|
|
3
|
+
import { _normalizeStarsAmount } from "../premium/_normalize-stars-amount.js";
|
|
4
|
+
import { resolvePeer } from "../users/resolve-peer.js";
|
|
5
|
+
async function sendStarGiftOffer(client, params) {
|
|
6
|
+
const { peerId, slug, price, duration, allowPaidMessages, shouldDispatch } = params;
|
|
7
|
+
const randomId = randomLong();
|
|
8
|
+
const res = await client.call({
|
|
9
|
+
_: "payments.sendStarGiftOffer",
|
|
10
|
+
peer: await resolvePeer(client, peerId),
|
|
11
|
+
slug,
|
|
12
|
+
price: _normalizeStarsAmount(price),
|
|
13
|
+
duration,
|
|
14
|
+
randomId,
|
|
15
|
+
allowPaidStars: allowPaidMessages
|
|
16
|
+
});
|
|
17
|
+
return _findMessageInUpdate(client, res, false, !shouldDispatch, false, randomId);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
sendStarGiftOffer
|
|
21
|
+
};
|
|
@@ -6,18 +6,15 @@ 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 Long = require("long");
|
|
9
|
+
const _normalizeStarsAmount = require("../premium/_normalize-stars-amount.cjs");
|
|
9
10
|
const _normalizeInputStarGift = require("./_normalize-input-star-gift.cjs");
|
|
10
11
|
async function setResaleStarGiftPrice(client, params) {
|
|
11
12
|
const { gift, price } = params;
|
|
12
13
|
let starsAmount;
|
|
13
14
|
if (price === null) {
|
|
14
15
|
starsAmount = { _: "starsAmount", amount: Long.ZERO, nanos: 0 };
|
|
15
|
-
} else if (typeof price === "number") {
|
|
16
|
-
starsAmount = { _: "starsAmount", amount: Long.fromNumber(price), nanos: 0 };
|
|
17
|
-
} else if (Long.isLong(price)) {
|
|
18
|
-
starsAmount = { _: "starsAmount", amount: price, nanos: 0 };
|
|
19
16
|
} else {
|
|
20
|
-
starsAmount = price;
|
|
17
|
+
starsAmount = _normalizeStarsAmount._normalizeStarsAmount(price);
|
|
21
18
|
}
|
|
22
19
|
const r = await client.call({
|
|
23
20
|
_: "payments.updateStarGiftPrice",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { tl } from '@mtcute/tl';
|
|
2
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
2
|
import { InputStarGift } from '../../types/index.js';
|
|
3
|
+
import { InputStarsAmount } from '../premium/_normalize-stars-amount.js';
|
|
4
4
|
/** Set resale price for an owned star gift */
|
|
5
5
|
export declare function setResaleStarGiftPrice(client: ITelegramClient, params: {
|
|
6
6
|
/** Star gift to update the price of */
|
|
@@ -8,5 +8,5 @@ export declare function setResaleStarGiftPrice(client: ITelegramClient, params:
|
|
|
8
8
|
/**
|
|
9
9
|
* New price of the gift (in stars), or `null` to unlist
|
|
10
10
|
*/
|
|
11
|
-
price:
|
|
11
|
+
price: InputStarsAmount | null;
|
|
12
12
|
}): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { tl } from '@mtcute/tl';
|
|
2
1
|
import { ITelegramClient } from '../../client.types.js';
|
|
3
2
|
import { InputStarGift } from '../../types/index.js';
|
|
3
|
+
import { InputStarsAmount } from '../premium/_normalize-stars-amount.js';
|
|
4
4
|
/** Set resale price for an owned star gift */
|
|
5
5
|
export declare function setResaleStarGiftPrice(client: ITelegramClient, params: {
|
|
6
6
|
/** Star gift to update the price of */
|
|
@@ -8,5 +8,5 @@ export declare function setResaleStarGiftPrice(client: ITelegramClient, params:
|
|
|
8
8
|
/**
|
|
9
9
|
* New price of the gift (in stars), or `null` to unlist
|
|
10
10
|
*/
|
|
11
|
-
price:
|
|
11
|
+
price: InputStarsAmount | null;
|
|
12
12
|
}): Promise<void>;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import Long from "long";
|
|
2
|
+
import { _normalizeStarsAmount } from "../premium/_normalize-stars-amount.js";
|
|
2
3
|
import { _normalizeInputStarGift } from "./_normalize-input-star-gift.js";
|
|
3
4
|
async function setResaleStarGiftPrice(client, params) {
|
|
4
5
|
const { gift, price } = params;
|
|
5
6
|
let starsAmount;
|
|
6
7
|
if (price === null) {
|
|
7
8
|
starsAmount = { _: "starsAmount", amount: Long.ZERO, nanos: 0 };
|
|
8
|
-
} else if (typeof price === "number") {
|
|
9
|
-
starsAmount = { _: "starsAmount", amount: Long.fromNumber(price), nanos: 0 };
|
|
10
|
-
} else if (Long.isLong(price)) {
|
|
11
|
-
starsAmount = { _: "starsAmount", amount: price, nanos: 0 };
|
|
12
9
|
} else {
|
|
13
|
-
starsAmount = price;
|
|
10
|
+
starsAmount = _normalizeStarsAmount(price);
|
|
14
11
|
}
|
|
15
12
|
const r = await client.call({
|
|
16
13
|
_: "payments.updateStarGiftPrice",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
|
|
2
|
+
globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
|
|
3
|
+
console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
|
|
4
|
+
console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
|
|
5
|
+
}
|
|
6
|
+
"use strict";
|
|
7
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
+
const Long = require("long");
|
|
9
|
+
function _normalizeStarsAmount(amount) {
|
|
10
|
+
if (typeof amount === "number") {
|
|
11
|
+
return { _: "starsAmount", amount: Long.fromNumber(amount), nanos: 0 };
|
|
12
|
+
} else if (Long.isLong(amount)) {
|
|
13
|
+
return { _: "starsAmount", amount, nanos: 0 };
|
|
14
|
+
} else {
|
|
15
|
+
return amount;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports._normalizeStarsAmount = _normalizeStarsAmount;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a number of stars or a TON amount:
|
|
4
|
+
*
|
|
5
|
+
* - `number` and `Long` are considered as the exact number of stars.
|
|
6
|
+
* - Fractional stars should be passed explicitly as `{ _: 'starsAmount', ... }` (though i'm not sure if any methods accept that)
|
|
7
|
+
* - TON amounts and should be passed explicitly as `{ _: 'starsAmountTon', ... }`
|
|
8
|
+
*
|
|
9
|
+
* @exported
|
|
10
|
+
*/
|
|
11
|
+
export type InputStarsAmount = tl.Long | number | tl.TypeStarsAmount;
|
|
12
|
+
export declare function _normalizeStarsAmount(amount: InputStarsAmount): tl.TypeStarsAmount;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a number of stars or a TON amount:
|
|
4
|
+
*
|
|
5
|
+
* - `number` and `Long` are considered as the exact number of stars.
|
|
6
|
+
* - Fractional stars should be passed explicitly as `{ _: 'starsAmount', ... }` (though i'm not sure if any methods accept that)
|
|
7
|
+
* - TON amounts and should be passed explicitly as `{ _: 'starsAmountTon', ... }`
|
|
8
|
+
*
|
|
9
|
+
* @exported
|
|
10
|
+
*/
|
|
11
|
+
export type InputStarsAmount = tl.Long | number | tl.TypeStarsAmount;
|
|
12
|
+
export declare function _normalizeStarsAmount(amount: InputStarsAmount): tl.TypeStarsAmount;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
function _normalizeStarsAmount(amount) {
|
|
3
|
+
if (typeof amount === "number") {
|
|
4
|
+
return { _: "starsAmount", amount: Long.fromNumber(amount), nanos: 0 };
|
|
5
|
+
} else if (Long.isLong(amount)) {
|
|
6
|
+
return { _: "starsAmount", amount, nanos: 0 };
|
|
7
|
+
} else {
|
|
8
|
+
return amount;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
_normalizeStarsAmount
|
|
13
|
+
};
|
package/highlevel/methods.d.cts
CHANGED
|
@@ -86,6 +86,7 @@ export { addContact } from './methods/contacts/add-contact.js';
|
|
|
86
86
|
export { deleteContacts } from './methods/contacts/delete-contacts.js';
|
|
87
87
|
export { getContacts } from './methods/contacts/get-contacts.js';
|
|
88
88
|
export { importContacts } from './methods/contacts/import-contacts.js';
|
|
89
|
+
export { setContactNote } from './methods/contacts/set-contact-note.js';
|
|
89
90
|
export { createFolder } from './methods/dialogs/create-folder.js';
|
|
90
91
|
export { deleteFolder } from './methods/dialogs/delete-folder.js';
|
|
91
92
|
export { editFolder } from './methods/dialogs/edit-folder.js';
|
|
@@ -98,6 +99,8 @@ export { iterDialogs } from './methods/dialogs/iter-dialogs.js';
|
|
|
98
99
|
export { joinChatlist } from './methods/dialogs/join-chatlist.js';
|
|
99
100
|
export { setFoldersOrder } from './methods/dialogs/set-folders-order.js';
|
|
100
101
|
export { downloadAsBuffer } from './methods/files/download-buffer.js';
|
|
102
|
+
export { downloadChunk } from './methods/files/download-chunk.js';
|
|
103
|
+
export { _normalizeFileDownloadLocation } from './methods/files/download-iterable.js';
|
|
101
104
|
export { downloadAsIterable } from './methods/files/download-iterable.js';
|
|
102
105
|
export { downloadAsStream } from './methods/files/download-stream.js';
|
|
103
106
|
export { _normalizeInputFile } from './methods/files/normalize-input-file.js';
|
|
@@ -116,6 +119,28 @@ export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-clos
|
|
|
116
119
|
export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
|
|
117
120
|
export { updateForumSettings } from './methods/forums/toggle-forum.js';
|
|
118
121
|
export { toggleGeneralTopicHidden } from './methods/forums/toggle-general-topic-hidden.js';
|
|
122
|
+
export { _normalizeInputStarGift } from './methods/gifts/_normalize-input-star-gift.js';
|
|
123
|
+
export { acceptStarGift } from './methods/gifts/accept-star-gift.js';
|
|
124
|
+
export { buyResaleGift } from './methods/gifts/buy-resale-gift.js';
|
|
125
|
+
export { getStarGiftResaleOptions } from './methods/gifts/get-resale-star-gifts.js';
|
|
126
|
+
export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/gifts/get-resale-star-gifts.js';
|
|
127
|
+
export { getSavedStarGiftsById } from './methods/gifts/get-saved-star-gifts-by-id.js';
|
|
128
|
+
export { getSavedStarGifts } from './methods/gifts/get-saved-star-gifts.js';
|
|
129
|
+
export { getStarGiftOptions } from './methods/gifts/get-star-gift-options.js';
|
|
130
|
+
export { getStarGiftUpgradeOptions } from './methods/gifts/get-star-gift-upgrade-options.js';
|
|
131
|
+
export type { StarGiftUpgradeOptions } from './methods/gifts/get-star-gift-upgrade-options.js';
|
|
132
|
+
export { getStarGiftValue } from './methods/gifts/get-star-gift-value.js';
|
|
133
|
+
export { getStarGiftWithdrawalUrl } from './methods/gifts/get-star-gift-withdrawal-url.js';
|
|
134
|
+
export { getUniqueStarGift } from './methods/gifts/get-unique-star-gift.js';
|
|
135
|
+
export { iterSavedStarGifts } from './methods/gifts/iter-saved-star-gifts.js';
|
|
136
|
+
export { togglePinnedStarGifts } from './methods/gifts/pin-star-gift.js';
|
|
137
|
+
export { prepayStarGiftUpgrade } from './methods/gifts/prepay-star-gift-upgrade.js';
|
|
138
|
+
export { resolveStarGiftOffer } from './methods/gifts/resolve-star-gift-offer.js';
|
|
139
|
+
export { sendStarGiftOffer } from './methods/gifts/send-star-gift-offer.js';
|
|
140
|
+
export { sendStarGift } from './methods/gifts/send-star-gift.js';
|
|
141
|
+
export { setResaleStarGiftPrice } from './methods/gifts/set-gift-resale-price.js';
|
|
142
|
+
export { transferStarGift } from './methods/gifts/transfer-star-gift.js';
|
|
143
|
+
export { upgradeStarGift } from './methods/gifts/upgrade-star-gift.js';
|
|
119
144
|
export { createInviteLink } from './methods/invite-links/create-invite-link.js';
|
|
120
145
|
export { editInviteLink } from './methods/invite-links/edit-invite-link.js';
|
|
121
146
|
export { exportInviteLink } from './methods/invite-links/export-invite-link.js';
|
|
@@ -215,10 +240,8 @@ export { verifyPasswordEmail } from './methods/password/password-email.js';
|
|
|
215
240
|
export { resendPasswordEmail } from './methods/password/password-email.js';
|
|
216
241
|
export { cancelPasswordEmail } from './methods/password/password-email.js';
|
|
217
242
|
export { removeCloudPassword } from './methods/password/remove-cloud-password.js';
|
|
218
|
-
export {
|
|
219
|
-
export { acceptStarGift } from './methods/premium/accept-star-gift.js';
|
|
243
|
+
export type { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
|
|
220
244
|
export { applyBoost } from './methods/premium/apply-boost.js';
|
|
221
|
-
export { buyResaleGift } from './methods/premium/buy-resale-gift.js';
|
|
222
245
|
export { canApplyBoost } from './methods/premium/can-apply-boost.js';
|
|
223
246
|
export type { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
224
247
|
export { createBusinessChatLink } from './methods/premium/create-business-chat-link.js';
|
|
@@ -229,26 +252,11 @@ export { getBoosts } from './methods/premium/get-boosts.js';
|
|
|
229
252
|
export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
|
|
230
253
|
export { getBusinessConnection } from './methods/premium/get-business-connection.js';
|
|
231
254
|
export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
|
|
232
|
-
export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
|
|
233
|
-
export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
234
|
-
export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
|
|
235
|
-
export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
|
|
236
|
-
export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
|
|
237
|
-
export { getStarGiftValue } from './methods/premium/get-star-gift-value.js';
|
|
238
|
-
export { getStarGiftWithdrawalUrl } from './methods/premium/get-star-gift-withdrawal-url.js';
|
|
239
255
|
export { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
|
|
240
|
-
export { getUniqueStarGift } from './methods/premium/get-unique-star-gift.js';
|
|
241
256
|
export { iterBoosters } from './methods/premium/iter-boosters.js';
|
|
242
|
-
export { iterSavedStarGifts } from './methods/premium/iter-saved-star-gifts.js';
|
|
243
257
|
export { iterStarsTransactions } from './methods/premium/iter-stars-transactions.js';
|
|
244
|
-
export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
|
|
245
|
-
export { prepayStarGiftUpgrade } from './methods/premium/prepay-star-gift-upgrade.js';
|
|
246
|
-
export { sendStarGift } from './methods/premium/send-star-gift.js';
|
|
247
258
|
export { setBusinessIntro } from './methods/premium/set-business-intro.js';
|
|
248
259
|
export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
|
|
249
|
-
export { setResaleStarGiftPrice } from './methods/premium/set-gift-resale-price.js';
|
|
250
|
-
export { transferStarGift } from './methods/premium/transfer-star-gift.js';
|
|
251
|
-
export { upgradeStarGift } from './methods/premium/upgrade-star-gift.js';
|
|
252
260
|
export { addStickerToSet } from './methods/stickers/add-sticker-to-set.js';
|
|
253
261
|
export { createStickerSet } from './methods/stickers/create-sticker-set.js';
|
|
254
262
|
export { deleteStickerFromSet } from './methods/stickers/delete-sticker-from-set.js';
|
package/highlevel/methods.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export { addContact } from './methods/contacts/add-contact.js';
|
|
|
86
86
|
export { deleteContacts } from './methods/contacts/delete-contacts.js';
|
|
87
87
|
export { getContacts } from './methods/contacts/get-contacts.js';
|
|
88
88
|
export { importContacts } from './methods/contacts/import-contacts.js';
|
|
89
|
+
export { setContactNote } from './methods/contacts/set-contact-note.js';
|
|
89
90
|
export { createFolder } from './methods/dialogs/create-folder.js';
|
|
90
91
|
export { deleteFolder } from './methods/dialogs/delete-folder.js';
|
|
91
92
|
export { editFolder } from './methods/dialogs/edit-folder.js';
|
|
@@ -98,6 +99,8 @@ export { iterDialogs } from './methods/dialogs/iter-dialogs.js';
|
|
|
98
99
|
export { joinChatlist } from './methods/dialogs/join-chatlist.js';
|
|
99
100
|
export { setFoldersOrder } from './methods/dialogs/set-folders-order.js';
|
|
100
101
|
export { downloadAsBuffer } from './methods/files/download-buffer.js';
|
|
102
|
+
export { downloadChunk } from './methods/files/download-chunk.js';
|
|
103
|
+
export { _normalizeFileDownloadLocation } from './methods/files/download-iterable.js';
|
|
101
104
|
export { downloadAsIterable } from './methods/files/download-iterable.js';
|
|
102
105
|
export { downloadAsStream } from './methods/files/download-stream.js';
|
|
103
106
|
export { _normalizeInputFile } from './methods/files/normalize-input-file.js';
|
|
@@ -116,6 +119,28 @@ export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-clos
|
|
|
116
119
|
export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
|
|
117
120
|
export { updateForumSettings } from './methods/forums/toggle-forum.js';
|
|
118
121
|
export { toggleGeneralTopicHidden } from './methods/forums/toggle-general-topic-hidden.js';
|
|
122
|
+
export { _normalizeInputStarGift } from './methods/gifts/_normalize-input-star-gift.js';
|
|
123
|
+
export { acceptStarGift } from './methods/gifts/accept-star-gift.js';
|
|
124
|
+
export { buyResaleGift } from './methods/gifts/buy-resale-gift.js';
|
|
125
|
+
export { getStarGiftResaleOptions } from './methods/gifts/get-resale-star-gifts.js';
|
|
126
|
+
export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/gifts/get-resale-star-gifts.js';
|
|
127
|
+
export { getSavedStarGiftsById } from './methods/gifts/get-saved-star-gifts-by-id.js';
|
|
128
|
+
export { getSavedStarGifts } from './methods/gifts/get-saved-star-gifts.js';
|
|
129
|
+
export { getStarGiftOptions } from './methods/gifts/get-star-gift-options.js';
|
|
130
|
+
export { getStarGiftUpgradeOptions } from './methods/gifts/get-star-gift-upgrade-options.js';
|
|
131
|
+
export type { StarGiftUpgradeOptions } from './methods/gifts/get-star-gift-upgrade-options.js';
|
|
132
|
+
export { getStarGiftValue } from './methods/gifts/get-star-gift-value.js';
|
|
133
|
+
export { getStarGiftWithdrawalUrl } from './methods/gifts/get-star-gift-withdrawal-url.js';
|
|
134
|
+
export { getUniqueStarGift } from './methods/gifts/get-unique-star-gift.js';
|
|
135
|
+
export { iterSavedStarGifts } from './methods/gifts/iter-saved-star-gifts.js';
|
|
136
|
+
export { togglePinnedStarGifts } from './methods/gifts/pin-star-gift.js';
|
|
137
|
+
export { prepayStarGiftUpgrade } from './methods/gifts/prepay-star-gift-upgrade.js';
|
|
138
|
+
export { resolveStarGiftOffer } from './methods/gifts/resolve-star-gift-offer.js';
|
|
139
|
+
export { sendStarGiftOffer } from './methods/gifts/send-star-gift-offer.js';
|
|
140
|
+
export { sendStarGift } from './methods/gifts/send-star-gift.js';
|
|
141
|
+
export { setResaleStarGiftPrice } from './methods/gifts/set-gift-resale-price.js';
|
|
142
|
+
export { transferStarGift } from './methods/gifts/transfer-star-gift.js';
|
|
143
|
+
export { upgradeStarGift } from './methods/gifts/upgrade-star-gift.js';
|
|
119
144
|
export { createInviteLink } from './methods/invite-links/create-invite-link.js';
|
|
120
145
|
export { editInviteLink } from './methods/invite-links/edit-invite-link.js';
|
|
121
146
|
export { exportInviteLink } from './methods/invite-links/export-invite-link.js';
|
|
@@ -215,10 +240,8 @@ export { verifyPasswordEmail } from './methods/password/password-email.js';
|
|
|
215
240
|
export { resendPasswordEmail } from './methods/password/password-email.js';
|
|
216
241
|
export { cancelPasswordEmail } from './methods/password/password-email.js';
|
|
217
242
|
export { removeCloudPassword } from './methods/password/remove-cloud-password.js';
|
|
218
|
-
export {
|
|
219
|
-
export { acceptStarGift } from './methods/premium/accept-star-gift.js';
|
|
243
|
+
export type { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
|
|
220
244
|
export { applyBoost } from './methods/premium/apply-boost.js';
|
|
221
|
-
export { buyResaleGift } from './methods/premium/buy-resale-gift.js';
|
|
222
245
|
export { canApplyBoost } from './methods/premium/can-apply-boost.js';
|
|
223
246
|
export type { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
224
247
|
export { createBusinessChatLink } from './methods/premium/create-business-chat-link.js';
|
|
@@ -229,26 +252,11 @@ export { getBoosts } from './methods/premium/get-boosts.js';
|
|
|
229
252
|
export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
|
|
230
253
|
export { getBusinessConnection } from './methods/premium/get-business-connection.js';
|
|
231
254
|
export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
|
|
232
|
-
export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
|
|
233
|
-
export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
234
|
-
export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
|
|
235
|
-
export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
|
|
236
|
-
export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
|
|
237
|
-
export { getStarGiftValue } from './methods/premium/get-star-gift-value.js';
|
|
238
|
-
export { getStarGiftWithdrawalUrl } from './methods/premium/get-star-gift-withdrawal-url.js';
|
|
239
255
|
export { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
|
|
240
|
-
export { getUniqueStarGift } from './methods/premium/get-unique-star-gift.js';
|
|
241
256
|
export { iterBoosters } from './methods/premium/iter-boosters.js';
|
|
242
|
-
export { iterSavedStarGifts } from './methods/premium/iter-saved-star-gifts.js';
|
|
243
257
|
export { iterStarsTransactions } from './methods/premium/iter-stars-transactions.js';
|
|
244
|
-
export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
|
|
245
|
-
export { prepayStarGiftUpgrade } from './methods/premium/prepay-star-gift-upgrade.js';
|
|
246
|
-
export { sendStarGift } from './methods/premium/send-star-gift.js';
|
|
247
258
|
export { setBusinessIntro } from './methods/premium/set-business-intro.js';
|
|
248
259
|
export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
|
|
249
|
-
export { setResaleStarGiftPrice } from './methods/premium/set-gift-resale-price.js';
|
|
250
|
-
export { transferStarGift } from './methods/premium/transfer-star-gift.js';
|
|
251
|
-
export { upgradeStarGift } from './methods/premium/upgrade-star-gift.js';
|
|
252
260
|
export { addStickerToSet } from './methods/stickers/add-sticker-to-set.js';
|
|
253
261
|
export { createStickerSet } from './methods/stickers/create-sticker-set.js';
|
|
254
262
|
export { deleteStickerFromSet } from './methods/stickers/delete-sticker-from-set.js';
|
|
@@ -5,7 +5,6 @@ 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");
|
|
9
8
|
const Long = require("long");
|
|
10
9
|
const peerUtils = require("../../../utils/peer-utils.cjs");
|
|
11
10
|
const photo = require("../media/photo.cjs");
|
|
@@ -185,7 +184,7 @@ function _messageActionFromTl(act) {
|
|
|
185
184
|
};
|
|
186
185
|
case "messageActionSetChatTheme":
|
|
187
186
|
if (act.theme._ === "chatThemeUniqueGift") {
|
|
188
|
-
|
|
187
|
+
if (act.theme.gift._ !== "starGiftUnique") return null;
|
|
189
188
|
return {
|
|
190
189
|
type: "theme_changed_unique",
|
|
191
190
|
gift: new starGiftUnique.StarGiftUnique(act.theme.gift, this._peers),
|
|
@@ -296,7 +295,7 @@ function _messageActionFromTl(act) {
|
|
|
296
295
|
giveawayMessageId: act.giveawayMsgId
|
|
297
296
|
};
|
|
298
297
|
case "messageActionStarGift":
|
|
299
|
-
|
|
298
|
+
if (act.gift._ !== "starGift") return null;
|
|
300
299
|
if (act.prepaidUpgrade) {
|
|
301
300
|
return {
|
|
302
301
|
type: "star_gift_upgrade_paid",
|
|
@@ -319,12 +318,13 @@ function _messageActionFromTl(act) {
|
|
|
319
318
|
upgradeStars: act.upgradeStars ?? Long.ZERO,
|
|
320
319
|
upgradeMsgId: act.upgradeMsgId ?? null,
|
|
321
320
|
fromAuction: act.auctionAcquired,
|
|
321
|
+
giftNum: act.giftNum,
|
|
322
322
|
toId: act.toId ? peer.parsePeer(act.toId, this._peers) : null,
|
|
323
323
|
savedId: act.savedId,
|
|
324
324
|
prepaidUpgradeHash: act.prepaidUpgradeHash ?? void 0
|
|
325
325
|
};
|
|
326
326
|
case "messageActionStarGiftUnique": {
|
|
327
|
-
|
|
327
|
+
if (act.gift._ !== "starGiftUnique") return null;
|
|
328
328
|
const common = {
|
|
329
329
|
saved: act.saved,
|
|
330
330
|
refunded: act.refunded,
|
|
@@ -341,6 +341,12 @@ function _messageActionFromTl(act) {
|
|
|
341
341
|
...common
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
|
+
if (act.fromOffer) {
|
|
345
|
+
return {
|
|
346
|
+
type: "star_gift_bought_offer",
|
|
347
|
+
...common
|
|
348
|
+
};
|
|
349
|
+
}
|
|
344
350
|
if (act.resaleAmount) {
|
|
345
351
|
return {
|
|
346
352
|
type: "star_gift_bought_resale",
|
|
@@ -395,6 +401,23 @@ function _messageActionFromTl(act) {
|
|
|
395
401
|
type: "suggest_birthday",
|
|
396
402
|
birthday: act.birthday
|
|
397
403
|
};
|
|
404
|
+
case "messageActionStarGiftPurchaseOffer":
|
|
405
|
+
if (act.gift._ !== "starGiftUnique") return null;
|
|
406
|
+
return {
|
|
407
|
+
type: "star_gift_purchase_offer",
|
|
408
|
+
status: act.accepted ? "accepted" : act.declined ? "declined" : "pending",
|
|
409
|
+
gift: new starGiftUnique.StarGiftUnique(act.gift, this._peers),
|
|
410
|
+
price: act.price,
|
|
411
|
+
expiresAt: new Date(act.expiresAt * 1e3)
|
|
412
|
+
};
|
|
413
|
+
case "messageActionStarGiftPurchaseOfferDeclined":
|
|
414
|
+
if (act.gift._ !== "starGiftUnique") return null;
|
|
415
|
+
return {
|
|
416
|
+
type: "star_gift_purchase_offer_declined",
|
|
417
|
+
expired: act.expired,
|
|
418
|
+
gift: new starGiftUnique.StarGiftUnique(act.gift, this._peers),
|
|
419
|
+
price: act.price
|
|
420
|
+
};
|
|
398
421
|
default:
|
|
399
422
|
return null;
|
|
400
423
|
}
|
|
@@ -437,6 +437,8 @@ export interface ActionStarGiftSent {
|
|
|
437
437
|
upgradeMsgId: number | null;
|
|
438
438
|
/** Whether this gift was purchased on an auction */
|
|
439
439
|
fromAuction: boolean;
|
|
440
|
+
/** For limited-offer gifts, the sequential number of the gift */
|
|
441
|
+
giftNum?: number;
|
|
440
442
|
/** Recipient of the gift */
|
|
441
443
|
toId: Peer | null;
|
|
442
444
|
/** ID of the related saved profile gift */
|
|
@@ -482,6 +484,31 @@ export interface ActionStarGiftBoughtResale extends StarGiftUniqueCommon {
|
|
|
482
484
|
/** Number of stars/TON that were paid for the gift */
|
|
483
485
|
amount: tl.TypeStarsAmount;
|
|
484
486
|
}
|
|
487
|
+
/** A star gift was bought from a purchase offer */
|
|
488
|
+
export interface ActionStarGiftBoughtOffer extends StarGiftUniqueCommon {
|
|
489
|
+
readonly type: 'star_gift_bought_offer';
|
|
490
|
+
}
|
|
491
|
+
/** A purchase offer was created for one of the user's star gifts */
|
|
492
|
+
export interface ActionStarGiftPurchaseOffer {
|
|
493
|
+
readonly type: 'star_gift_purchase_offer';
|
|
494
|
+
/** Current status of the offer */
|
|
495
|
+
status: 'pending' | 'accepted' | 'declined';
|
|
496
|
+
/** Star gift */
|
|
497
|
+
gift: StarGiftUnique;
|
|
498
|
+
/** The amount of money that was offered for the gift */
|
|
499
|
+
price: tl.TypeStarsAmount;
|
|
500
|
+
/** Date when the offer will expire */
|
|
501
|
+
expiresAt: Date;
|
|
502
|
+
}
|
|
503
|
+
/** A purchase offer was declined or expired */
|
|
504
|
+
export interface ActionStarGiftPurchaseOfferDeclined {
|
|
505
|
+
readonly type: 'star_gift_purchase_offer_declined';
|
|
506
|
+
/** Whether the offer was auto-declined due to expiration */
|
|
507
|
+
expired: boolean;
|
|
508
|
+
gift: StarGiftUnique;
|
|
509
|
+
/** The amount of money refunded to the user who created the offer */
|
|
510
|
+
price: tl.TypeStarsAmount;
|
|
511
|
+
}
|
|
485
512
|
/** A star gift previously exported to the blockchain was assigned to your profile */
|
|
486
513
|
export interface ActionStarGiftAssigned extends StarGiftUniqueCommon {
|
|
487
514
|
readonly type: 'star_gift_assigned';
|
|
@@ -539,7 +566,7 @@ export interface ActionSuggestBirthday {
|
|
|
539
566
|
/** Birthday */
|
|
540
567
|
birthday: tl.RawBirthday;
|
|
541
568
|
}
|
|
542
|
-
export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | null;
|
|
569
|
+
export type MessageAction = ActionChatCreated | ActionChannelCreated | ActionChatMigrateTo | ActionChannelMigrateFrom | ActionMessagePinned | ActionHistoryCleared | ActionGameScore | ActionContactJoined | ActionTitleChanged | ActionPhotoChanged | ActionPhotoDeleted | ActionUsersAdded | ActionUserLeft | ActionUserRemoved | ActionUserJoinedLink | ActionPaymentReceived | ActionPaymentSent | ActionCall | ActionScreenshotTaken | ActionBotAllowed | ActionGeoProximity | ActionGroupCallStarted | ActionGroupCallEnded | ActionGroupCallScheduled | ActionGroupInvite | ActionTtlChanged | ActionTopicCreated | ActionTopicEdited | ActionCustom | ActionThemeChanged | ActionThemeChangedUnique | ActionUserJoinedApproved | ActionWebviewDataSent | ActionWebviewDataReceived | ActionPremiumGifted | ActionPhotoSuggested | ActionPeerSent | ActionPeerChosen | ActionWallpaperChanged | ActionGiftCode | ActionGiveawayStarted | ActionGiveawayEnded | ActionBoostApply | ActionPaymentRefunded | ActionStarGifted | ActionStarsPrize | ActionStarGiftSent | ActionStarGiftUpgradePaid | ActionStarGiftUpgraded | ActionStarGiftBoughtResale | ActionStarGiftTransferred | ActionStarGiftAssigned | ActionPaidMessagesPaid | ActionPaidMessagesRefunded | ActionTodoCompletions | ActionTodoAppendTasks | ActionTonGift | ActionSuggestBirthday | ActionStarGiftPurchaseOffer | ActionStarGiftPurchaseOfferDeclined | ActionStarGiftBoughtOffer | null;
|
|
543
570
|
/** @internal */
|
|
544
571
|
export declare function _messageActionFromTl(this: Message, act: tl.TypeMessageAction): MessageAction;
|
|
545
572
|
export {};
|