diff --git a/README.md b/README.md index 746faff..7f05e39 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ The config file is generated automatically on first startup. - **`GET`** `/v1/channels` ```json { - "id": 1, "databaseId": 1, + "channelId": 1, "nickname": "serveradmin from 127.0.0.1:58359", "type": 1, "away": false, @@ -51,3 +51,21 @@ The config file is generated automatically on first startup. "neededSubscribePower": 0 } ``` +## Server +- **`GET`** `/v1/server/info` +```json +{ + "name": "TeamSpeak ]I[ Server", + "status": "online", + "version": "3.5.1 [Build: 1545076855]", + "welcomeMessage": "Welcome to TeamSpeak, check [URL]www.teamspeak.com[/URL] for latest information", + "maxClients": 32, + "clientsOnline": 2, + "reservedSlots": 0, + "uptime": 5976, + "totalPing": 0, + "minAndroidVersion": 1502275280, + "minClientVersion": 1513163251, + "miniOSVersion": 1502275280 +} +``` diff --git a/features/client/client.go b/features/client/client.go index 14f557a..e6ef949 100644 --- a/features/client/client.go +++ b/features/client/client.go @@ -6,8 +6,8 @@ type Service interface { } type Client struct { - ID int `json:"id"` DatabaseID int `json:"databaseId"` + ChannelID int `json:"channelId"` Nickname string `json:"nickname"` Type int `json:"type"` Away bool `json:"away"` diff --git a/service/client.go b/service/client.go index 79de5b9..f806807 100644 --- a/service/client.go +++ b/service/client.go @@ -16,7 +16,7 @@ func (s Service) Client(id int) (*client.Client, error) { var c *client.Client for _, client := range clients { - if client.ID == id { + if client.DatabaseID == id { c = convertClient(client) break } @@ -26,6 +26,10 @@ func (s Service) Client(id int) (*client.Client, error) { return nil, errors.New("client does not exist") } + /* if _, err := s.TSClient.Server.ExecCmd(ts3.NewCmd(fmt.Sprintf("clientinfo clid=%d", c.ID)).WithResponse(&c)); err != nil { + return nil, err + } */ + return c, nil } @@ -46,8 +50,8 @@ func (s Service) Clients() ([]*client.Client, error) { func convertClient(c *ts3.OnlineClient) *client.Client { return &client.Client{ - ID: c.ID, DatabaseID: c.DatabaseID, + ChannelID: c.ID, Nickname: c.Nickname, Type: c.Type, Away: c.Away,