mirror of
https://github.com/zhigang1992/mtcute.git
synced 2026-01-12 17:32:35 +08:00
fix(core)!: allow null as return of star gift related methods
This commit is contained in:
@@ -4928,7 +4928,7 @@ export interface TelegramClient extends ITelegramClient {
|
||||
*
|
||||
* **Available**: 👤 users only
|
||||
*
|
||||
* @returns Service message about the sent gift
|
||||
* @returns Service message about the sent gift, if one was generated.
|
||||
*/
|
||||
sendStarGift(
|
||||
params: {
|
||||
@@ -4956,7 +4956,7 @@ export interface TelegramClient extends ITelegramClient {
|
||||
* to the client's update handler.
|
||||
*/
|
||||
shouldDispatch?: true
|
||||
}): Promise<Message>
|
||||
}): Promise<Message | null>
|
||||
|
||||
/**
|
||||
* Set current user's business introduction.
|
||||
@@ -5016,7 +5016,7 @@ export interface TelegramClient extends ITelegramClient {
|
||||
*
|
||||
* **Available**: 👤 users only
|
||||
*
|
||||
* @returns Service message about the transferred gift
|
||||
* @returns Service message about the transferred gift, if one was generated.
|
||||
*/
|
||||
transferStarGift(
|
||||
params: {
|
||||
@@ -5031,7 +5031,7 @@ export interface TelegramClient extends ITelegramClient {
|
||||
* to the client's update handler.
|
||||
*/
|
||||
shouldDispatch?: true
|
||||
}): Promise<Message>
|
||||
}): Promise<Message | null>
|
||||
/**
|
||||
* Upgrades a star gift to a unique gift.
|
||||
*
|
||||
@@ -5042,7 +5042,7 @@ export interface TelegramClient extends ITelegramClient {
|
||||
*
|
||||
* **Available**: 👤 users only
|
||||
*
|
||||
* @returns Service message about the upgraded gift
|
||||
* @returns Service message about the upgraded gift, if one was generated.
|
||||
*/
|
||||
upgradeStarGift(
|
||||
params: {
|
||||
@@ -5059,7 +5059,7 @@ export interface TelegramClient extends ITelegramClient {
|
||||
* to the client's update handler.
|
||||
*/
|
||||
shouldDispatch?: true
|
||||
}): Promise<Message>
|
||||
}): Promise<Message | null>
|
||||
/**
|
||||
* Add a sticker to a sticker set.
|
||||
*
|
||||
|
||||
@@ -18,7 +18,7 @@ import { resolvePeer } from '../users/resolve-peer.js'
|
||||
* > For GUI clients, you should refer to the method's source code and
|
||||
* > present the payment form to the user.
|
||||
*
|
||||
* @returns Service message about the sent gift
|
||||
* @returns Service message about the sent gift, if one was generated.
|
||||
*/
|
||||
export async function sendStarGift(
|
||||
client: ITelegramClient,
|
||||
@@ -48,7 +48,7 @@ export async function sendStarGift(
|
||||
*/
|
||||
shouldDispatch?: true
|
||||
},
|
||||
): Promise<Message> {
|
||||
): Promise<Message | null> {
|
||||
const {
|
||||
peerId,
|
||||
gift,
|
||||
@@ -80,5 +80,5 @@ export async function sendStarGift(
|
||||
|
||||
assertTypeIs('payments.sendStarsForm', res, 'payments.paymentResult')
|
||||
|
||||
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch)
|
||||
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch, true)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { _normalizeInputStarGift } from './_normalize-input-star-gift.js'
|
||||
* > For GUI clients, you should refer to the method's source code and
|
||||
* > present the payment form to the user.
|
||||
*
|
||||
* @returns Service message about the transferred gift
|
||||
* @returns Service message about the transferred gift, if one was generated.
|
||||
*/
|
||||
export async function transferStarGift(
|
||||
client: ITelegramClient,
|
||||
@@ -33,7 +33,7 @@ export async function transferStarGift(
|
||||
*/
|
||||
shouldDispatch?: true
|
||||
},
|
||||
): Promise<Message> {
|
||||
): Promise<Message | null> {
|
||||
const { gift, recepient, shouldDispatch } = params
|
||||
|
||||
const invoice: tl.TypeInputInvoice = {
|
||||
@@ -55,5 +55,5 @@ export async function transferStarGift(
|
||||
|
||||
assertTypeIs('payments.sendStarsForm', res, 'payments.paymentResult')
|
||||
|
||||
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch)
|
||||
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch, true)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { _normalizeInputStarGift } from './_normalize-input-star-gift.js'
|
||||
* > For GUI clients, you should refer to the method's source code and
|
||||
* > present the payment form to the user.
|
||||
*
|
||||
* @returns Service message about the upgraded gift
|
||||
* @returns Service message about the upgraded gift, if one was generated.
|
||||
*/
|
||||
export async function upgradeStarGift(
|
||||
client: ITelegramClient,
|
||||
@@ -34,7 +34,7 @@ export async function upgradeStarGift(
|
||||
*/
|
||||
shouldDispatch?: true
|
||||
},
|
||||
): Promise<Message> {
|
||||
): Promise<Message | null> {
|
||||
const { gift, keepOriginalDetails, shouldDispatch } = params
|
||||
|
||||
const invoice: tl.TypeInputInvoice = {
|
||||
@@ -56,5 +56,5 @@ export async function upgradeStarGift(
|
||||
|
||||
assertTypeIs('payments.sendStarsForm', res, 'payments.paymentResult')
|
||||
|
||||
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch)
|
||||
return _findMessageInUpdate(client, res.updates, false, !shouldDispatch, true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user