mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-02-10 00:43:09 +00:00
Change Content to seq[bytes] in bindings
This commit is contained in:
parent
c0dc3353f3
commit
b7ed94e1f3
@ -1,8 +1,18 @@
|
|||||||
import options
|
import options
|
||||||
import results
|
import results
|
||||||
|
import std/strutils
|
||||||
|
|
||||||
import ../src/libchat
|
import ../src/libchat
|
||||||
|
|
||||||
|
|
||||||
|
## Convert a string to seq[byte]
|
||||||
|
proc encode*(s: string): seq[byte] =
|
||||||
|
if s.len == 0:
|
||||||
|
return @[]
|
||||||
|
result = newSeq[byte](s.len)
|
||||||
|
copyMem(addr result[0], unsafeAddr s[0], s.len)
|
||||||
|
|
||||||
|
|
||||||
proc pingpong() =
|
proc pingpong() =
|
||||||
|
|
||||||
var raya = newConversationsContext()
|
var raya = newConversationsContext()
|
||||||
@ -13,7 +23,7 @@ proc pingpong() =
|
|||||||
let intro = raya.createIntroductionBundle().expect("[Raya] Couldn't create intro bundle")
|
let intro = raya.createIntroductionBundle().expect("[Raya] Couldn't create intro bundle")
|
||||||
echo "Raya's Intro Bundle: ",intro
|
echo "Raya's Intro Bundle: ",intro
|
||||||
|
|
||||||
var (convo_sr, payloads) = saro.createNewPrivateConvo(intro, "Hey Raya").expect("[Saro] Couldn't create convo")
|
var (convo_sr, payloads) = saro.createNewPrivateConvo(intro, encode("Hey Raya")).expect("[Saro] Couldn't create convo")
|
||||||
echo "ConvoId:: ", convo_sr
|
echo "ConvoId:: ", convo_sr
|
||||||
echo "Payload:: ", payloads
|
echo "Payload:: ", payloads
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user