Class RoleAdapter
java.lang.Object
com.github.kaktushose.jda.commands.dispatching.adapter.impl.RoleAdapter
- All Implemented Interfaces:
TypeAdapter<Role>
,BiFunction<String,
GenericInteractionCreateEvent, Optional<Role>>
Type adapter for JDAs
Role
.-
Constructor Details
-
RoleAdapter
public RoleAdapter()
-
-
Method Details
-
apply
@NotNull public @NotNull Optional<Role> apply(@NotNull @NotNull String raw, @NotNull @NotNull GenericInteractionCreateEvent event) Attempts to parse a String to aRole
. Accepts both the role id and name.- Specified by:
apply
in interfaceBiFunction<String,
GenericInteractionCreateEvent, Optional<Role>> - Specified by:
apply
in interfaceTypeAdapter<Role>
- Parameters:
raw
- the String to parseevent
- theGenericInteractionCreateEvent
- Returns:
- the parsed
Role
or an empty Optional if the parsing fails
-