This is code
function getUser(username) {
return fetch(`https://api.twitch.tv/helix/users?login=${username}`, {
method: "GET",
headers: {
'Client-ID': "csj7l3h1nqr7***********cen9",
"Authorization": "Bearer pshj9**********mvgl1wfvfhko9e",
}
});
}
await getUser(args[0]).then((res) => {
if (res._total === 0) {
return message.channel.send(new MessageEmbed().setColor(client.config.colors.Red).setDescription("You must specify **valid** a twitch username !"))
} else {
twitchID = res.users[0]._id
}
})
Result:
