kyra
SIASapphire - Imagine a framework
β’Created by RookieAND_ on 12/17/2024 in #sapphire-support
What is the role of a Piece and a Store in SapphireJS?
To put it in an analogy, think of it as a puzzle, the collection (Store) of the pieces (Piece) make up your app's behaviour.
4 replies
SIASapphire - Imagine a framework
β’Created by WhacK on 12/1/2024 in #sapphire-support
string-store not finding identifiers other than first in Schema on deserialize typescript
Your store has 2 schemas, so when it deserializes a buffer, it can be one of the two. Compare the
id
or cast the value to the correct type to fix this.8 replies
SIASapphire - Imagine a framework
β’Created by ShowCast on 11/25/2024 in #sapphire-support
Unexspected end of JSON input
You shouldn't read the body twice π
9 replies
SIASapphire - Imagine a framework
β’Created by ShowCast on 11/25/2024 in #sapphire-support
Unexspected end of JSON input
You have a leading comma at license_key, which is a syntax error in JSON, and youβre not closing the top brace (
{}
)9 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
And sorry for the delay π
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
You're welcome!
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
Either way, 100 or 200 bytes, the unaligned key-less data can still store a lot of data :p
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
(Which would double our size limit XD)
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
The most likely alternative being Rust... which uses UTF32
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
That'll happen the day Discord changes the API from Python to something else
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
That being said, we rarely ever change our libraries, specially the newest ones, so I don't expect to see a semver-major in the foreseeable future
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
And
Schema
's API is subject to semver, so if it changed in a way it'd require a change in SchemaStore
, it would be a semver-major change42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
The protocol is something that must stay the same as otherwise different versions of
string-store
would throw.42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
That's more on your implementation than on the library :p
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
Oh yeah, sure, just make sure to remember that users may forge the string or modify it in a way it becomes invalid
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
I mean, the system is quite generic but... yeah it's mostly for abusing Discord's UTF16
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
In
custom_id
? Just data.toString()
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
In the codeblock? You should use base64 if it's going to be exposed in plain-text to the user on Discord, a browser, or similar
42 replies
SIASapphire - Imagine a framework
β’Created by Amgelo on 11/19/2024 in #sapphire-support
Serializing string-store result inside another schema
I don't think it's a good idea to let users write or paste raw
string-store
data, for starters, it produces strings created by abusing the underlying UTF16 standard, which can lead to very confusing characters... and invisible ones, among which NULL
(\0
), which is often the delimiter character at the end of a string in C (see strlen()
), which... Windows, Linux, and perhaps MacOS as well rely on.
That being said, if you convert the binary to base64, then you'll be able to share it in plain text on Discord more nicely. serialize
returns an instance of UnalignedUint16Array
after all, with some code you can convert it to base64, this should work:
As for serializing a string-store result inside another schema, it's completely doable as long as you remember to do data.toString()
, because it doesn't return a raw string. π42 replies