Skip to content

Type Adapter

Kaktushose edited this page Jan 23, 2022 · 2 revisions

Type Adapter System

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());

Important

This wiki is the documentation for V3 (text commands)! If you're using V4 (interactions) please refer to the new documentation

Home

Getting Started

Writing Commands

Advanced Configuration

Util

Clone this wiki locally