Skip to content

Commit e3b91fb

Browse files
docs: add chat data-attributes info
1 parent 6c13905 commit e3b91fb

1 file changed

Lines changed: 97 additions & 6 deletions

File tree

  • streamerbot/2.guide/23.extra-features

streamerbot/2.guide/23.extra-features/chat.md

Lines changed: 97 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Multi-stream chat client with deep Streamer.bot integration
44
logo: https://streamer.bot/logo-transparent.svg
55
---
66

7-
![Streamer.bot Chat](assets/chat.png){caption-alt}
7+
![Streamer.bot Chat](assets/chat.png)
88

99
## Features
1010
Streamer.bot ships with a built-in chat client to provide you with direct integration between chat and your bot's actions.
@@ -27,7 +27,7 @@ By default, the chat window will enable a tabbed view for all broadcaster accoun
2727

2828
While on the combined chat view, you can toggle which chat(s) to send to:
2929

30-
![Multi-Chat Toggle](assets/chat-toggle.png){caption-salt}
30+
![Multi-Chat Toggle](assets/chat-toggle.png)
3131

3232
#### Shortcuts
3333
Keyboard shortcuts exist to easily direct your chat messages to/from different accounts:
@@ -161,13 +161,13 @@ Streamer.bot v0.2.5 or later is required to be able to **send messages** from do
161161
| Streamer.bot Chat | `https://chat.streamer.bot/feed/chat` |
162162
| Streamer.bot Event Feed | `https://chat.streamer.bot/feed/events` |
163163

164-
![OBS Browser Docks Dialog](assets/chat-obs-browser-docks.png){caption-alt}
164+
![OBS Browser Docks Dialog](assets/chat-obs-browser-docks.png)
165165

166166
3. Configure Connection Details
167167

168168
- Enter your Streamer.bot WebSocket Server details in the dialog:
169169

170-
![Streamer.bot Chat WebSocket Config](assets/chat-obs-connection.png){caption-alt}
170+
![Streamer.bot Chat WebSocket Config](assets/chat-obs-connection.png)
171171

172172
4. Done!
173173

@@ -201,7 +201,7 @@ Docked chat is limited in some ways due to requiring the WebSocket Server to fun
201201

202202
## Overlay
203203

204-
![Chat Overlay Preview](./assets/chat-overlay.gif){caption-alt}
204+
![Chat Overlay Preview](./assets/chat-overlay.gif)
205205

206206
::warning
207207
**Overlay mode is currently experimental and is subject to active changes**
@@ -236,4 +236,95 @@ Docked chat is limited in some ways due to requiring the WebSocket Server to fun
236236

237237
::success
238238
You now have a Streamer.bot chat overlay source in OBS Studio!
239-
::
239+
::
240+
241+
## Custom Styles
242+
243+
::note
244+
Future Streamer.bot Chat updates will be focused on improving customization options
245+
::
246+
247+
Currently, customization of chat and overlay requires custom CSS overrides.
248+
249+
Some `data-attributes` have been added to the DOM for easier targeting of specific elements.
250+
251+
### Chat Messages
252+
These attributes are available specifically on chat message rows.
253+
254+
::field-group
255+
::field{name="data-platform" type="string"}
256+
The platform name for a given chat message row.
257+
:br
258+
Values: `twitch`, `youtube`, `kick`, `trovo`
259+
::
260+
261+
::field{name="data-user-id" type="string"}
262+
The ID of the user who sent the chat message.
263+
::
264+
265+
::field{name="data-username" type="string"}
266+
The canonical login name of the user who sent the chat message.
267+
::
268+
269+
::field{name="data-display-name" type="string"}
270+
The display name of the user who sent the chat message.
271+
::
272+
::
273+
274+
### Events
275+
276+
::tip
277+
You can use these event attributes to apply custom styles for any specific events, such as follows or subscriptions.
278+
::
279+
280+
::read-more{to=/api/websocket/events}
281+
For a full list of possible event source and types, refer to the **WebSocket Events** documentation.
282+
::
283+
284+
These attributes are available on **all** rows visible in chat, *including chat messages*.
285+
286+
::field-group
287+
::field{name="data-event-source" type="string"}
288+
The source of the event.
289+
:br
290+
Values: `Twitch`, `YouTube`, `Trovo`, etc...
291+
::
292+
293+
::field{name="data-event-type" type="string"}
294+
The type of event.
295+
:br
296+
Values: `ChatMessage`, `Follow`, `Subscription`, etc...
297+
::
298+
::
299+
300+
### Examples
301+
302+
::tip
303+
If you are using the chat overlay in OBS Studio, you can add custom CSS directly in your browser source settings!
304+
::
305+
306+
```css [style.css]
307+
/* Hide all rows originating from Twitch */
308+
[data-platform="twitch"] {
309+
display: none !important;
310+
}
311+
312+
/* Hide messages from a specific username */
313+
[data-username="someannoyinguser69"] {
314+
display: none !important;
315+
}
316+
317+
/* Highlight messages from a specific user */
318+
[data-username="bestmodever"] {
319+
background-color: rgba(255, 215, 0, 0.2);
320+
border: 1px solid gold;
321+
border-radius: 4px;
322+
}
323+
324+
/* Custom CSS for Twitch Follow events */
325+
[data-event-source="Twitch"][data-event-type="Follow"] {
326+
background-color: rgba(100, 65, 165, 0.2);
327+
border: 1px solid rebeccapurple;
328+
border-radius: 4px;
329+
}
330+
```

0 commit comments

Comments
 (0)