-
Notifications
You must be signed in to change notification settings - Fork 0
Command Arguments
pumbas600 edited this page Aug 14, 2021
·
19 revisions
Written for HalpBot-Core-1.0.1
In HalpBot, method parameters are automatically assumed to be command arguments except in the following 3 situations:
-
The parameter type extends
GenericEvent(E.g:MessageReceivedEvent). Instead, it'll pass theMessageReceivedEventthat JDA received when the command was called. -
The parameter type extends
AbstractCommandAdapter(E.g:TokenCommandAdapter). Instead, it'll pass theTokenCommandAdapterthat the command is registered to. -
The parameter is annotated with
@Source. This tells HalpBot that the parameter is meant to be extracted from theMessageReceivedEvent(Just so that you don't have to).
HalpBot comes with built-in parsers that handle the most commonly used types.
| Type | Notes |
|---|---|
| Byte/byte | |
| Short/short | |
| Integer/int | |
| Long/long | |
| Float/float | |
| Double/double | |
| Character/char | |
| Boolean/bool |
true is considered to be any of: true, yes, t, y (Not case-sensitive). Anything else will be false
|
| String | By default this only captures a single word |
| Enums | Not case-sensitive |
| List | Returns ArrayList. By default, you need to surround the elements with [...]
|
| Set | Returns HashSet. By default, you need to surround the elements with [...]
|
| Arrays | By default, you need to surround the elements with [...] |
| TextChannel | A text channel specified by #channel-name. Note: For performance reasons, if you just need the id use a long annotated with @Id(TextChannel.class)
|
| User | The user specified by @username. Note: For performance reasons, if you just need the id use a long annotated with @Id(User.class)
|
| Member | The member specified by @username. Note: For performance reasons, if you just need the id use a long annotated with @Id(Member.class)
|
| Default Object Parser | See this for more information. |
- Built-in Commands
- @Command Parameters
- Arguments
- Annotations
- Custom Objects
- Custom TypeParsers
- Slash Commands - W.I.P.
- Pagination - W.I.P