1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-20 02:00:49 +00:00
strimertul/modules/loyalty/data.go

66 lines
1.6 KiB
Go
Raw Normal View History

2021-05-02 12:29:43 +00:00
package loyalty
import "time"
const ConfigKey = "loyalty/config"
type Config struct {
Currency string `json:"currency"`
Points struct {
2021-05-02 12:29:43 +00:00
Interval int64 `json:"interval"` // in seconds!
Amount int64 `json:"amount"`
ActivityBonus int64 `json:"activity_bonus"`
} `json:"points"`
BanList []string `json:"banlist"`
}
const RewardsKey = "loyalty/rewards"
type RewardStorage []Reward
const GoalsKey = "loyalty/goals"
type GoalStorage []Goal
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"`
2021-05-02 19:34:55 +00:00
CustomRequest string `json:"required_info,omitempty"`
2021-05-02 12:29:43 +00:00
}
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"`
}
const PointsPrefix = "loyalty/points/"
2021-05-02 12:29:43 +00:00
type PointsEntry struct {
Points int64 `json:"points"`
}
2021-05-02 12:29:43 +00:00
const QueueKey = "loyalty/redeem-queue"
type RedeemQueueStorage []Redeem
type Redeem struct {
2021-05-02 15:59:03 +00:00
Username string `json:"username"`
DisplayName string `json:"display_name"`
Reward Reward `json:"reward"`
When time.Time `json:"when"`
2021-05-02 12:29:43 +00:00
}
const CreateRedeemRPC = "loyalty/@create-redeem"
const RemoveRedeemRPC = "loyalty/@remove-redeem"
const RedeemEvent = "loyalty/ev/new-redeem"