2021-05-02 12:29:43 +00:00
|
|
|
package loyalty
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
const ConfigKey = "loyalty/config"
|
|
|
|
|
|
|
|
type Config struct {
|
2021-12-09 10:45:10 +00:00
|
|
|
Enabled bool `json:"enabled"`
|
2021-05-14 11:15:38 +00:00
|
|
|
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"
|
|
|
|
|
|
|
|
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"`
|
2021-05-02 19:34:55 +00:00
|
|
|
CustomRequest string `json:"required_info,omitempty"`
|
2021-07-11 13:34:39 +00:00
|
|
|
Cooldown int64 `json:"cooldown"`
|
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"`
|
|
|
|
}
|
|
|
|
|
2021-05-16 15:55:40 +00:00
|
|
|
const PointsPrefix = "loyalty/points/"
|
2021-05-02 12:29:43 +00:00
|
|
|
|
2021-05-16 15:55:40 +00:00
|
|
|
type PointsEntry struct {
|
|
|
|
Points int64 `json:"points"`
|
|
|
|
}
|
2021-05-02 12:29:43 +00:00
|
|
|
|
|
|
|
const QueueKey = "loyalty/redeem-queue"
|
|
|
|
|
|
|
|
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-18 11:30:27 +00:00
|
|
|
RequestText string `json:"request_text"`
|
2021-05-02 12:29:43 +00:00
|
|
|
}
|
2021-05-02 17:39:46 +00:00
|
|
|
|
2022-11-23 21:53:48 +00:00
|
|
|
const (
|
|
|
|
CreateRedeemRPC = "loyalty/@create-redeem"
|
|
|
|
RemoveRedeemRPC = "loyalty/@remove-redeem"
|
|
|
|
RedeemEvent = "loyalty/ev/new-redeem"
|
|
|
|
)
|
2021-12-06 11:22:06 +00:00
|
|
|
|
|
|
|
// 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"`
|
|
|
|
}
|