feat: sending audio messages (#55)
Co-authored-by: Andrei Smirnov <andrei.smirnov@toptal.com>
This commit is contained in:
parent
5285cf7d8c
commit
4a5094644f
|
@ -350,6 +350,10 @@ proc editMessage*(self: ChatModel, messageId: string, msg: string) =
|
|||
var response = status_chat.editMessage(messageId, msg)
|
||||
discard self.processMessageUpdateAfterSend(response)
|
||||
|
||||
proc sendAudio*(self: ChatModel, chatId: string, audioBase64: string, durationMs: uint64) =
|
||||
var response = status_chat.sendAudioMessage(chatId, audioBase64, durationMs)
|
||||
discard self.processMessageUpdateAfterSend(response)
|
||||
|
||||
proc sendImage*(self: ChatModel, chatId: string, image: string) =
|
||||
var response = status_chat.sendImageMessage(chatId, image)
|
||||
discard self.processMessageUpdateAfterSend(response)
|
||||
|
|
|
@ -127,6 +127,19 @@ proc sendChatMessage*(chatId: string, msg: string, replyTo: string, contentType:
|
|||
}
|
||||
])
|
||||
|
||||
proc sendAudioMessage*(chatId: string, audioBase64: string, durationMs: uint64): string =
|
||||
let preferredUsername = getSetting[string](Setting.PreferredUsername, "")
|
||||
callPrivateRPC("sendChatMessage".prefix, %* [
|
||||
{
|
||||
"chatId": chatId,
|
||||
"contentType": ContentType.Audio.int,
|
||||
"base64Audio": audioBase64,
|
||||
"audioDurationMs": durationMs,
|
||||
"ensName": preferredUsername,
|
||||
"text": "Update to latest version to hear this audio!"
|
||||
}
|
||||
])
|
||||
|
||||
proc sendImageMessage*(chatId: string, image: string): string =
|
||||
let preferredUsername = getSetting[string](Setting.PreferredUsername, "")
|
||||
callPrivateRPC("sendChatMessage".prefix, %* [
|
||||
|
|
Loading…
Reference in New Issue