API reference / @jsprismarine/prismarine / input/IntentHandler
input/IntentHandler
Interfaces
IntentHandler
Defined in: packages/prismarine/src/input/IntentHandler.ts:27
A handler for one intent kind.
Type Parameters
K
K extends IntentKind
Methods
handle()
handle(
intent,context):IntentResult<K>
Defined in: packages/prismarine/src/input/IntentHandler.ts:34
Handles one intent.
Parameters
intent
Intent<K>
The intent, already decoded and checked against the sender's view.
context
What the kind's lane hands a handler.
Returns
IntentResult<K>
IntentHandlerClass
Defined in: packages/prismarine/src/input/IntentHandler.ts:38
A handler class the server registers for the kind it names.
Type Parameters
K
K extends IntentKind = IntentKind
Constructors
Constructor
new IntentHandlerClass():
IntentHandler<K>
Defined in: packages/prismarine/src/input/IntentHandler.ts:41
Returns
Properties
Kind
readonlyKind:K
Defined in: packages/prismarine/src/input/IntentHandler.ts:40
The intent kind the class handles.
Type Aliases
IntentContext
IntentContext<
K> =IntentLane<K> extends"input"?InputContext:SessionContext
Defined in: packages/prismarine/src/input/IntentHandler.ts:15
The context a handler of intent kind K is handed, chosen by the kind's lane.
Type Parameters
K
K extends IntentKind
IntentResult
IntentResult<
K> ="input"extendsIntentLane<K> ?undefined:void|Promise<void>
Defined in: packages/prismarine/src/input/IntentHandler.ts:24
What a handler of intent kind K returns. An input-lane handler returns undefined and not void, for the reason the packet handler shape gives: a function returning a promise can stand in for one returning void, and the input step must never be handed one. A handler registered for several kinds returns undefined as soon as one of them is an input, since it then runs in the input step for that kind.
Type Parameters
K
K extends IntentKind