39 lines
748 B
Go
39 lines
748 B
Go
package store
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"gitnet.fr/deblan/owncast-webhook/internal/config"
|
|
webhook "gitnet.fr/deblan/owncast-webhook/internal/web/webhook/owncast"
|
|
)
|
|
|
|
type OwncastMessage struct {
|
|
WebhookMessage webhook.Message
|
|
}
|
|
|
|
func (o OwncastMessage) ID() string {
|
|
return o.WebhookMessage.Id
|
|
}
|
|
|
|
func (o OwncastMessage) Visible() bool {
|
|
return o.WebhookMessage.Visible
|
|
}
|
|
|
|
func (o OwncastMessage) Origin() MessageOrigin {
|
|
return MessageOriginOwncast
|
|
}
|
|
|
|
func (o OwncastMessage) Author() string {
|
|
return o.WebhookMessage.User.DisplayName
|
|
}
|
|
|
|
func (o OwncastMessage) Content() string {
|
|
content := strings.ReplaceAll(
|
|
o.WebhookMessage.Body,
|
|
`<img src="`,
|
|
fmt.Sprintf(`<img src="%s`, config.Get().Owncast.BaseUrl),
|
|
)
|
|
|
|
return content
|
|
}
|