feat(client): support sending as peer

This commit is contained in:
teidesu 2022-06-21 21:05:27 +03:00
parent 1be12d9917
commit 11d91c1f55
4 changed files with 28 additions and 4 deletions

View file

@ -282,6 +282,11 @@ export async function forwardMessages(
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
}
): Promise<MaybeArray<Message>> {
if (!params) params = {}
@ -333,7 +338,8 @@ export async function forwardMessages(
),
dropAuthor: params.noAuthor,
dropMediaCaptions: params.noCaption,
noforwards: params.forbidForwards
noforwards: params.forbidForwards,
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
})
assertIsUpdatesGroup('messages.forwardMessages', res)

View file

@ -113,6 +113,11 @@ export async function sendMediaGroup(
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
}
): Promise<Message[]> {
if (!params) params = {}
@ -188,7 +193,8 @@ export async function sendMediaGroup(
scheduleDate: normalizeDate(params.schedule),
replyMarkup,
clearDraft: params.clearDraft,
noforwards: params.forbidForwards
noforwards: params.forbidForwards,
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
})
assertIsUpdatesGroup('_findMessageInUpdate', res)

View file

@ -122,6 +122,11 @@ export async function sendMedia(
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
}
): Promise<Message> {
if (!params) params = {}
@ -178,7 +183,8 @@ export async function sendMedia(
message,
entities,
clearDraft: params.clearDraft,
noforwards: params.forbidForwards
noforwards: params.forbidForwards,
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
})
const msg = this._findMessageInUpdate(res)

View file

@ -109,6 +109,11 @@ export async function sendText(
* have content protection.
*/
forbidForwards?: boolean
/**
* Peer to use when sending the message.
*/
sendAs?: InputPeerLike
}
): Promise<Message> {
if (!params) params = {}
@ -154,7 +159,8 @@ export async function sendText(
message,
entities,
clearDraft: params.clearDraft,
noforwards: params.forbidForwards
noforwards: params.forbidForwards,
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
})
if (res._ === 'updateShortSentMessage') {