Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexpineda/charmflow
An easy bot configurator for Eris
https://github.com/alexpineda/charmflow
Last synced: about 2 months ago
JSON representation
An easy bot configurator for Eris
- Host: GitHub
- URL: https://github.com/alexpineda/charmflow
- Owner: alexpineda
- Created: 2021-12-05T20:16:24.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-16T16:54:07.000Z (about 3 years ago)
- Last Synced: 2024-10-12T22:27:41.681Z (3 months ago)
- Language: JavaScript
- Size: 188 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CharmFlow
Easily create Discord interaction sequences with [Eris](https://github.com/abalabahaha/eris).
## Table of contents
- [CharmFlow](#charmflow)
- [Table of contents](#table-of-contents)
- [Features](#features)
- [Setup](#setup)
- [Quick Example](#quick-example)
- [License](#license)## Features
- 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## Setup
To run this project, install it locally using npm:```
$ npm install --save charmflow
```or with yarn
```
$ yarn add -S charmflow
```## Quick Example
```js
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.
## License
MIT