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
Never heard of the library but the concept is familiar. It's really interesting how they make buttons stateful like this.
That guy who created the lib is also kinda cool
I wouldn't want to pull in react JUST for that though
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
This tbh. Also React is very tiny. Only 330 KB @24
It's the packages people install besides React that are large
True
There's also Preact if it's a concern, although not sure if it'd work with this lib
Seems odd though
Just feels wrong
if that makes sense
I.e. if you use create react app that pulls in over 300 transient dependencies
CRA is a disgrace to humanity
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
Seeing as they use react state I'm guessing it's not. They'd have to probably add a Redis caching layer somehow.
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