Easily create Discord interaction sequences with Eris.
- Easily create sequential flows without worrying about interaction or message id's
- Branch depending on user choices
- Delete or keep messages easily
- Cleanup at the end or after timing out
- Low API surface mostly exposing Eris.ComponentInteraction at each step in the sequence
- Automatically acknowledges interactions
To run this project, install it locally using npm:
$ npm install --save charmflow
or with yarn
$ yarn add -S charmflow
const charmFlow = new CharmFlow(erisClient);
charmFlow.onCommand("setup")
.flow(interaction => interaction.createFollowup("Hey welcome to My Bot, this is a quick setup guide!"))
.keepMessage()
.flow(interaction => interaction.createFollowup(/* ... message with components ... */))
.flow((interaction, flow) => {
// next step, handle response, store stuff in db, etc..
if (interaction.data.values.includes("yes")) {
// conditionally kick off other subflows with flow()
}
})
.deleteMessages() // delete top level messages except for the first
.end(interaction => interaction.editOriginalMessage("all done!"))
More examples can be found in the examples folder.
MIT