-
-
Notifications
You must be signed in to change notification settings - Fork 3
Rate limiter
Mihou edited this page Jul 16, 2021
·
7 revisions
The cooldown handler for Velen, this is an extremely simple implementation and doesn't have much settings other than being able to change the duration of the cooldown, the message of the cooldown (which is done when building Velen). You can change the cooldown of Velen during build, for example:
Velen velen = Velen.builder()
.setDefaultCooldownTime(Duration.ofSeconds(10));
You can add your own functions to the Rate-limiter by simply adding different interceptors, an example that would log a message whenever a user is released from rate-limit is:
velen.getRatelimiter().addInterceptor(ratelimitObject -> log.debug("User {} was released from rate-limit on command {}", ratelimitObject.getUser(), ratelimitObject.getCommand()), RatelimitInterceptorPosition.RELEASE);
As of Velen 2.0
, please read Configureable Message for instructions over how to change the rate-limit message instead.