-
Notifications
You must be signed in to change notification settings - Fork 12
Type Adapter
Kaktushose edited this page Jan 23, 2022
·
2 revisions
The default argument parser of this framework supports all primitive data types, the JDA entities Member
, User
, TextChannel
and Role
. However, you can define additional type adapters:
public class FooAdapter implements TypeAdapter<Foo> {
@Override
public Optional<Foo> parse(@NotNull String raw, @NotNull CommandContext context) {
return Optional.of(new Foo(raw));
}
}
Then, you have to register the type adapter:
jdaCommands.getAdapterRegistry().register(Foo.class, new FooAdapter());
This wiki is the documentation for V3
(text commands)! If you're using V4
(interactions) please refer to the new documentation
Important
This wiki is the documentation for V3
(text commands)! If you're using V4
(interactions) please refer to the new documentation