Multivit4min / TS3-NodeJS-Library

TeamSpeak 3 Server Query Library supports SSH and RAW Query
https://multivit4min.github.io/TS3-NodeJS-Library/
MIT License
149 stars 20 forks source link

clientInfos.clientTalkRequest wrong type #194

Closed TimMatten closed 1 year ago

TimMatten commented 1 year ago

Describe the bug The property "CLIENT_TALK_REQUEST" of the client is of type boolean but should be of type string.

To Reproduce Code:

this.teamspeak.getClientById(key).then(async (tsClient) => {
    const clientInfos = await tsClient.getInfo();
    console.log(clientInfos.clientTalkRequest); // return true or false
});

Result via putty: CLIENT_TALK_REQUEST

Expected behavior Should return a result of type string (timestamp of requesttime)

Versions used

Additional context Possible workaround until fix, using webquery.

export async function hasClientRequestedTalkpower(clid: string, httpService: HttpService) {
    const url = `http://${process.env.TS_IP}:${process.env.TS_PORT_QUERY_WEB_API}/byport/${process.env.TS_PORT}/clientinfo`;
    const response = await firstValueFrom(
        httpService.post(
            url,
            { clid: clid },
            {
                headers: {
                    'x-api-key': process.env.TS_QUERY_WEB_API_KEY,
                },
            },
        ),
    );
    return response.data.body[0]['client_talk_request'] != '0';
}