Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 messageSendTextV2 #231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions src/client/puppet-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,47 @@ class PuppetService extends PUPPET.Puppet {
}
}

override async messageSendTextV2 (
conversationId : string,
text : string[] | string,
mentionIdList? : string[],
): Promise<void | string> {
log.verbose('PuppetService', 'messageSendV2(%s, %s)', conversationId, JSON.stringify(text))

const request = new grpcPuppet.MessageSendTextRequest()
request.setConversationId(conversationId)
if (Array.isArray(text)) {
request.setTextList([ text ])
} else {
request.setTextList(text)
}
if (typeof mentionIdList !== 'undefined') {
request.setMentionalIdsList(mentionIdList)
}

const response = await util.promisify(
this.grpcManager.client.messageSendText
.bind(this.grpcManager.client),
)(request)

const messageId = response.getId()

if (messageId) {
return messageId
}

{
/**
* Huan(202110): Deprecated: will be removed after Dec 31, 2022
*/
const messageIdWrapper = response.getIdStringValueDeprecated()

if (messageIdWrapper) {
return messageIdWrapper.getValue()
}
}
}

override async messageSendFile (
conversationId : string,
fileBox : FileBoxInterface,
Expand Down