feat(client): support noforward flag when sending

This commit is contained in:
teidesu 2022-06-21 20:59:25 +03:00
parent 7d71728868
commit 1be12d9917
4 changed files with 52 additions and 3 deletions

View file

@ -95,6 +95,14 @@ export async function forwardMessages(
* 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>
@ -184,6 +192,14 @@ export async function forwardMessages(
* 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>>
@ -258,6 +274,14 @@ export async function forwardMessages(
* 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>> {
if (!params) params = {}
@ -309,6 +333,7 @@ export async function forwardMessages(
),
dropAuthor: params.noAuthor,
dropMediaCaptions: params.noCaption,
noforwards: params.forbidForwards
})
assertIsUpdatesGroup('messages.forwardMessages', res)

View file

@ -105,6 +105,14 @@ export async function sendMediaGroup(
* 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
}
): Promise<Message[]> {
if (!params) params = {}
@ -180,6 +188,7 @@ export async function sendMediaGroup(
scheduleDate: normalizeDate(params.schedule),
replyMarkup,
clearDraft: params.clearDraft,
noforwards: params.forbidForwards
})
assertIsUpdatesGroup('_findMessageInUpdate', res)

View file

@ -114,6 +114,14 @@ export async function sendMedia(
* 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
}
): Promise<Message> {
if (!params) params = {}
@ -170,6 +178,7 @@ export async function sendMedia(
message,
entities,
clearDraft: params.clearDraft,
noforwards: params.forbidForwards
})
const msg = this._findMessageInUpdate(res)

View file

@ -101,6 +101,14 @@ export async function sendText(
* 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
}
): Promise<Message> {
if (!params) params = {}
@ -146,10 +154,8 @@ export async function sendText(
message,
entities,
clearDraft: params.clearDraft,
noforwards: params.forbidForwards
})
// } catch (e) {
//
// }
if (res._ === 'updateShortSentMessage') {
const msg: tl.RawMessage = {