mirror of
https://github.com/aramperes/ts-activity.git
synced 2025-09-08 05:48:31 -04:00
Simplify client map
This commit is contained in:
parent
eafdbff4d5
commit
976b8dc0a9
1 changed files with 8 additions and 8 deletions
16
cmd.go
16
cmd.go
|
@ -50,7 +50,7 @@ func main() {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
clientMap := make(map[int]string)
|
||||
clientMap := make(map[string]string)
|
||||
|
||||
log.Println("Online clients:")
|
||||
for _, client := range cl {
|
||||
|
@ -58,7 +58,7 @@ func main() {
|
|||
continue
|
||||
}
|
||||
log.Println("-", client)
|
||||
clientMap[client.ID] = client.Nickname
|
||||
clientMap[strconv.Itoa(client.ID)] = client.Nickname
|
||||
}
|
||||
|
||||
// Listen for client updates
|
||||
|
@ -73,9 +73,9 @@ func main() {
|
|||
continue
|
||||
}
|
||||
|
||||
clientId, err := strconv.Atoi(event.Data["clid"])
|
||||
if err != nil {
|
||||
log.Println("Failed to get client ID:", err)
|
||||
clientId, ok := event.Data["clid"]
|
||||
if !ok {
|
||||
log.Println("User has no client id", event.Data)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -92,9 +92,9 @@ func main() {
|
|||
ClientConnected(discord, clientNick)
|
||||
}
|
||||
} else if event.Type == "clientleftview" {
|
||||
clientId, err := strconv.Atoi(event.Data["clid"])
|
||||
if err != nil {
|
||||
log.Println("Failed to get client ID:", err)
|
||||
clientId, ok := event.Data["clid"]
|
||||
if !ok {
|
||||
log.Println("User has no client id", event.Data)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue