DiscordPHP-NHA Documentation

AutoplayLoop
in package

FinalYes

The autonomous LLM play loop: while `isAutoplayEnabled()`, every `$interval` seconds ask {@see AutoPlayer::step()} for the default agent's next move and queue it, posting the play-by-play ("thinking dialogue") to `$brainChannelId`.

Overlapping runs are skipped (an LLM reply is slower than the interval), a single bad turn never takes the loop down, and a persistent fault (brain host unreachable, API down) is logged once then at most once every 5 minutes.

Tags
since
3.1.27

Table of Contents

Properties

$autoPlayer  : AutoPlayer
$brainChannelId  : string|null
$busy  : bool
$interval  : float
$lastWarn  : array{msg: string, at: int}
$nha  : NHA
$state  : StateStore

Methods

__construct()  : mixed
start()  : void
warn()  : void
Log a warning, de-duping an identical message to at most once per 5 minutes.

Properties

$brainChannelId read-only

private string|null $brainChannelId

$lastWarn

private array{msg: string, at: int} $lastWarn = ['msg' => '', 'at' => 0]

Methods

warn()

Log a warning, de-duping an identical message to at most once per 5 minutes.

private warn(string $msg) : void
Parameters
$msg : string
On this page

Search results