docs: add descriptions on loyalty keys

This commit is contained in:
Ash Keel 2023-02-18 14:01:48 +01:00
parent cb25f1a662
commit 30bc0b1ff9
No known key found for this signature in database
GPG Key ID: BAD8D93E7314ED3E
2 changed files with 30 additions and 48 deletions

View File

@ -5,14 +5,14 @@ import "time"
const ConfigKey = "loyalty/config"
type Config struct {
Enabled bool `json:"enabled"`
Currency string `json:"currency"`
Enabled bool `json:"enabled" desc:"Enable the loyalty system"`
Currency string `json:"currency" desc:"Name of the currency"`
Points struct {
Interval int64 `json:"interval"` // in seconds!
Amount int64 `json:"amount"`
ActivityBonus int64 `json:"activity_bonus"`
} `json:"points"`
BanList []string `json:"banlist"`
Interval int64 `json:"interval" desc:"How often to distribute points, in seconds"` // in seconds!
Amount int64 `json:"amount" desc:"How many points to award every interval"`
ActivityBonus int64 `json:"activity_bonus" desc:"Extra points for active chatters"`
} `json:"points" desc:"Settings for distributing currency to online viewers"`
BanList []string `json:"banlist" desc:"Usernames to exclude from currency distribution"`
}
const RewardsKey = "loyalty/rewards"
@ -20,41 +20,41 @@ const RewardsKey = "loyalty/rewards"
const GoalsKey = "loyalty/goals"
type Reward struct {
Enabled bool `json:"enabled"`
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Image string `json:"image"`
Price int64 `json:"price"`
CustomRequest string `json:"required_info,omitempty"`
Cooldown int64 `json:"cooldown"`
Enabled bool `json:"enabled" desc:"Is the reward enabled (redeemable)?"`
ID string `json:"id" desc:"Reward ID"`
Name string `json:"name" desc:"Name of the reward"`
Description string `json:"description" desc:"Description of the reward"`
Image string `json:"image" desc:"Reward icon URL"`
Price int64 `json:"price" desc:"How much does is cost"`
CustomRequest string `json:"required_info,omitempty" desc:"If present, reward requires user input and this field is the help text"`
Cooldown int64 `json:"cooldown" desc:"Time in seconds to wait before this reward can be redeemed again"`
}
type Goal struct {
Enabled bool `json:"enabled"`
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Image string `json:"image"`
TotalGoal int64 `json:"total"`
Contributed int64 `json:"contributed"`
Contributors map[string]int64 `json:"contributors"`
Enabled bool `json:"enabled" desc:"Is the goal enabled?"`
ID string `json:"id" desc:"Community goal ID"`
Name string `json:"name" desc:"Name of the community goal"`
Description string `json:"description" desc:"Description of the goal"`
Image string `json:"image" desc:"Goal icon URL"`
TotalGoal int64 `json:"total" desc:"How many points does the goal need to be met in total"`
Contributed int64 `json:"contributed" desc:"How many points have been contributed so far"`
Contributors map[string]int64 `json:"contributors" desc:"Dictionary of how much every viewer has contributed"`
}
const PointsPrefix = "loyalty/points/"
type PointsEntry struct {
Points int64 `json:"points"`
Points int64 `json:"points" desc:"Currency balance"`
}
const QueueKey = "loyalty/redeem-queue"
type Redeem struct {
Username string `json:"username"`
DisplayName string `json:"display_name"`
Reward Reward `json:"reward"`
When time.Time `json:"when"`
RequestText string `json:"request_text"`
Username string `json:"username" desc:"Username of who redeemed the reward"`
DisplayName string `json:"display_name" desc:"Display name of who redeemed the reward"`
Reward Reward `json:"reward" desc:"Reward that was redeemed"`
When time.Time `json:"when" desc:"Time of the redeem"`
RequestText string `json:"request_text" desc:"If the reward required user input it will be here"`
}
const (
@ -62,21 +62,3 @@ const (
RemoveRedeemRPC = "loyalty/@remove-redeem"
RedeemEvent = "loyalty/ev/new-redeem"
)
// Stulbe events
type ExLoyaltyRedeem struct {
Username string `json:"username"`
DisplayName string `json:"display_name"`
Channel string `json:"channel"`
RewardID string `json:"reward_id"`
RequestText string `json:"request_text"`
}
type ExLoyaltyContribute struct {
Username string `json:"username"`
DisplayName string `json:"display_name"`
Channel string `json:"channel"`
GoalID string `json:"goal_id"`
Amount int64 `json:"amount"`
}

View File

@ -10,7 +10,7 @@ import (
var Keys = interfaces.KeyMap{
ConfigKey: interfaces.KeyDef{
Description: "General configuration for the loyalty subsystem",
Description: "General configuration for the loyalty system",
Type: reflect.TypeOf(Config{}),
},
RewardsKey: interfaces.KeyDef{