Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mavolin/disstate
💾 An alternative state for arikawa, with a few extras.
https://github.com/mavolin/disstate
arikawa discord
Last synced: 9 days ago
JSON representation
💾 An alternative state for arikawa, with a few extras.
- Host: GitHub
- URL: https://github.com/mavolin/disstate
- Owner: mavolin
- License: mit
- Created: 2020-07-31T14:30:12.000Z (over 4 years ago)
- Default Branch: v3
- Last Pushed: 2021-11-07T17:23:59.000Z (about 3 years ago)
- Last Synced: 2024-11-11T16:38:14.557Z (2 months ago)
- Topics: arikawa, discord
- Language: Go
- Homepage:
- Size: 204 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# disstate
[![PkgGoDev](https://pkg.go.dev/badge/github.com/mavolin/disstate)](https://pkg.go.dev/github.com/mavolin/disstate)
Disstate is an alternative state, with a more advanced event system.
The API is the same as the one of arikawa's `State`, only adding handlers works differently.## Event System
There are four major changes to the event system of arikawa:
1. Handlers take a `*state.State` as first argument.
2. There is support for middlewares both on a global, and a per-handler level
3. All events have new types, that contain a `Base` which is a key-value store, that allows you to pass information from your middleware to the handler.
4. Integrated error and panic handling.
Handlers and middlewares can optionally have an `error` return type.
If a handler or middleware returns an error, it will be given to the event system's error handler.
If a middleware returns an error, all other middlewares and the handler won't be called.
Similarly, if a middleware or handler panics, the panic will be recovered and handled by the panic handler.