@mtcute/core 0.27.2 → 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 +80 -68
- package/client.js +80 -68
- 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 +322 -278
- package/highlevel/client.d.ts +322 -278
- 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 +23 -18
- package/highlevel/methods.d.ts +23 -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 +12 -3
- package/highlevel/types/premium/star-gift.d.cts +5 -0
- package/highlevel/types/premium/star-gift.d.ts +5 -0
- package/highlevel/types/premium/star-gift.js +12 -3
- 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 +40 -34
- package/methods.js +23 -17
- 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,30 @@
|
|
|
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 starGiftUnique = require("../../types/premium/star-gift-unique.cjs");
|
|
9
|
+
async function getStarGiftUpgradeOptions(client, giftId) {
|
|
10
|
+
const res = await client.call({
|
|
11
|
+
_: "payments.getStarGiftUpgradeAttributes",
|
|
12
|
+
giftId
|
|
13
|
+
});
|
|
14
|
+
const ret = {
|
|
15
|
+
models: [],
|
|
16
|
+
patterns: [],
|
|
17
|
+
backdrops: []
|
|
18
|
+
};
|
|
19
|
+
for (const attr of res.attributes) {
|
|
20
|
+
if (attr._ === "starGiftAttributeModel") {
|
|
21
|
+
ret.models.push(new starGiftUnique.StarGiftUniqueAttribute(attr));
|
|
22
|
+
} else if (attr._ === "starGiftAttributePattern") {
|
|
23
|
+
ret.patterns.push(new starGiftUnique.StarGiftUniqueAttribute(attr));
|
|
24
|
+
} else if (attr._ === "starGiftAttributeBackdrop") {
|
|
25
|
+
ret.backdrops.push(new starGiftUnique.StarGiftUniqueBackdrop(attr));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return ret;
|
|
29
|
+
}
|
|
30
|
+
exports.getStarGiftUpgradeOptions = getStarGiftUpgradeOptions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { StarGiftUniqueAttribute, StarGiftUniqueBackdrop } from '../../types/index.js';
|
|
4
|
+
export interface StarGiftUpgradeOptions {
|
|
5
|
+
models: StarGiftUniqueAttribute[];
|
|
6
|
+
patterns: StarGiftUniqueAttribute[];
|
|
7
|
+
backdrops: StarGiftUniqueBackdrop[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get a list of all possible attributes when upgrading a given star gift
|
|
11
|
+
*/
|
|
12
|
+
export declare function getStarGiftUpgradeOptions(client: ITelegramClient, giftId: tl.Long): Promise<StarGiftUpgradeOptions>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { ITelegramClient } from '../../client.types.js';
|
|
3
|
+
import { StarGiftUniqueAttribute, StarGiftUniqueBackdrop } from '../../types/index.js';
|
|
4
|
+
export interface StarGiftUpgradeOptions {
|
|
5
|
+
models: StarGiftUniqueAttribute[];
|
|
6
|
+
patterns: StarGiftUniqueAttribute[];
|
|
7
|
+
backdrops: StarGiftUniqueBackdrop[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get a list of all possible attributes when upgrading a given star gift
|
|
11
|
+
*/
|
|
12
|
+
export declare function getStarGiftUpgradeOptions(client: ITelegramClient, giftId: tl.Long): Promise<StarGiftUpgradeOptions>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StarGiftUniqueAttribute as StarGiftUniqueAttribute$2, StarGiftUniqueBackdrop as StarGiftUniqueBackdrop$1 } from "../../types/premium/star-gift-unique.js";
|
|
2
|
+
async function getStarGiftUpgradeOptions(client, giftId) {
|
|
3
|
+
const res = await client.call({
|
|
4
|
+
_: "payments.getStarGiftUpgradeAttributes",
|
|
5
|
+
giftId
|
|
6
|
+
});
|
|
7
|
+
const ret = {
|
|
8
|
+
models: [],
|
|
9
|
+
patterns: [],
|
|
10
|
+
backdrops: []
|
|
11
|
+
};
|
|
12
|
+
for (const attr of res.attributes) {
|
|
13
|
+
if (attr._ === "starGiftAttributeModel") {
|
|
14
|
+
ret.models.push(new StarGiftUniqueAttribute$2(attr));
|
|
15
|
+
} else if (attr._ === "starGiftAttributePattern") {
|
|
16
|
+
ret.patterns.push(new StarGiftUniqueAttribute$2(attr));
|
|
17
|
+
} else if (attr._ === "starGiftAttributeBackdrop") {
|
|
18
|
+
ret.backdrops.push(new StarGiftUniqueBackdrop$1(attr));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return ret;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
getStarGiftUpgradeOptions
|
|
25
|
+
};
|
|
@@ -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
|
@@ -119,6 +119,28 @@ export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-clos
|
|
|
119
119
|
export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
|
|
120
120
|
export { updateForumSettings } from './methods/forums/toggle-forum.js';
|
|
121
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';
|
|
122
144
|
export { createInviteLink } from './methods/invite-links/create-invite-link.js';
|
|
123
145
|
export { editInviteLink } from './methods/invite-links/edit-invite-link.js';
|
|
124
146
|
export { exportInviteLink } from './methods/invite-links/export-invite-link.js';
|
|
@@ -218,10 +240,8 @@ export { verifyPasswordEmail } from './methods/password/password-email.js';
|
|
|
218
240
|
export { resendPasswordEmail } from './methods/password/password-email.js';
|
|
219
241
|
export { cancelPasswordEmail } from './methods/password/password-email.js';
|
|
220
242
|
export { removeCloudPassword } from './methods/password/remove-cloud-password.js';
|
|
221
|
-
export {
|
|
222
|
-
export { acceptStarGift } from './methods/premium/accept-star-gift.js';
|
|
243
|
+
export type { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
|
|
223
244
|
export { applyBoost } from './methods/premium/apply-boost.js';
|
|
224
|
-
export { buyResaleGift } from './methods/premium/buy-resale-gift.js';
|
|
225
245
|
export { canApplyBoost } from './methods/premium/can-apply-boost.js';
|
|
226
246
|
export type { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
227
247
|
export { createBusinessChatLink } from './methods/premium/create-business-chat-link.js';
|
|
@@ -232,26 +252,11 @@ export { getBoosts } from './methods/premium/get-boosts.js';
|
|
|
232
252
|
export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
|
|
233
253
|
export { getBusinessConnection } from './methods/premium/get-business-connection.js';
|
|
234
254
|
export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
|
|
235
|
-
export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
|
|
236
|
-
export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
237
|
-
export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
|
|
238
|
-
export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
|
|
239
|
-
export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
|
|
240
|
-
export { getStarGiftValue } from './methods/premium/get-star-gift-value.js';
|
|
241
|
-
export { getStarGiftWithdrawalUrl } from './methods/premium/get-star-gift-withdrawal-url.js';
|
|
242
255
|
export { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
|
|
243
|
-
export { getUniqueStarGift } from './methods/premium/get-unique-star-gift.js';
|
|
244
256
|
export { iterBoosters } from './methods/premium/iter-boosters.js';
|
|
245
|
-
export { iterSavedStarGifts } from './methods/premium/iter-saved-star-gifts.js';
|
|
246
257
|
export { iterStarsTransactions } from './methods/premium/iter-stars-transactions.js';
|
|
247
|
-
export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
|
|
248
|
-
export { prepayStarGiftUpgrade } from './methods/premium/prepay-star-gift-upgrade.js';
|
|
249
|
-
export { sendStarGift } from './methods/premium/send-star-gift.js';
|
|
250
258
|
export { setBusinessIntro } from './methods/premium/set-business-intro.js';
|
|
251
259
|
export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
|
|
252
|
-
export { setResaleStarGiftPrice } from './methods/premium/set-gift-resale-price.js';
|
|
253
|
-
export { transferStarGift } from './methods/premium/transfer-star-gift.js';
|
|
254
|
-
export { upgradeStarGift } from './methods/premium/upgrade-star-gift.js';
|
|
255
260
|
export { addStickerToSet } from './methods/stickers/add-sticker-to-set.js';
|
|
256
261
|
export { createStickerSet } from './methods/stickers/create-sticker-set.js';
|
|
257
262
|
export { deleteStickerFromSet } from './methods/stickers/delete-sticker-from-set.js';
|
package/highlevel/methods.d.ts
CHANGED
|
@@ -119,6 +119,28 @@ export { toggleForumTopicClosed } from './methods/forums/toggle-forum-topic-clos
|
|
|
119
119
|
export { toggleForumTopicPinned } from './methods/forums/toggle-forum-topic-pinned.js';
|
|
120
120
|
export { updateForumSettings } from './methods/forums/toggle-forum.js';
|
|
121
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';
|
|
122
144
|
export { createInviteLink } from './methods/invite-links/create-invite-link.js';
|
|
123
145
|
export { editInviteLink } from './methods/invite-links/edit-invite-link.js';
|
|
124
146
|
export { exportInviteLink } from './methods/invite-links/export-invite-link.js';
|
|
@@ -218,10 +240,8 @@ export { verifyPasswordEmail } from './methods/password/password-email.js';
|
|
|
218
240
|
export { resendPasswordEmail } from './methods/password/password-email.js';
|
|
219
241
|
export { cancelPasswordEmail } from './methods/password/password-email.js';
|
|
220
242
|
export { removeCloudPassword } from './methods/password/remove-cloud-password.js';
|
|
221
|
-
export {
|
|
222
|
-
export { acceptStarGift } from './methods/premium/accept-star-gift.js';
|
|
243
|
+
export type { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
|
|
223
244
|
export { applyBoost } from './methods/premium/apply-boost.js';
|
|
224
|
-
export { buyResaleGift } from './methods/premium/buy-resale-gift.js';
|
|
225
245
|
export { canApplyBoost } from './methods/premium/can-apply-boost.js';
|
|
226
246
|
export type { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
|
|
227
247
|
export { createBusinessChatLink } from './methods/premium/create-business-chat-link.js';
|
|
@@ -232,26 +252,11 @@ export { getBoosts } from './methods/premium/get-boosts.js';
|
|
|
232
252
|
export { getBusinessChatLinks } from './methods/premium/get-business-chat-links.js';
|
|
233
253
|
export { getBusinessConnection } from './methods/premium/get-business-connection.js';
|
|
234
254
|
export { getMyBoostSlots } from './methods/premium/get-my-boost-slots.js';
|
|
235
|
-
export { getStarGiftResaleOptions } from './methods/premium/get-resale-star-gifts.js';
|
|
236
|
-
export type { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/premium/get-resale-star-gifts.js';
|
|
237
|
-
export { getSavedStarGiftsById } from './methods/premium/get-saved-star-gifts-by-id.js';
|
|
238
|
-
export { getSavedStarGifts } from './methods/premium/get-saved-star-gifts.js';
|
|
239
|
-
export { getStarGiftOptions } from './methods/premium/get-star-gift-options.js';
|
|
240
|
-
export { getStarGiftValue } from './methods/premium/get-star-gift-value.js';
|
|
241
|
-
export { getStarGiftWithdrawalUrl } from './methods/premium/get-star-gift-withdrawal-url.js';
|
|
242
255
|
export { getStarsTransactions } from './methods/premium/get-stars-transactions.js';
|
|
243
|
-
export { getUniqueStarGift } from './methods/premium/get-unique-star-gift.js';
|
|
244
256
|
export { iterBoosters } from './methods/premium/iter-boosters.js';
|
|
245
|
-
export { iterSavedStarGifts } from './methods/premium/iter-saved-star-gifts.js';
|
|
246
257
|
export { iterStarsTransactions } from './methods/premium/iter-stars-transactions.js';
|
|
247
|
-
export { togglePinnedStarGifts } from './methods/premium/pin-star-gift.js';
|
|
248
|
-
export { prepayStarGiftUpgrade } from './methods/premium/prepay-star-gift-upgrade.js';
|
|
249
|
-
export { sendStarGift } from './methods/premium/send-star-gift.js';
|
|
250
258
|
export { setBusinessIntro } from './methods/premium/set-business-intro.js';
|
|
251
259
|
export { setBusinessWorkHours } from './methods/premium/set-business-work-hours.js';
|
|
252
|
-
export { setResaleStarGiftPrice } from './methods/premium/set-gift-resale-price.js';
|
|
253
|
-
export { transferStarGift } from './methods/premium/transfer-star-gift.js';
|
|
254
|
-
export { upgradeStarGift } from './methods/premium/upgrade-star-gift.js';
|
|
255
260
|
export { addStickerToSet } from './methods/stickers/add-sticker-to-set.js';
|
|
256
261
|
export { createStickerSet } from './methods/stickers/create-sticker-set.js';
|
|
257
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
|
}
|