From 8822de2e1f627d85d24560940d9a5870549427a0 Mon Sep 17 00:00:00 2001 From: teidesu <86301490+teidesu@users.noreply.github.com> Date: Tue, 21 Jun 2022 21:07:54 +0300 Subject: [PATCH] fix(client): pass params for forward caption, also codegen-ed client --- packages/client/src/client.ts | 121 +++++++++++++++++- .../src/methods/messages/forward-messages.ts | 4 + 2 files changed, 123 insertions(+), 2 deletions(-) diff --git a/packages/client/src/client.ts b/packages/client/src/client.ts index ddf82df2..9e3e99a7 100644 --- a/packages/client/src/client.ts +++ b/packages/client/src/client.ts @@ -2282,18 +2282,78 @@ export interface TelegramClient extends BaseTelegramClient { message: number, 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 + + /** + * 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 /** - * 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. * * You can also pass `0x7FFFFFFE`, this will send the message * once the peer is online */ 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 /** @@ -2370,6 +2430,24 @@ export interface TelegramClient extends BaseTelegramClient { * 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> // public version of the same method because why not @@ -2956,6 +3034,19 @@ export interface TelegramClient extends BaseTelegramClient { * Defaults to `false` */ 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 /** @@ -3058,6 +3149,19 @@ export interface TelegramClient extends BaseTelegramClient { * Defaults to `false` */ 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 /** @@ -3180,6 +3284,19 @@ export interface TelegramClient extends BaseTelegramClient { * Defaults to `false` */ 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 /** diff --git a/packages/client/src/methods/messages/forward-messages.ts b/packages/client/src/methods/messages/forward-messages.ts index 6543d720..4902a2fa 100644 --- a/packages/client/src/methods/messages/forward-messages.ts +++ b/packages/client/src/methods/messages/forward-messages.ts @@ -316,6 +316,8 @@ export async function forwardMessages( silent: params.silent, schedule: params.schedule, clearDraft: params.clearDraft, + forbidForwards: params.forbidForwards, + sendAs: params.sendAs }) } else if (params.captionMedia) { captionMessage = await this.sendMedia(toPeer, params.captionMedia, { @@ -323,6 +325,8 @@ export async function forwardMessages( silent: params.silent, schedule: params.schedule, clearDraft: params.clearDraft, + forbidForwards: params.forbidForwards, + sendAs: params.sendAs }) }