dcbot/internal/domain/group.go

70 lines
1.5 KiB
Go
Raw Normal View History

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
}