feat(client): support sending as peer
This commit is contained in:
parent
1be12d9917
commit
11d91c1f55
4 changed files with 28 additions and 4 deletions
|
@ -282,6 +282,11 @@ export async function forwardMessages(
|
||||||
* have content protection.
|
* have content protection.
|
||||||
*/
|
*/
|
||||||
forbidForwards?: boolean
|
forbidForwards?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer to use when sending the message.
|
||||||
|
*/
|
||||||
|
sendAs?: InputPeerLike
|
||||||
}
|
}
|
||||||
): Promise<MaybeArray<Message>> {
|
): Promise<MaybeArray<Message>> {
|
||||||
if (!params) params = {}
|
if (!params) params = {}
|
||||||
|
@ -333,7 +338,8 @@ export async function forwardMessages(
|
||||||
),
|
),
|
||||||
dropAuthor: params.noAuthor,
|
dropAuthor: params.noAuthor,
|
||||||
dropMediaCaptions: params.noCaption,
|
dropMediaCaptions: params.noCaption,
|
||||||
noforwards: params.forbidForwards
|
noforwards: params.forbidForwards,
|
||||||
|
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
assertIsUpdatesGroup('messages.forwardMessages', res)
|
assertIsUpdatesGroup('messages.forwardMessages', res)
|
||||||
|
|
|
@ -113,6 +113,11 @@ export async function sendMediaGroup(
|
||||||
* have content protection.
|
* have content protection.
|
||||||
*/
|
*/
|
||||||
forbidForwards?: boolean
|
forbidForwards?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer to use when sending the message.
|
||||||
|
*/
|
||||||
|
sendAs?: InputPeerLike
|
||||||
}
|
}
|
||||||
): Promise<Message[]> {
|
): Promise<Message[]> {
|
||||||
if (!params) params = {}
|
if (!params) params = {}
|
||||||
|
@ -188,7 +193,8 @@ export async function sendMediaGroup(
|
||||||
scheduleDate: normalizeDate(params.schedule),
|
scheduleDate: normalizeDate(params.schedule),
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
clearDraft: params.clearDraft,
|
clearDraft: params.clearDraft,
|
||||||
noforwards: params.forbidForwards
|
noforwards: params.forbidForwards,
|
||||||
|
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
assertIsUpdatesGroup('_findMessageInUpdate', res)
|
assertIsUpdatesGroup('_findMessageInUpdate', res)
|
||||||
|
|
|
@ -122,6 +122,11 @@ export async function sendMedia(
|
||||||
* have content protection.
|
* have content protection.
|
||||||
*/
|
*/
|
||||||
forbidForwards?: boolean
|
forbidForwards?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer to use when sending the message.
|
||||||
|
*/
|
||||||
|
sendAs?: InputPeerLike
|
||||||
}
|
}
|
||||||
): Promise<Message> {
|
): Promise<Message> {
|
||||||
if (!params) params = {}
|
if (!params) params = {}
|
||||||
|
@ -178,7 +183,8 @@ export async function sendMedia(
|
||||||
message,
|
message,
|
||||||
entities,
|
entities,
|
||||||
clearDraft: params.clearDraft,
|
clearDraft: params.clearDraft,
|
||||||
noforwards: params.forbidForwards
|
noforwards: params.forbidForwards,
|
||||||
|
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
const msg = this._findMessageInUpdate(res)
|
const msg = this._findMessageInUpdate(res)
|
||||||
|
|
|
@ -109,6 +109,11 @@ export async function sendText(
|
||||||
* have content protection.
|
* have content protection.
|
||||||
*/
|
*/
|
||||||
forbidForwards?: boolean
|
forbidForwards?: boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Peer to use when sending the message.
|
||||||
|
*/
|
||||||
|
sendAs?: InputPeerLike
|
||||||
}
|
}
|
||||||
): Promise<Message> {
|
): Promise<Message> {
|
||||||
if (!params) params = {}
|
if (!params) params = {}
|
||||||
|
@ -154,7 +159,8 @@ export async function sendText(
|
||||||
message,
|
message,
|
||||||
entities,
|
entities,
|
||||||
clearDraft: params.clearDraft,
|
clearDraft: params.clearDraft,
|
||||||
noforwards: params.forbidForwards
|
noforwards: params.forbidForwards,
|
||||||
|
sendAs: params.sendAs ? await this.resolvePeer(params.sendAs) : undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
if (res._ === 'updateShortSentMessage') {
|
if (res._ === 'updateShortSentMessage') {
|
||||||
|
|
Loading…
Reference in a new issue