Add /iplist to admin commands

Lists all clients' UUID's, names, and IPs to console.
This commit is contained in:
Zorchenhimer 2019-03-23 16:53:36 -04:00
parent 6ef0d6f1a5
commit 88365b6df5
2 changed files with 20 additions and 1 deletions

View File

@ -293,6 +293,24 @@ var commands = &CommandControl{
return "Single use password: " + password
},
},
common.CNIP.String(): Command{
HelpText: "list users and IP in the server console",
Function: func(cl *Client, args []string) string {
cl.belongsTo.clientsMtx.Lock()
fmt.Println("Clients:")
for uuid, client := range cl.belongsTo.clients {
fmt.Printf(" [%s] %s %s\n", uuid, client.name, client.conn.Host())
}
fmt.Println("TmpConn:")
for uuid, conn := range cl.belongsTo.tempConn {
fmt.Printf(" [%s] %s\n", uuid, conn.Host())
}
cl.belongsTo.clientsMtx.Unlock()
return "see console for output"
},
},
},
}

View File

@ -34,6 +34,7 @@ var (
CNReloadPlayer ChatCommandNames = []string{"reloadplayer"}
CNReloadEmotes ChatCommandNames = []string{"reloademotes"}
CNModpass ChatCommandNames = []string{"modpass"}
CNIP ChatCommandNames = []string{"iplist"}
)
var ChatCommands = []ChatCommandNames{
@ -42,7 +43,7 @@ var ChatCommands = []ChatCommandNames{
// Mod
CNSv, CNPlaying, CNUnmod, CNKick, CNBan, CNUnban, CNPurge,
// Admin
CNMod, CNReloadPlayer, CNReloadEmotes, CNModpass,
CNMod, CNReloadPlayer, CNReloadEmotes, CNModpass, CNIP,
}
func GetFullChatCommand(c string) string {