Skip to content

Commit

Permalink
Update 2.custom-events.md
Browse files Browse the repository at this point in the history
Remove v0.2.1 workaround, fix General.Custom example
  • Loading branch information
Whipstickgostop authored Mar 26, 2024
1 parent 5f27644 commit 8ec552b
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions apps/docs/content/2.guide/2.custom-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,30 +41,9 @@ CPH.WebsocketBroadcastJson(json);
On the client side, we will handle these events with the following event handler:

```ts [example.ts]
await client.on('General.Custom', (data) => {
if (data.event === 'mediaPlayer' && data.action === 'pause') {
await client.on('General.Custom', (payload) => {
if (payload.data.event === 'mediaPlayer' && payload.data.action === 'pause') {
// handle media player pause events in here :)
}
});
```

## Warning

::callout{icon=i-mdi-alert color=amber}
**BREAKING** bug in Streamer.bot versions < `v0.2.3`
::
Until Streamer.bot `v0.2.3` enters `beta` or `stable`, you will have to use a workaround to handle custom events:

```ts
const client = new StreamerbotClient({
subscribe: {
General: ['Custom']
},
onData: (data) => {
if (data.event && data.event.source === 'None' && data.event.type === 'Custom') {
const payload = data.data;
// handle your custom event in here
}
}
})
```

0 comments on commit 8ec552b

Please sign in to comment.