-
Notifications
You must be signed in to change notification settings - Fork 0
Decorators
pumbas600 edited this page Dec 27, 2021
·
18 revisions
Decorators allow for you to call another method, before invoking the action using the decorator pattern. In doing so, you can restrict, or modify how the action is called.
Halpbot currently has 3 built-in decorators that can be used on any public method annotated with: @ButtonAction, @Command, @CustomParameter:
This decorator allows you to specify a period of time that a user must wait before being able to invoke an action again. If the user is still cooling down it will temporarily display a MessageEmbed telling you how many seconds you have to wait before you can use the action again.
Example usages:
@Cooldown(duration = @Duration(30))
@Command(description = "Tests the @Cooldown decorator")
public String cooldown() {
return "This command has a 30 second cooldown!";
}@Cooldown(duration = @Duration(value = 1, unit = ChronoUnit.MINUTES))
@Command(description = "Tests the @Cooldown decorator")
public String cooldown() {
return "This command has a 1 minute cooldown!";
}- Built-in Commands
- @Command Parameters
- Arguments
- Annotations
- Custom Objects
- Custom TypeParsers
- Slash Commands - W.I.P.
- Pagination - W.I.P