Class IntegrationFormatter

java.lang.Object
net.flectone.pulse.platform.formatter.IntegrationFormatter

public class IntegrationFormatter extends Object
Create format for external integrations (Discord, Telegram, Twitch, etc.)
Since:
1.10.0
  • Constructor Details

  • Method Details

    • isVanished

      public boolean isVanished(EventMetadata<?> eventMetadata)
      Checks if the event sender is in vanish
      Parameters:
      eventMetadata - The event metadata containing sender information and optional vanish metadata
      Returns:
      true if the sender is vanished and vanish should not be ignored, false otherwise
    • getExistedMessageNames

      public @NonNull List<String> getExistedMessageNames(@NonNull ModuleName moduleName, @NonNull IntegrationMetadata integrationMetadata, MessageChannelSetting messageChannelSetting)
      Retrieves a list of message names that have corresponding non-empty channel configurations.
      Parameters:
      moduleName - The module name to check for existence in message channels
      integrationMetadata - Metadata containing the collection of message names to validate
      messageChannelSetting - Configuration providing the mapping of channel names to message lists
      Returns:
      A list of message names that have non-empty channel configurations, including the module name if applicable
    • createFormat

      public @NonNull UnaryOperator<String> createFormat(@NonNull EventMetadata<?> eventMetadata, @NonNull IntegrationMetadata integrationMetadata, @NonNull String format)
      Creates a format function that processes and replaces placeholders in message templates.
      Parameters:
      eventMetadata - The event metadata containing sender information, message content, and flags
      integrationMetadata - Metadata providing integration-specific format transformations
      format - The format template string containing placeholders to be replaced
      Returns:
      A unary operator that takes an input string and returns the formatted message with all placeholders resolved