Skip to content

Commit 4ee36b5

Browse files
committed
BEACON-22 add documentation for postRaw and parseMessage
1 parent 2266f02 commit 4ee36b5

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

content/docs/components/dispatch.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,55 @@ dispatch.post({
7070
}
7171
}): Promise<string>
7272
```
73-
`post` posts a message to chat, either creating a new message or overwriting an existing one. It requires a character id and message content, a string containing either plain text or HTML to be posted.
73+
`post` posts a message to chat, either creating a new message or overwriting an existing one. Any inline rolls or macro references will be automatically resolved before the message is posted. It requires a character id and message content, a string containing either plain text or HTML to be posted.
7474

7575
The method also accepts an options object. Currently, only whisper and secret are supported, the only valid value for whisper is gm, which will send the message as a whisper to the gm.
7676

7777
The secret option is ignored unless whisper is also set, toggling to true will cause the message to not be visible to the controlling player.
7878

7979
Like roll, messageId can be provided to update an existing chat message, but if omitted the method will generate a new messageId and post a new chat message. The method returns the messageId.
8080

81+
#### postRaw
82+
```javascript
83+
dispatch.postRaw({
84+
characterId: string,
85+
messageId?: string,
86+
content: string,
87+
options?: {
88+
whisper?: 'gm',
89+
secret?: boolean,
90+
}
91+
}): Promise<string>
92+
```
93+
`postRaw` Functions like `post`, but will not try to parse/roll inline rolls or macros, instead posting the message directly to chat without further processing.
94+
95+
#### parseMessage
96+
```javascript
97+
dispatch.parseMessage({
98+
characterId: string,
99+
messageId?: string,
100+
content: string,
101+
options?: {
102+
whisper?: 'gm',
103+
secret?: boolean,
104+
}
105+
}): Promise<{
106+
content: string,
107+
rolls?: { [key: string]: Roll },
108+
inlinerolls?: Object[],
109+
rawContent?: string,
110+
}>
111+
```
112+
`parseMessage` works identically to `post`, but instead of posting the results to chat, they are returned to the sheet.
113+
114+
This function returns an object containing:
115+
116+
* `content`: The fully resolved chat message
117+
* `rolls`: The data from any rolls attached to this message
118+
* `inlinerolls`: Data from any inline rolls embedded in the original content
119+
* `rawContent`: The message content, with placeholders (`$[[0]]`) instead of inline rolls.
120+
121+
81122
#### query
82123
```javascript
83124
dispatch.query(options: Swal2Options): {

0 commit comments

Comments
 (0)