A rust library for interacting with multiple Spacebar-compatible Instances at once.
Go to file
Flori 8c9ccdd997
Ratelimiter overhaul (#144)
* Rename limits and limit to have better names

* Remove empty lines

* Remove handle_request (moved to requestlimiter)

* Start working on new ratelimiter

* Make limits Option, add "limited?" to constructor

* Add missing logic to send_request

* Rename Limits

* Create Ratelimits and Limit Struct

* Define Limit

* Import Ratelimits

* Define get_rate_limits

* Remove unused import

* + check_rate_limits & limits_config_to_ratelimits

* Remove Absolute Limits
These limits are not meant to be tracked anyways.

* add ratelimits is_exhausted

* Add error handling and send request checking

* change limits to option ratelimits

* Add strum

* Change Ratelimits to Hashmap

* Remove ratelimits in favor of hashmap

* Change code from struct to hashmap

* start working on update rate limits

* Remove wrong import

* Rename ChorusLibError to ChorusError

* Documented the chorus errors

* Made error documentation docstring

* Make ReceivedErrorCodeError have error string

* Remove unneeded import

* Match changes in errors.rs

* Improve update_rate_limits and can_send_request

* add ratelimits.to_hash_map()

* use instances' client instead of new client

* add LimitsConfiguration to instance

* improve update_limits, change a method name

* Fix un-updated errors

* Get LimitConfiguration in a sane way

* Move common.rs into ratelimiter::ChorusRequest

* Delete common.rs

* Make instance.rs use overhauled errors

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* Refactor to use new Rate limiting implementation

* update ratelimiter implementation across all files

* Fix remaining errors post-refactor

* Changed Enum case to be correct

* Use result

* Re-add missing body to request

* Remove unneeded late initalization

* Change visibility from pub to pub(crate)
I feel like these core methods don't need to be exposed as public API.

* Remove unnecessary import

* Fix clippy warnings

* Add docstring

* Change Error names across all files

* Update Cargo.toml

Strum is not needed

* Update ratelimits.rs

* Update ratelimits.rs

* Bug/discord instance info unavailable (#146)

* Change text to be more ambigous

* Use default Configuration instead of erroring out

* Emit warning log if instance config cant be gotten

* Remove import

* Update src/instance.rs

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>

* Add missing closing bracket

* Put limits and limits_configuration as one struct

* Derive Hash

* remove import

* rename limits and limits_configuration

* Save clone call

* Change LimitsConfiguration to RateLimits
`LimitsConfiguration` is in no way related to whether the instance has API rate limits enabled or not. Therefore, it has been replaced with what it should have been all along.

* Add ensure_limit_in_map(), add `window` to `Limit`

* Remove unneeded var

* Remove import

* Clean up unneeded things
Dead code warnings have been supressed, but flagged as FIXME so they don't get forgotten. Anyone using tools like TODO Tree in VSCode can still see that they are there, however, they will not be shown as warnings anymore

* Remove nested submodule `limit`

* Add doc comments

* Add more doc comments

* Add some log messages to some methods

---------

Co-authored-by: SpecificProtagonist <specificprotagonist@posteo.org>
2023-07-09 18:38:02 +02:00
.github/workflows Change Clippy CI to only run on main pushes or PRs 2023-06-19 16:30:46 +02:00
examples simplify GatewayEvent 2023-06-20 16:12:13 +02:00
src Ratelimiter overhaul (#144) 2023-07-09 18:38:02 +02:00
tests Ratelimiter overhaul (#144) 2023-07-09 18:38:02 +02:00
.gitignore Include vscode and idea dirs 2023-04-05 21:55:19 +02:00
.rusty-hook.toml Change rusty-hook to be pre-commit 2023-05-28 11:43:03 +02:00
Cargo.toml Ratelimiter overhaul (#144) 2023-07-09 18:38:02 +02:00
LICENSE Initial commit 2023-04-03 22:19:25 +02:00
README.md Simplify README 2023-06-20 00:17:52 +02:00
SECURITY.md Create SECURITY.md 2023-06-04 22:17:56 +02:00

README.md

Discord Build Contributors Forks Issues


Logo

Chorus

A rust library for interacting with (multiple) Spacebar-compatible APIs and Gateways (at the same time).
Explore the docs »

Report Bug · Request Feature · Join Discord

About

Chorus is a Rust library that allows developers to interact with multiple Spacebar-compatible APIs and Gateways simultaneously. The library provides a simple and efficient way to communicate with these services, making it easier for developers to build applications that rely on them. Chorus is open-source and welcomes contributions from the community.

Contributing

If you would like to contribute, please feel free to open an Issue with the idea you have, or a Pull Request. Please keep our contribution guidelines in mind. Your contribution might not be accepted, if it violates these guidelines or our Code of Conduct.

Progress Tracker/Roadmap

Core Functionality

Messaging

User Management

Additional Features

  • Server discovery
  • Server templates

Voice and Video

Permissions and Roles

Guild Management

Moderation

  • Channel moderation (slow mode, etc.)
  • User sanctions (mute, kick, ban)
  • Audit logs

Embeds and Rich Content

  • Sending rich content in messages (links, images, videos)
  • Customizing embed appearance (title, description, color, fields)

Webhooks

  • Webhook creation and management
  • Handling incoming webhook events

Documentation and Examples

  • Comprehensive documentation
  • Example usage and code snippets
  • Tutorials and guides