dcbot/internal/domain/group.go
Dawid Wysokiński 6c2c061b87
All checks were successful
continuous-integration/drone/push Build is passing
feat: add 4 new options to group add (#6)
Reviewed-on: #6
2022-10-09 06:31:38 +00:00

70 lines
1.5 KiB
Go

package domain
import "time"
type Group struct {
ID string
ServerID string // Discord server ID
ChannelGainedVillages string
ChannelLostVillages string
ServerKey string // Tribal Wars server key
VersionCode string
CreatedAt time.Time
}
type CreateGroupParams struct {
serverID string
serverKey string
versionCode string
channelGainedVillages string
channelLostVillages string
}
func NewCreateGroupParams(serverID, versionCode, serverKey, channelGainedVillages, channelLostVillages string) (CreateGroupParams, error) {
if serverID == "" {
return CreateGroupParams{}, RequiredError{
Field: "ServerID",
}
}
if versionCode == "" {
return CreateGroupParams{}, RequiredError{
Field: "VersionCode",
}
}
if serverKey == "" {
return CreateGroupParams{}, RequiredError{
Field: "ServerKey",
}
}
return CreateGroupParams{
serverID: serverID,
serverKey: serverKey,
versionCode: versionCode,
channelGainedVillages: channelGainedVillages,
channelLostVillages: channelLostVillages,
}, nil
}
func (c CreateGroupParams) ServerID() string {
return c.serverID
}
func (c CreateGroupParams) VersionCode() string {
return c.versionCode
}
func (c CreateGroupParams) ServerKey() string {
return c.serverKey
}
func (c CreateGroupParams) ChannelGainedVillages() string {
return c.channelGainedVillages
}
func (c CreateGroupParams) ChannelLostVillages() string {
return c.channelLostVillages
}