mirror of
https://github.com/status-im/status-lib.git
synced 2025-02-16 22:36:56 +00:00
refactor(chat): add function to send messages (#141)
This commit is contained in:
parent
fbd06ca881
commit
623d3b0def
@ -52,6 +52,31 @@ proc deactivateChat*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception
|
||||
proc clearChatHistory*(chatId: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
callPrivateRPC("deleteMessagesByChatID".prefix, %* [chatId])
|
||||
|
||||
proc sendChatMessage*(
|
||||
chatId: string,
|
||||
msg: string,
|
||||
replyTo: string,
|
||||
contentType: int,
|
||||
preferredUsername: string = "",
|
||||
communityId: string = "",
|
||||
stickerHash: string = "",
|
||||
stickerPack: int = 0,
|
||||
): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
result = callPrivateRPC("sendChatMessage".prefix, %* [
|
||||
{
|
||||
"chatId": chatId,
|
||||
"text": msg,
|
||||
"responseTo": replyTo,
|
||||
"ensName": preferredUsername,
|
||||
"sticker": {
|
||||
"hash": stickerHash,
|
||||
"pack": stickerPack
|
||||
},
|
||||
"contentType": contentType,
|
||||
"communityId": communityId
|
||||
}
|
||||
])
|
||||
|
||||
proc sendImages*(chatId: string, images: var seq[string]): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
let imagesJson = %* images.map(image => %*
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
import json
|
||||
import ../statusgo_backend_new/eth as eth
|
||||
|
||||
import ./eth
|
||||
|
||||
# Retrieves number of sticker packs owned by user
|
||||
# See https://notes.status.im/Q-sQmQbpTOOWCQcYiXtf5g#Read-Sticker-Packs-owned-by-a-user
|
||||
|
Loading…
x
Reference in New Issue
Block a user