Multivit4min / TS3-NodeJS-Library

TeamSpeak 3 Server Query Library supports SSH and RAW Query

Home Page:https://multivit4min.github.io/TS3-NodeJS-Library/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing function

Maurice037 opened this issue · comments

Hello,
I searched a function to edit the client description but i don't found it
do these even exist?

yes https://multivit4min.github.io/TS3-NodeJS-Library/classes/teamspeakclient.html#edit

  const client = await teamspeak.getClientById(123)
  await client.edit({ clientDescription: "foo" })

okay thx but i become this problem when i use getClientByUid(element.cid)

element.cid: 3xGTNx0/Vlsledb90i5xlL1Hts0=
getclient: undefined

what is the problem here

  const user = ts3.getClientByUid(element.cid);
  console.log("element.cid:",element.cid);
  console.log("getclient:",user.cid) 

ts3.getClientByUid(...) returns a Promise which resolves to the client
if the function resolves to an undefined value then its because the client is not online on the server

no the client is online

if the client is online it probably is in a channel where the teamspeak query client has no access to view due to not high enough permissions

The query have all perms.

then please the getClientByUid still returns a Promise not the client directly

Yes its output a Promise

yes and you need to resolve it first before you get the client
docs about Promises can be found here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

thanks i had forget to use async and await :D