Closed 2Cubed closed 6 years ago
How would we use this to create cross-service stuff?
@Innectic In the same way that our current format works.
If a user on Beam sends Hello! :cactus
and we receive a Beam-formatted packet, we then convert it to reflect the standard we set for these text-based packets. (Hello! π΅
)
Unicode emoji filtering is "impossible", unless you have a giant list of all Unicode emoji somewhere. Maybe use a custom regex? The following seems like it should work, without getting in the way of anything that would show up in a regular message (Favorite food: potato
, 12:56:43pm
, etc.).
:[a-zA-Z]\w+:
Closed in favor of a standard CactusBot format.
Currently, we store
MessagePackets
, comprising of components which each containdata
,text
, andtype
.While this is a good format, it makes storage errors due to parsing very easy. (For example, if stored with the incorrect
link
type instead ofurl
, the component will not be seen as a URL until the packet is re-added.)Instead, we should store plaintext, and use helper functions to perform operations on it.
For example, rather than storing
("Cactus! ", "Cactus! ", "text"), ("π΅", "π΅", "emoji")
, we would simply store"Cactus! π΅"
. Methods ofMessagePacket
would still perform the same operations, but using this simpler format, rather than the nested components.This will require far less mass updating of data for schema upgrades; if we currently wanted to make
variable
a validtype
currently, for example, we would have to change every storedMessagePacket
in the database. We also gain access to Python's powerful string processing tools, without having to use.text
or writing custom versions of the methods.