Twitch single-message deletion basic support

This commit is contained in:
Luxferre
2024-09-20 16:17:20 +03:00
parent 3d65d68d8a
commit 707b9e611a
7 changed files with 103 additions and 45 deletions
+6 -2
View File
@@ -59,9 +59,11 @@ An **internal** StreamGoose backend is a Go program embedded as a goroutine into
```go
type ChatMessage struct {
Id uint64 `json:"id"` /* message id (auto-filled) */
NativeId string `json:"native_id"` /* message id native to the platform */
AuthorId string `json:"author_id"` /* author id native to the platform */
Type string `json:"type"` /* message type string */
Timestamp string `json:"timestamp"` /* timestamp string (formatted) */
Username string `json:"username"` /* username */
Username string `json:"username"` /* author username (as displayed) */
Text string `json:"text"` /* message text */
Icon string `json:"icon"` /* optional message icon URI */
}
@@ -71,7 +73,9 @@ The `Id` field is populated automatically whenever a message enters the broker.
An **external** StreamGoose backend is a program (written in any network-enabled programming language) that can make a POST request to the corresponding message broker URL (`http://[broker_host]:60053/new` endpoint). The request body shall be a JSON object with the following fields (all passed as strings):
- `type`: message type, consisting of `^`-delimited classes (e.g. `yt^moderator` or `tw^vip^color#A1B2C3` etc, see below in the "Customization" section of this README). This field defines how the message will be styled when being rendered on the frontend.
- `native_id`: an ID string assigned to the message by the streaming platform itself (Twitch, YouTube etc). Used to further handling deleted messages.
- `author_id`: an ID string assigned to the message author by the streaming platform itself. Used to further handle bans and subsequent message deletions.
- `type`: message type, consisting of `^`-delimited classes (e.g. `yt^moderator` or `tw^vip^color#A1B2C3` etc, see below in the "Customization" section of this README). This field defines how the message will be styled when being rendered on the frontend. There are two special message types, `delmsg` and `deluser`, that require `native_id` and `author_id` fields respectively to be set in order to perform message deletion on the frontend.
- `timestamp`: an ISO 8601 **UTC** timestamp string denoting when the message was sent. The only recommended format (in strftime syntax) is `%Y-%m-%dT%H:%M:%SZ`.
- `username`: the message author name that should be displayed in the chat.
- `text`: the message text that should be displayed in the chat.