DiscordHost
Defined in: packages/platform-discord/src/host/index.ts:86
The Discord host: the shared bot node tree plus Components V2 serialization and interaction routing.
Extends
Section titled “Extends”BotHost
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new DiscordHost(
options,wire?):DiscordHost
Defined in: packages/platform-discord/src/host/index.ts:97
Parameters
Section titled “Parameters”options
Section titled “options”DiscordWire = nodeWire
Returns
Section titled “Returns”DiscordHost
Overrides
Section titled “Overrides”BaseBotHost.constructor
Properties
Section titled “Properties”container
Section titled “container”
readonlycontainer:BotNode
Defined in: packages/core/src/host/index.ts:30
Inherited from
Section titled “Inherited from”BaseBotHost.container
controlled
Section titled “controlled”
readonlycontrolled:ReadonlySet<string>
Defined in: packages/core/src/host/index.ts:32
Inherited from
Section titled “Inherited from”BaseBotHost.controlled
elements
Section titled “elements”
readonlyelements: readonlystring[]
Defined in: packages/core/src/host/index.ts:31
Inherited from
Section titled “Inherited from”BaseBotHost.elements
interaction
Section titled “interaction”interaction:
DiscordInteraction|null=null
Defined in: packages/platform-discord/src/host/index.ts:94
modalShownFor
Section titled “modalShownFor”modalShownFor:
DiscordInteraction|null=null
Defined in: packages/platform-discord/src/host/index.ts:95
platform
Section titled “platform”
readonlyplatform:string
Defined in: packages/core/src/host/index.ts:35
The platform this host serializes for, such as discord or slack.
Inherited from
Section titled “Inherited from”BaseBotHost.platform
runsMounts
Section titled “runsMounts”
readonlyrunsMounts:true=true
Defined in: packages/core/src/host/index.ts:33
Inherited from
Section titled “Inherited from”BaseBotHost.runsMounts
Accessors
Section titled “Accessors”commits
Section titled “commits”Get Signature
Section titled “Get Signature”get commits():
number
Defined in: packages/core/src/host/index.ts:45
How many commits this host has completed.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”BaseBotHost.commits
session
Section titled “session”Get Signature
Section titled “Get Signature”get session():
HostSession|null
Defined in: packages/core/src/host/index.ts:62
The session whose id and version are stamped onto interaction ids.
Returns
Section titled “Returns”HostSession | null
Inherited from
Section titled “Inherited from”BaseBotHost.session
Methods
Section titled “Methods”commit()
Section titled “commit()”commit():
void
Defined in: packages/platform-discord/src/host/index.ts:146
Returns
Section titled “Returns”void
createContainer()
Section titled “createContainer()”createContainer():
BotNode
Defined in: packages/core/src/host/index.ts:180
Returns
Section titled “Returns”BotNode
Inherited from
Section titled “Inherited from”BaseBotHost.createContainer
createElement()
Section titled “createElement()”createElement(
tag):BotNode
Defined in: packages/core/src/host/index.ts:170
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”BotNode
Inherited from
Section titled “Inherited from”BaseBotHost.createElement
createText()
Section titled “createText()”createText(
text):BotNode
Defined in: packages/core/src/host/index.ts:174
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”BotNode
Inherited from
Section titled “Inherited from”BaseBotHost.createText
dispatchInteraction()
Section titled “dispatchInteraction()”dispatchInteraction(
interaction):Effect<boolean,DiscordMessageError>
Defined in: packages/platform-discord/src/host/index.ts:187
Routes an interaction to the rendered node that owns it.
Parameters
Section titled “Parameters”interaction
Section titled “interaction”Returns
Section titled “Returns”Effect<boolean, DiscordMessageError>
freeze()
Section titled “freeze()”freeze(
nodes?):void
Defined in: packages/core/src/host/index.ts:126
Marks every interactive node disabled, so a painted copy shows the state without offering controls that cannot route to a live root.
Parameters
Section titled “Parameters”nodes?
Section titled “nodes?”readonly BotNode[] = ...
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.freeze
insertBefore()
Section titled “insertBefore()”insertBefore(
parent,node,ref):void
Defined in: packages/core/src/host/index.ts:220
Parameters
Section titled “Parameters”parent
Section titled “parent”BotNode
BotNode
BotNode | undefined
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.insertBefore
interactionIds()
Section titled “interactionIds()”interactionIds(): readonly
string[]
Defined in: packages/platform-discord/src/host/index.ts:136
Custom ids currently routed by this host.
Returns
Section titled “Returns”readonly string[]
nextOf()
Section titled “nextOf()”nextOf(
node):BotNode|undefined
Defined in: packages/core/src/host/index.ts:232
Parameters
Section titled “Parameters”BotNode
Returns
Section titled “Returns”BotNode | undefined
Inherited from
Section titled “Inherited from”BaseBotHost.nextOf
nodes()
Section titled “nodes()”nodes(): readonly
BotNode[]
Defined in: packages/core/src/host/index.ts:166
Every node in document order.
Hosts walk the tree several times per commit (ids, routing, serialization). Taking one list and passing it to the other steps keeps those walks in sync and avoids re-traversing the whole tree for each concern.
Returns
Section titled “Returns”readonly BotNode[]
Inherited from
Section titled “Inherited from”BaseBotHost.nodes
parentOf()
Section titled “parentOf()”parentOf(
node):BotNode|undefined
Defined in: packages/core/src/host/index.ts:228
The node’s parent, or undefined once it’s removed. instanceAt relies on this.
Parameters
Section titled “Parameters”BotNode
Returns
Section titled “Returns”BotNode | undefined
Inherited from
Section titled “Inherited from”BaseBotHost.parentOf
prepareInteractionIds()
Section titled “prepareInteractionIds()”prepareInteractionIds(
nodes?):string|undefined
Defined in: packages/core/src/host/index.ts:87
Assigns every interactive node its platform-facing custom id.
Without a session the id keeps the old host-generated value. With one, auto ids are document-order ordinals and explicit ids keep the author’s text as the key, both wrapped with the session and its current version. A restored tree therefore produces the same ids as the state it shows.
Returns a message when an id exceeds the platform limit. Callers surface that message as a target failure instead of throwing from the renderer.
Parameters
Section titled “Parameters”nodes?
Section titled “nodes?”readonly BotNode[] = ...
Returns
Section titled “Returns”string | undefined
Inherited from
Section titled “Inherited from”BaseBotHost.prepareInteractionIds
remove()
Section titled “remove()”remove(
node):void
Defined in: packages/core/src/host/index.ts:224
Parameters
Section titled “Parameters”BotNode
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.remove
setAttr()
Section titled “setAttr()”setAttr(
node,name,value,_previous?):void
Defined in: packages/core/src/host/index.ts:188
Sets an attribute of node, or removes it when value is undefined.
previous is the value the renderer takes the attribute to hold before
the call: the one it last set, or the one hydration read from the node,
and undefined when it holds none.
Parameters
Section titled “Parameters”BotNode
string
string | undefined
_previous?
Section titled “_previous?”string
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.setAttr
setEvents()
Section titled “setEvents()”setEvents(
node,handlers,dispatch,options):void
Defined in: packages/core/src/host/index.ts:239
Parameters
Section titled “Parameters”BotNode
handlers
Section titled “handlers”Readonly<Record<string, View.Handler<unknown, any>>>
dispatch
Section titled “dispatch”Dispatch
options
Section titled “options”Readonly<Record<string, View.EventOptions>>
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.setEvents
setInteractionIndex()
Section titled “setInteractionIndex()”setInteractionIndex(
listener):void
Defined in: packages/platform-discord/src/host/index.ts:141
Replaces the client index whenever a commit changes custom ids.
Parameters
Section titled “Parameters”listener
Section titled “listener”(ids) => void
Returns
Section titled “Returns”void
setProp()
Section titled “setProp()”setProp(
node,name,value):void
Defined in: packages/core/src/host/index.ts:204
Parameters
Section titled “Parameters”BotNode
string
unknown
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.setProp
setSession()
Section titled “setSession()”setSession(
session):void
Defined in: packages/core/src/host/index.ts:67
Binds the host to a resumable message session.
Parameters
Section titled “Parameters”session
Section titled “session”HostSession | null
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.setSession
setSessionVersion()
Section titled “setSessionVersion()”setSessionVersion(
version):void
Defined in: packages/core/src/host/index.ts:72
Advances the version used by the next commit.
Parameters
Section titled “Parameters”version
Section titled “version”number
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.setSessionVersion
setText()
Section titled “setText()”setText(
node,text):void
Defined in: packages/core/src/host/index.ts:184
Parameters
Section titled “Parameters”BotNode
string
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”BaseBotHost.setText
snapshot()
Section titled “snapshot()”snapshot(
inert?):MessageSnapshot
Defined in: packages/platform-discord/src/host/index.ts:180
The message payload for the current tree, without sending it. With
inert, controls render disabled, for a historical copy a live root
cannot route.
Parameters
Section titled “Parameters”inert?
Section titled “inert?”boolean = false
Returns
Section titled “Returns”MessageSnapshot
waitForCommit()
Section titled “waitForCommit()”waitForCommit(
after,timeoutMs?):Effect<void>
Defined in: packages/core/src/host/index.ts:146
Waits until a commit after after has run, or the timeout elapses.
Parameters
Section titled “Parameters”number
timeoutMs?
Section titled “timeoutMs?”number = 100
Returns
Section titled “Returns”Effect<void>
Inherited from
Section titled “Inherited from”BaseBotHost.waitForCommit
layer()
Section titled “layer()”
staticlayer(options):Layer<Host|Renderer,never,MessageTarget>
Defined in: packages/platform-discord/src/host/index.ts:294
Provides this host and the Effect UI renderer for a MessageTarget.
mountMessage builds this layer; use it directly when composing hosts.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”Layer<Host | Renderer, never, MessageTarget>
layerFrom()
Section titled “layerFrom()”
staticlayerFrom(host):Layer<Host|Renderer>
Defined in: packages/platform-discord/src/host/index.ts:308
Provides an existing host instance and the renderer.
Parameters
Section titled “Parameters”DiscordHost
Returns
Section titled “Returns”Layer<Host | Renderer>