bootdesk/chat-sdk

Conversation
in package

AbstractYes

Table of Contents

Properties

$currentMessage  : Message
$thread  : Thread
$skipRequested  : bool

Methods

initialize()  : void
Set by ConversationManager before each step call.
isSkipRequested()  : bool
onAction()  : bool|null
Handle an action event during an active conversation.
onReaction()  : bool|null
Handle a reaction during an active conversation.
onSlashCommand()  : bool|null
Handle a slash command during an active conversation.
resetSkip()  : void
run()  : void
Entry point called by ConversationManager::start().
ask()  : void
Post a question and set the next step method.
end()  : void
End the current conversation step.
pause()  : void
Pause the current conversation and start a child conversation.
repeat()  : void
Re-ask the last question. Step remains unchanged.
say()  : void
Post a message without changing conversation state.
skip()  : void
Jump to a different step method immediately.
startConversation()  : void
Replace the current conversation with a new one.

Properties

Methods

isSkipRequested()

public isSkipRequested() : bool
Return values
bool

onAction()

Handle an action event during an active conversation.

public onAction(Thread $thread, ActionEvent $action) : bool|null

Return true to consume the event (skip normal dispatch), return null to fall through to registered listeners.

Parameters
$thread : Thread
$action : ActionEvent
Return values
bool|null

onReaction()

Handle a reaction during an active conversation.

public onReaction(Thread $thread, ReactionEvent $reaction) : bool|null

Return true to consume, null to fall through.

Parameters
$thread : Thread
$reaction : ReactionEvent
Return values
bool|null

ask()

Post a question and set the next step method.

protected ask(string|PostableMessage|Card $question, string $step[, array<string|int, mixed> $data = [] ]) : void

The next user message will be routed to $step.

Parameters
$question : string|PostableMessage|Card
$step : string
$data : array<string|int, mixed> = []

end()

End the current conversation step.

protected end() : void

If a parent conversation exists on the stack, restore it and replay its last question. Otherwise, clear all conversation state.

pause()

Pause the current conversation and start a child conversation.

protected pause(string $childClass, Message $message) : void

Stack saves parent state; end() restores and replays parent's last question. Calls $child->run() immediately.

Parameters
$childClass : string
$message : Message

repeat()

Re-ask the last question. Step remains unchanged.

protected repeat([string|null $message = null ]) : void
Parameters
$message : string|null = null

skip()

Jump to a different step method immediately.

protected skip(string $step, Message $message[, array<string|int, mixed>|null $data = null ]) : void

The current message is passed to the new step.

Parameters
$step : string
$message : Message
$data : array<string|int, mixed>|null = null

startConversation()

Replace the current conversation with a new one.

protected startConversation(string $class, Message $message) : void

No return path — old conversation is gone. Calls $conv->run() immediately.

Parameters
$class : string
$message : Message
On this page

Search results