Class IntegrationFormatter
java.lang.Object
net.flectone.pulse.platform.formatter.IntegrationFormatter
Create format for external integrations (Discord, Telegram, Twitch, etc.)
- Since:
- 1.10.0
-
Constructor Summary
ConstructorsConstructorDescriptionIntegrationFormatter(MessagePipeline messagePipeline, ComponentSerializer componentSerializer) -
Method Summary
Modifier and TypeMethodDescription@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.getExistedMessageNames(@NonNull ModuleName moduleName, @NonNull IntegrationMetadata integrationMetadata, MessageChannelSetting messageChannelSetting) Retrieves a list of message names that have corresponding non-empty channel configurations.booleanisVanished(EventMetadata<?> eventMetadata) Checks if the event sender is in vanish
-
Constructor Details
-
IntegrationFormatter
@Inject public IntegrationFormatter(MessagePipeline messagePipeline, ComponentSerializer componentSerializer)
-
-
Method Details
-
isVanished
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 channelsintegrationMetadata- Metadata containing the collection of message names to validatemessageChannelSetting- 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 flagsintegrationMetadata- Metadata providing integration-specific format transformationsformat- 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
-