Interface PendingRule

Source
Expand description

Returned by when(). Call .reply() or .replySequence() on it to complete the rule.

example
server.when("hello").reply("Hi!");
server.when("step").replySequence(["First.", "Second.", "Done."]);
interface PendingRule {
    reply(response: Resolver, options?: ReplyOptions): RuleHandle;
    replySequence(entries: readonly SequenceEntry[]): RuleHandle;
}

Methods§

Source§

reply(response: Resolver, options?: ReplyOptions): RuleHandle

Set the response for this rule. Accepts a static value, object, or resolver function.

Source§

replySequence(entries: readonly SequenceEntry[]): RuleHandle

Set a sequence of replies. Each match advances through the array.