Package net.kautler.command.api
Interface AliasAndParameterStringTransformer<M>
-
- Type Parameters:
M- the class of the messages for which this transformer can be triggered
public interface AliasAndParameterStringTransformer<M>A transformer that can transform a combination of alias and parameter string to another one. It also gets the message from which the combination was derived for determining the new values.Possible use-cases for example include:
- fuzzy-searching for mistyped aliases and their automatic correction (this could also be used for just a "did you mean X" response, but for that the command not found events are probably better suited)
-
having a command that forwards to one command in one channel
but to another command in another channel,
like
!playerthat forwards to!mc:playerin an MC channel but to!s4:playerin an S4 channel -
supporting something like
!runas @other-user foo bar baz, where this transformer will transform that to aliasfooand parameter stringbar bazand then a customRestrictioncan check whether the message author has the permissions to use!runasand then for example whether theother-userwould have permissions for thefoocommand and only then allow it to proceed -
forwarding to a
!helpcommand if an unknown command was issued
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AliasAndParameterStringtransformAliasAndParameterString(M message, AliasAndParameterString aliasAndParameterString)Transforms the given alias and parameter string to a new one, using the given message.
-
-
-
Method Detail
-
transformAliasAndParameterString
AliasAndParameterString transformAliasAndParameterString(M message, AliasAndParameterString aliasAndParameterString)
Transforms the given alias and parameter string to a new one, using the given message. The given alias and parameter string can benulland will be if no alias was found.- Parameters:
message- the message from which to determine the alias and parameter stringaliasAndParameterString- the alias and parameter string that was determined by the standard mechanism if any- Returns:
- the transformed new alias and parameter string or
nullif no alias could be determined
-
-