Class EmojiResolver

java.lang.Object
io.github.kaktushose.jdac.message.emoji.EmojiResolver

public class EmojiResolver extends Object

The EmojiResolver replaces emoji aliases in strings with their formatted value.

An emoji alias is just the discord alias (either Unicode oder app emoji) enclosed by a colon :. For example the Unicode alias :joy: will be replaced by 😂 and the app emoji :app_emote: by its uploaded file.

Normally it shouldn't be necessary to escape the colons in messages (that shouldn't be an emoji alias), but in case any troubles occur you can just prefix it with \ (in java \\) to escape it.

Supported are all discord emojis, their skin tone variants and the app emotes for this bot. App emotes with the same name as a Unicode one will override later.

  • Constructor Details

    • EmojiResolver

      public EmojiResolver(Collection<ApplicationEmoji> applicationEmojis)
      Constructs a new instance of EmojiResolver with the given application emojis and all Unicode emojis supported by discord. If one of the passed application emojis has the same alias as a Unicode emoji, the app emojis takes precedence.
      Parameters:
      applicationEmojis - a list of all application emojis of this bot
  • Method Details

    • resolve

      public String resolve(String msg)
      Resolves the emoji aliases of a string according to the javadocs of this class.
      Parameters:
      msg - The string to be resolved
      Returns:
      the resolved string