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 alias foo and parameter string bar baz and then a custom Restriction can check whether the message author has the permissions to use !runas and then for example whether the other-user would have permissions for the foo command and only then allow it to proceed
    • forwarding to a !help command if an unknown command was issued
    • 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 be null and will be if no alias was found.
        Parameters:
        message - the message from which to determine the alias and parameter string
        aliasAndParameterString - 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