formatMessage

Formats a message by a string pattern, replacing select keywords with more helpful values.

version(WithCounterPlugin)
private
formatMessage
(,
const string pattern
,
const ref IRCEvent event
,,
const long step = long.init
)

Parameters

plugin CounterPlugin

The current CounterPlugin.

pattern string

The custom string pattern we're formatting.

event IRCEvent

The IRCEvent that triggered the format.

counter Counter

The Counter that the message relates to.

step long

By what step the counter was modified, if any.

Return Value

Type: auto

A new string, with keywords replaced.

Examples

immutable pattern = "The $word count was bumped by +$step to $count!";
immutable message = formatMessage(plugin, pattern, event, counter, step);
assert(message == "The curse count was bumped by +1 to 92!");