pls pull #1
3 changed files with 26 additions and 4 deletions
20
README.md
20
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
|
||||
}
|
||||
```
|
||||
|
|
|
@ -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"`
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue