Class MessageResolver

java.lang.Object
io.github.kaktushose.jdac.message.resolver.MessageResolver
All Implemented Interfaces:
Resolver<String>

public final class MessageResolver extends Object implements Resolver<String>

The MessageResolver combines all registered Resolver<String> and following default resolvers:

  1. PlaceholderResolver (priority = 1000)
  2. I18n (priority = 2000)
  3. EmojiResolver (priority = 3000)

Resolvers with lower priority will be executed first, e.g. PlaceholderResolver will run before I18n.

Please note that this class is a helper and doesn't have own resolving logic, it's more of a pipeline of all string resolvers. It is not intended to be directly used by end users but part of the public api to allow manual execution of the frameworks resolving logic for dynamic values if needed.

  • Constructor Details

  • Method Details

    • resolve

      public String resolve(String message, Locale locale, Map<String, @Nullable Object> placeholder)
      Applies all registered Resolver<String> to the given message with the passed locale and placeholders. See class docs for more information.
      Specified by:
      resolve in interface Resolver<String>
      Parameters:
      message - the message to be resolved
      locale - the locale to use for i18n
      placeholder - the placeholders to use for i18n
      Returns:
      the resolved message
    • priority

      public int priority()
      Description copied from interface: Resolver

      The priority of this resolver influences the order in which resolver are applied in a resolution pipeline.

      Currently, this only applies to Resolver<String>, when using MessageResolver (as JDA-Commands does internally). Generally speaking, resolvers with lower priority run first.

      If the priority isn't important (e.g. for ComponentResolver) this should return 0.

      Specified by:
      priority in interface Resolver<String>
      Returns:
      0