strimertul/twitch/alerts/config.go

70 lines
3.4 KiB
Go

package alerts
import (
"encoding/json"
"github.com/nicklaw5/helix/v2"
)
const ConfigKey = "twitch/alerts/config"
type eventSubNotification struct {
Subscription helix.EventSubSubscription `json:"subscription"`
Challenge string `json:"challenge"`
Event json.RawMessage `json:"event" desc:"Event payload, as JSON object"`
}
type subscriptionVariation struct {
MinStreak *int `json:"min_streak,omitempty" desc:"Minimum streak to get this message"`
IsGifted *bool `json:"is_gifted,omitempty" desc:"If true, only gifted subscriptions will get these messages"`
Messages []string `json:"messages" desc:"List of message to write on subscription, one at random will be picked"`
}
type giftSubVariation struct {
MinCumulative *int `json:"min_cumulative,omitempty" desc:"Minimum cumulative amount to get this message"`
IsAnonymous *bool `json:"is_anonymous,omitempty" desc:"If true, only anonymous gifts will get these messages"`
Messages []string `json:"messages" desc:"List of message to write on gifted subscription, one at random will be picked"`
}
type raidVariation struct {
MinViewers *int `json:"min_viewers,omitempty" desc:"Minimum number of viewers to get this message"`
Messages []string `json:"messages" desc:"List of message to write on raid, one at random will be picked"`
}
type cheerVariation struct {
MinAmount *int `json:"min_amount,omitempty" desc:"Minimum amount to get this message"`
Messages []string `json:"messages" desc:"List of message to write on cheer, one at random will be picked"`
}
type Config struct {
Follow struct {
Enabled bool `json:"enabled" desc:"Enable chat message alert on follow"`
Messages []string `json:"messages" desc:"List of message to write on follow, one at random will be picked"`
Announce bool `json:"announce" desc:"If true, send as announcement"`
} `json:"follow"`
Subscription struct {
Enabled bool `json:"enabled" desc:"Enable chat message alert on subscription"`
Messages []string `json:"messages" desc:"List of message to write on subscription, one at random will be picked"`
Announce bool `json:"announce" desc:"If true, send as announcement"`
Variations []subscriptionVariation `json:"variations"`
} `json:"subscription"`
GiftSub struct {
Enabled bool `json:"enabled" desc:"Enable chat message alert on gifted subscription"`
Messages []string `json:"messages" desc:"List of message to write on gifted subscription, one at random will be picked"`
Announce bool `json:"announce" desc:"If true, send as announcement"`
Variations []giftSubVariation `json:"variations"`
} `json:"gift_sub"`
Raid struct {
Enabled bool `json:"enabled" desc:"Enable chat message alert on raid"`
Messages []string `json:"messages" desc:"List of message to write on raid, one at random will be picked"`
Announce bool `json:"announce" desc:"If true, send as announcement"`
Variations []raidVariation `json:"variations"`
} `json:"raid"`
Cheer struct {
Enabled bool `json:"enabled" desc:"Enable chat message alert on cheer"`
Messages []string `json:"messages" desc:"List of message to write on cheer, one at random will be picked"`
Announce bool `json:"announce" desc:"If true, send as announcement"`
Variations []cheerVariation `json:"variations"`
} `json:"cheer"`
}