This commit is contained in:
shoopea 2019-06-11 10:14:19 +08:00
parent e2428168ae
commit 1d5a4bcac9
2 changed files with 10 additions and 3 deletions

View File

@ -106,6 +106,7 @@ func main() {
_, _ = addObjCastle(`🥔`, `Potato`)
_, _ = addObjCastle(`🦈`, `Sharkteeth`)
_, _ = addObjCastle(`🐺`, `Wolfpack`)
_, _ = addObjCastle(``, `Unknwon`)
_, _ = addObjGuild(``, `No Guild`)
}

12
obj.go
View File

@ -240,9 +240,15 @@ func addObjCastle(logo string, name string) (int64, error) {
}
func getObjCastleID(s string) int64 {
v, _ := cacheObjCastle.Load(s)
c := v.(ChatWarsCastle)
return c.ObjID64
if v, ok := cacheObjCastle.Load(s); ok {
c := v.(ChatWarsCastle)
return c.ObjID64
} else {
v, _ := cacheObjCastle.Load(``)
c := v.(ChatWarsCastle)
return c.ObjID64
}
}
func loadObjCastle() error {