You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/components/dispatch.md
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,15 +70,55 @@ dispatch.post({
70
70
}
71
71
}):Promise<string>
72
72
```
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.
74
74
75
75
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.
76
76
77
77
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.
78
78
79
79
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.
80
80
81
-
## query
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.
0 commit comments