fix(client): pass params for forward caption, also codegen-ed client

This commit is contained in:
teidesu 2022-06-21 21:07:54 +03:00
parent 11d91c1f55
commit 8822de2e1f
2 changed files with 123 additions and 2 deletions

View file

@ -2282,18 +2282,78 @@ export interface TelegramClient extends BaseTelegramClient {
message: number, message: number,
params?: { params?: {
/** /**
* Whether to forward this message silently. * Optionally, a caption for your forwarded message(s).
* It will be sent as a separate message before the forwarded messages.
*
* You can either pass `caption` or `captionMedia`, passing both will
* result in an error
*/
caption?: string | FormattedString<any>
/**
* Optionally, a media caption for your forwarded message(s).
* It will be sent as a separate message before the forwarded messages.
*
* You can either pass `caption` or `captionMedia`, passing both will
* result in an error
*/
captionMedia?: InputMediaLike
/**
* Parse mode to use to parse entities in caption.
* Defaults to current default parse mode (if any).
*
* Passing `null` will explicitly disable formatting.
*/
parseMode?: string | null
/**
* List of formatting entities in caption to use instead
* of parsing via a parse mode.
*
* **Note:** Passing this makes the method ignore {@link parseMode}
*/
entities?: tl.TypeMessageEntity[]
/**
* Whether to forward silently (also applies to caption message).
*/ */
silent?: boolean silent?: boolean
/** /**
* If set, the message will be scheduled to this date. * If set, the forwarding will be scheduled to this date
* (also applies to caption message).
* When passing a number, a UNIX time in ms is expected. * When passing a number, a UNIX time in ms is expected.
* *
* You can also pass `0x7FFFFFFE`, this will send the message * You can also pass `0x7FFFFFFE`, this will send the message
* once the peer is online * once the peer is online
*/ */
schedule?: Date | number schedule?: Date | number
/**
* Whether to clear draft after sending this message (only used for caption)
*
* Defaults to `false`
*/
clearDraft?: boolean
/**
* Whether to forward without author
*/
noAuthor?: boolean
/**
* Whether to forward without caption (implies {@link noAuthor})
*/
noCaption?: boolean
/**
* Whether to disallow further forwards of this message.
*
* Only for bots, works even if the target chat does not
* have content protection.
*/
forbidForwards?: boolean
} }
): Promise<Message> ): Promise<Message>
/** /**
@ -2370,6 +2430,24 @@ export interface TelegramClient extends BaseTelegramClient {
* Defaults to `false` * Defaults to `false`
*/ */
clearDraft?: boolean clearDraft?: boolean
/**
* Whether to forward without author
*/
noAuthor?: boolean
/**
* Whether to forward without caption (implies {@link noAuthor})
*/
noCaption?: boolean
/**
* Whether to disallow further forwards of this message.
*
* Only for bots, works even if the target chat does not
* have content protection.
*/
forbidForwards?: boolean
} }
): Promise<MaybeArray<Message>> ): Promise<MaybeArray<Message>>
// public version of the same method because why not // public version of the same method because why not
@ -2956,6 +3034,19 @@ export interface TelegramClient extends BaseTelegramClient {
* Defaults to `false` * Defaults to `false`
*/ */
clearDraft?: boolean clearDraft?: boolean
/**
* Whether to disallow further forwards of this message.
*
* Only for bots, works even if the target chat does not
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
} }
): Promise<Message[]> ): Promise<Message[]>
/** /**
@ -3058,6 +3149,19 @@ export interface TelegramClient extends BaseTelegramClient {
* Defaults to `false` * Defaults to `false`
*/ */
clearDraft?: boolean clearDraft?: boolean
/**
* Whether to disallow further forwards of this message.
*
* Only for bots, works even if the target chat does not
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
} }
): Promise<Message> ): Promise<Message>
/** /**
@ -3180,6 +3284,19 @@ export interface TelegramClient extends BaseTelegramClient {
* Defaults to `false` * Defaults to `false`
*/ */
clearDraft?: boolean clearDraft?: boolean
/**
* Whether to disallow further forwards of this message.
*
* Only for bots, works even if the target chat does not
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
} }
): Promise<Message> ): Promise<Message>
/** /**

View file

@ -316,6 +316,8 @@ export async function forwardMessages(
silent: params.silent, silent: params.silent,
schedule: params.schedule, schedule: params.schedule,
clearDraft: params.clearDraft, clearDraft: params.clearDraft,
forbidForwards: params.forbidForwards,
sendAs: params.sendAs
}) })
} else if (params.captionMedia) { } else if (params.captionMedia) {
captionMessage = await this.sendMedia(toPeer, params.captionMedia, { captionMessage = await this.sendMedia(toPeer, params.captionMedia, {
@ -323,6 +325,8 @@ export async function forwardMessages(
silent: params.silent, silent: params.silent,
schedule: params.schedule, schedule: params.schedule,
clearDraft: params.clearDraft, clearDraft: params.clearDraft,
forbidForwards: params.forbidForwards,
sendAs: params.sendAs
}) })
} }