Add sendAs option to client.sendMessage#828
Open
zeynalnia wants to merge 1 commit into
Open
Conversation
69948d3 to
cc4d938
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #827.
Summary
Exposes the
send_asparameter (already present onmessages.sendMessagesincelayer 167) through the high-level
client.sendMessagewrapper, so callers nolonger need to drop down to
client.invoke(new Api.messages.SendMessage(...))just to post on behalf of a linked channel or anonymous-admin identity.
Changes
gramjs/client/messages.tssendAs?: EntityLiketoSendMessageParamswith JSDoc.client.getInputEntity(sendAs)alongside the target entity.InputPeerto bothApi.messages.SendMessageconstructions (the
Api.Message-resend branch and the fresh-text branch).__tests__/client/sendMessage.spec.ts(new)TelegramClient: (1) assertssendAsis resolvedand forwarded onto the constructed request, (2) asserts the field is left
undefinedwhen the option is omitted.Scope
Limited to the no-file path. The
filebranch delegates toclient.sendFile,which would need a separate change to thread
sendAsthroughmessages.SendMedia.Test plan
npx jest __tests__/client/sendMessage.spec.ts— both specs pass locally.linked channel.