why do i become when i run this function as callback [object Promise] ? i use the Ts3 nodejs framework by Miltivit4min (Github)
here some code i tried (return value = [object Promise])
async function getChannelName(cid) {
await teamspeak.getChannelByID(cid).then(data => {
return data.name;
});
};
how can i convert this value to a string with a value like "My cool Channel"
best regards
An
async
function always returns aPromise
by design and yourgetChannelName
function has no return statement, so the promise is never resolved. Also you are mixing up someawait
and.then()
syntax, you only need one of them.