dcbot/internal/domain/tw.go

133 lines
2.4 KiB
Go
Raw Normal View History

package domain
import (
"fmt"
"time"
)
type TribeMeta struct {
ID int64
Name string
Tag string
ProfileURL string
}
type NullTribeMeta struct {
Tribe TribeMeta
Valid bool
}
type PlayerMeta struct {
ID int64
Name string
ProfileURL string
Tribe NullTribeMeta
}
type NullPlayerMeta struct {
Player PlayerMeta
Valid bool
}
type VillageMeta struct {
ID int64
FullName string
ProfileURL string
Player NullPlayerMeta
}
type Ennoblement struct {
ID int64
Village VillageMeta
NewOwner NullPlayerMeta
CreatedAt time.Time
}
type TWServerDoesNotExistError struct {
VersionCode string
Key string
}
var _ TranslatableError = TWServerDoesNotExistError{}
func (e TWServerDoesNotExistError) Error() string {
return fmt.Sprintf("server (versionCode=%s,key=%s) doesn't exist", e.VersionCode, e.Key)
}
func (e TWServerDoesNotExistError) Slug() string {
return "tw-server-does-not-exist"
}
func (e TWServerDoesNotExistError) Params() map[string]any {
return map[string]any{
"VersionCode": e.VersionCode,
"Key": e.Key,
}
}
type TWServerIsClosedError struct {
VersionCode string
Key string
}
var _ TranslatableError = TWServerIsClosedError{}
func (e TWServerIsClosedError) Error() string {
return fmt.Sprintf("server (versionCode=%s,key=%s) is closed", e.VersionCode, e.Key)
}
func (e TWServerIsClosedError) Slug() string {
return "tw-server-is-closed"
}
func (e TWServerIsClosedError) Params() map[string]any {
return map[string]any{
"VersionCode": e.VersionCode,
"Key": e.Key,
}
}
type TribeDoesNotExistError struct {
Tag string
}
var _ TranslatableError = TribeDoesNotExistError{}
func (e TribeDoesNotExistError) Error() string {
return fmt.Sprintf("tribe (tag=%s) doesn't exist", e.Tag)
}
func (e TribeDoesNotExistError) UserError() string {
return e.Error()
}
func (e TribeDoesNotExistError) Slug() string {
return "tribe-does-not-exist"
}
func (e TribeDoesNotExistError) Params() map[string]any {
return map[string]any{
"Tag": e.Tag,
}
}
type TribeNotFoundError struct {
Tag string
}
var _ TranslatableError = TribeNotFoundError{}
func (e TribeNotFoundError) Error() string {
return fmt.Sprintf("tribe (tag=%s) not found", e.Tag)
}
func (e TribeNotFoundError) Slug() string {
return "tribe-not-found"
}
func (e TribeNotFoundError) Params() map[string]any {
return map[string]any{
"Tag": e.Tag,
}
}