Has Anyone Used Reacord With Sapphire?

Not really a support question more of a discussion question just curious, it's a way of writing Discord menus with React - did a quick test with it on my bot I'm developing and holy cow it is such a nice way of making these UIs I got to delete a bunch of boilerplate code Only downside is that the buttons don't continue to work after you restart which I'll have to use Sapphire interaction handlers for Relevant Repo Links: Reacord - https://github.com/itsMapleLeaf/reacord Some WIP Code I'm doing - https://github.com/AnswerOverflow/AnswerOverflow/tree/Turbo-Repo-Base/apps/discord-bot
GitHub
GitHub - itsMapleLeaf/reacord: Create interactive Discord messages ...
Create interactive Discord messages using React. ⚛ - GitHub - itsMapleLeaf/reacord: Create interactive Discord messages using React. ⚛
GitHub
AnswerOverflow/apps/discord-bot at Turbo-Repo-Base · AnswerOverflow...
Contribute to AnswerOverflow/AnswerOverflow development by creating an account on GitHub.
12 Replies
Favna
Favna2y ago
Never heard of the library but the concept is familiar. It's really interesting how they make buttons stateful like this.
24
242y ago
That guy who created the lib is also kinda cool I wouldn't want to pull in react JUST for that though
Rhys
Rhys2y ago
I suppose this is a factor but imo since you're not shipping your bot code to any clients it doesn't effect it too much right? Other than possibly longer build times on testing / CI / deployment
Favna
Favna2y ago
This tbh. Also React is very tiny. Only 330 KB @24 It's the packages people install besides React that are large
24
242y ago
True
Rhys
Rhys2y ago
There's also Preact if it's a concern, although not sure if it'd work with this lib
24
242y ago
Seems odd though Just feels wrong if that makes sense
Favna
Favna2y ago
I.e. if you use create react app that pulls in over 300 transient dependencies
24
242y ago
CRA is a disgrace to humanity
Rhys
Rhys2y ago
Oh yeah it feels wrong but works so well 😅 I'd love it if this could handle button interactions between bot restarts, gonna take a peek into the code and see if that's possible at all Otherwise I'll just use it for ephemeral menus
Favna
Favna2y ago
Seeing as they use react state I'm guessing it's not. They'd have to probably add a Redis caching layer somehow.
Rhys
Rhys2y ago
Yeah that makes sense, it looks like they make random GUIDs for the buttons when you make a component so what you could possibly do is introduce a stateless component concept purely for menus that don’t change And use static IDs for those At that point though I think it’s possibly over complicating things and you’re better off mixing it with something like sapphire for handling long running button interactions Looking at you #answer-overflow-consent