ConversationManager
in package
Table of Contents
Properties
- $factory : callable(string): Conversation
- $logger : LoggerInterface|null
- $pendingSyntheticMessage : Message|null
Methods
- __construct() : mixed
- clear() : void
- Clear any active conversation state for the given thread.
- consumePendingSyntheticMessage() : Message|null
- Return a synthetic message from an action fallthrough, if one was stored during the last interceptAction call. Clears the stored message.
- intercept() : bool
- Intercept an incoming message for an active conversation.
- interceptAction() : bool
- Intercept an action event during an active conversation.
- interceptReaction() : bool
- Intercept a reaction during an active conversation.
- interceptSlashCommand() : bool
- Intercept a slash command during an active conversation.
- start() : void
- Start a new conversation. Clears existing state and calls run() immediately.
- interceptEvent() : bool
- Generic non-message event intercept.
Properties
$factory
private
callable(string): Conversation
$factory
$logger read-only
private
LoggerInterface|null
$logger
= null
$pendingSyntheticMessage
private
Message|null
$pendingSyntheticMessage
= null
Methods
__construct()
public
__construct([LoggerInterface|null $logger = null ][, callable|null $factory = null ]) : mixed
Parameters
- $logger : LoggerInterface|null = null
- $factory : callable|null = null
clear()
Clear any active conversation state for the given thread.
public
clear(Thread $thread) : void
Parameters
- $thread : Thread
consumePendingSyntheticMessage()
Return a synthetic message from an action fallthrough, if one was stored during the last interceptAction call. Clears the stored message.
public
consumePendingSyntheticMessage() : Message|null
Return values
Message|nullintercept()
Intercept an incoming message for an active conversation.
public
intercept(Thread $thread, Message $message) : bool
Returns true if the message was consumed by the conversation, false if no active conversation exists.
Parameters
Return values
boolinterceptAction()
Intercept an action event during an active conversation.
public
interceptAction(Thread $thread, ActionEvent $action) : bool
Returns true if the conversation consumed the event.
Parameters
- $thread : Thread
- $action : ActionEvent
Return values
boolinterceptReaction()
Intercept a reaction during an active conversation.
public
interceptReaction(Thread $thread, ReactionEvent $reaction) : bool
Returns true if the conversation consumed the event.
Parameters
- $thread : Thread
- $reaction : ReactionEvent
Return values
boolinterceptSlashCommand()
Intercept a slash command during an active conversation.
public
interceptSlashCommand(Thread $thread, SlashCommandEvent $command) : bool
Returns true if the conversation consumed the event.
Parameters
- $thread : Thread
- $command : SlashCommandEvent
Return values
boolstart()
Start a new conversation. Clears existing state and calls run() immediately.
public
start(string $class, Thread $thread, Message $message) : void
Parameters
interceptEvent()
Generic non-message event intercept.
private
interceptEvent(Thread $thread, object $event, string $method) : bool
Parameters
- $thread : Thread
- $event : object
- $method : string