tock / ai.tock.bot.engine.action / Action

# Action

`abstract class Action : Event` (source)

A user (or bot) action.

### Constructors

#### <init> | A user (or bot) action. `Action(playerId: PlayerId, recipientId: PlayerId, applicationId: String, id: Id<Action>, date: Instant, state: EventState, metadata: ActionMetadata = ActionMetadata())`

### Properties

#### metadata | `val metadata: ActionMetadata`
#### playerId | `val playerId: PlayerId`
#### recipientId | `val recipientId: PlayerId`

### Functions

#### booleanChoice | Returns true if the specified choice as the "true" value, false either. `fun booleanChoice(key: ParameterKey): Boolean`
#### choice | Returns the value of the specified choice parameter, null if the user action is not a SendChoice or if this parameter is not set. `fun choice(key: ParameterKey): String?`
#### jsonChoice | Returns the value of the specified choice parameter, null if the user action is not a SendChoice or if this parameter is not set. `fun <T : Any> jsonChoice(key: ParameterKey): T?`
#### toActionId | `fun toActionId(): Id<Action>`
#### toMessage | `abstract fun toMessage(): Message`

### Inheritors

#### SendAttachment | A simple attachment file sent. `open class SendAttachment : Action`
#### SendChoice | A user choice (click on a button or direct action). `class SendChoice : Action`
#### SendLocation | A user location transmission. `class SendLocation : Action`
#### SendSentence | The most important Action class. Could be a simple text, or a complex message using one or more ConnectorMessage. `open class SendSentence : Action`