2022-10-27 09:56:40 +00:00
|
|
|
package domain
|
|
|
|
|
|
|
|
type EnnoblementNotificationType uint8
|
|
|
|
|
|
|
|
const (
|
2023-06-18 06:47:51 +00:00
|
|
|
EnnoblementNotificationTypeGain EnnoblementNotificationType = iota
|
2022-10-27 09:56:40 +00:00
|
|
|
EnnoblementNotificationTypeLoss
|
|
|
|
)
|
|
|
|
|
|
|
|
type EnnoblementNotification struct {
|
|
|
|
Type EnnoblementNotificationType
|
|
|
|
ServerID string
|
|
|
|
ChannelID string
|
2023-06-30 05:09:52 +00:00
|
|
|
LanguageTag string
|
2022-10-27 09:56:40 +00:00
|
|
|
Ennoblement Ennoblement
|
|
|
|
}
|
2023-07-09 05:44:35 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|