Dawid Wysokiński
79f19b7a23
All checks were successful
continuous-integration/drone/push Build is passing
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package domain
|
|
|
|
type EnnoblementNotificationType uint8
|
|
|
|
const (
|
|
EnnoblementNotificationTypeGain EnnoblementNotificationType = iota
|
|
EnnoblementNotificationTypeLoss
|
|
)
|
|
|
|
type EnnoblementNotification struct {
|
|
Type EnnoblementNotificationType
|
|
ServerID string
|
|
ChannelID string
|
|
LanguageTag string
|
|
Ennoblement Ennoblement
|
|
}
|
|
|
|
func NewEnnoblementNotifications(g GroupWithMonitors, ennoblements []Ennoblement) []EnnoblementNotification {
|
|
var notifications []EnnoblementNotification
|
|
|
|
for _, e := range ennoblements {
|
|
if g.CanSendEnnoblementNotificationTypeGain(e) {
|
|
notifications = append(notifications, EnnoblementNotification{
|
|
Type: EnnoblementNotificationTypeGain,
|
|
ServerID: g.ServerID,
|
|
ChannelID: g.ChannelGains,
|
|
LanguageTag: g.LanguageTag,
|
|
Ennoblement: e,
|
|
})
|
|
}
|
|
|
|
if g.CanSendEnnoblementNotificationTypeLoss(e) {
|
|
notifications = append(notifications, EnnoblementNotification{
|
|
Type: EnnoblementNotificationTypeLoss,
|
|
ServerID: g.ServerID,
|
|
ChannelID: g.ChannelLosses,
|
|
LanguageTag: g.LanguageTag,
|
|
Ennoblement: e,
|
|
})
|
|
}
|
|
}
|
|
|
|
return notifications
|
|
}
|