Table of Contents

Interface IPromptRegistry

Namespace
Signal.Application.Background
Assembly
Signal.Application.dll

Pending prompts waiting for a sender's next message. The host passes every received envelope to TryDeliver(IncomingEnvelope) before routing it to a conversation partition, so an answer never waits behind the work that asked for it.

public interface IPromptRegistry

Methods

TryDeliver(IncomingEnvelope)

Hands a received text message to the prompt waiting for its sender in its conversation, if any. Messages that parse as a command are never consumed, so commands keep working while a prompt waits.

bool TryDeliver(IncomingEnvelope envelope)

Parameters

envelope IncomingEnvelope

The received envelope.

Returns

bool

true if a prompt consumed the message; it must then not be processed further.

WaitAsync(PhoneNumber, Recipient, Sender, TimeSpan, CancellationToken, IReadOnlyList<string>?)

Waits for the next text message of sender in conversation. The prompt is registered before this method returns its task, so call it before sending the question.

Task<IncomingEnvelope?> WaitAsync(PhoneNumber account, Recipient conversation, Sender sender, TimeSpan timeout, CancellationToken cancellationToken, IReadOnlyList<string>? prefixes = null)

Parameters

account PhoneNumber

The receiving account.

conversation Recipient

The conversation.

sender Sender

The sender whose answer counts (in groups, other members are ignored).

timeout TimeSpan

How long to wait.

cancellationToken CancellationToken

Cancels waiting.

prefixes IReadOnlyList<string>

The conversation's own command prefixes (ConversationSettings.Prefixes), so messages that are commands there are not taken as answers; null for the configured prefixes.

Returns

Task<IncomingEnvelope>

The answering envelope, or null on timeout or when a newer prompt replaced this one.