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
!player
that forwards to!mc:player
in an MC channel but to!s4:player
in an S4 channel -
supporting something like
!runas @other-user foo bar baz
, where this transformer will transform that to aliasfoo
and parameter stringbar baz
and then a customRestriction
can check whether the message author has the permissions to use!runas
and then for example whether theother-user
would have permissions for thefoo
command and only then allow it to proceed -
forwarding to a
!help
command if an unknown command was issued
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AliasAndParameterString
transformAliasAndParameterString(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 benull
and 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
null
if no alias could be determined
-
-