Interface EmojiSource

All Superinterfaces:
Implementation.ExtensionProvidable

public non-sealed interface EmojiSource extends Implementation.ExtensionProvidable

Emojis loaded from an implementation of EmojiSource are automatically registered upon startup.

Per default all emojis contained in the directory "emojis" in the resource folder are registered automatically.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     
    static final Pattern
     
  • Method Summary

    Modifier and Type
    Method
    Description
    fromIcon(String name, Icon icon)
    Loads an emoji from a given Icon instance, allowing interop with JDAs system
    fromUrl(String name, URL url)
    Loads an emoji from a given URL.
    get()
    This method is called during startup to load the to be registered application emojis.
    reflective(String... paths)
    This implementation of EmojiSource scans the classpath for emoji files under the given paths.
  • Field Details

    • RESOURCE_PATTERN

      static final Pattern RESOURCE_PATTERN
    • log

      static final org.slf4j.Logger log
  • Method Details

    • reflective

      static EmojiSource reflective(String... paths)

      This implementation of EmojiSource scans the classpath for emoji files under the given paths. (resource directory names) The file name will be used as the emoji name.

      If no path is passed as an argument, the default path "emojis" will be used.

      Parameters:
      paths - the paths to scan (resource directories)
    • fromUrl

      static EmojiSource fromUrl(String name, URL url)
      Loads an emoji from a given URL.
      Parameters:
      name - the name of the emoji
      url - the URL the emoji should be loaded from
    • fromIcon

      static EmojiSource fromIcon(String name, Icon icon)
      Loads an emoji from a given Icon instance, allowing interop with JDAs system
      Parameters:
      name - the emojis name
      icon - the emojis Icon
    • get

      Map<String,Icon> get()
      This method is called during startup to load the to be registered application emojis.
      Returns:
      a map, mapping the emojis name to it's Icon instance
      API Note:
      This method will be called blocking and sequentially, I/O will therefore delay startup.