Replies
in package
FinalYes
Shared plumbing for turning a {@see \NHA\Commands} promise into a chat or slash-command response, with a uniform `❌ <error>` on rejection.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- flattenOptions() : array<string|int, mixed>
- Flattens an interaction's (sub)command options into a plain assoc array.
- text() : Container
- A container carrying one line of text (quick confirmations / errors).
- toInteraction() : PromiseInterface
- Defers the interaction (world calls are network round-trips), then sends the work's result — or the error — as the original response.
- toMessage() : void
- Sends a `Commands::` promise's result (a MessageBuilder) back to a chat message.
Properties
$nha read-only
private
NHA
$nha
Methods
__construct()
public
__construct(NHA $nha) : mixed
Parameters
- $nha : NHA
flattenOptions()
Flattens an interaction's (sub)command options into a plain assoc array.
public
static flattenOptions(iterable<string|int, mixed>|null $options) : array<string|int, mixed>
Parameters
- $options : iterable<string|int, mixed>|null
Return values
array<string|int, mixed>text()
A container carrying one line of text (quick confirmations / errors).
public
text(string $content) : Container
Parameters
- $content : string
Return values
ContainertoInteraction()
Defers the interaction (world calls are network round-trips), then sends the work's result — or the error — as the original response.
public
toInteraction(Interaction $interaction, PromiseInterface|callable(): PromiseInterface $work[, bool $ephemeral = false ]) : PromiseInterface
Parameters
- $interaction : Interaction
- $work : PromiseInterface|callable(): PromiseInterface
-
An already-started promise, or a callable run only after the defer lands.
- $ephemeral : bool = false
-
Whether the response is private to the caller.
Return values
PromiseInterfacetoMessage()
Sends a `Commands::` promise's result (a MessageBuilder) back to a chat message.
public
toMessage(Message $message, PromiseInterface $promise) : void
Parameters
- $message : Message
- $promise : PromiseInterface