discordjs handle promise code example
Example: discord function promise
function promise(){
return new Promise((resolve, reject) =>{
// Code //
resolve("Resolved!"); // "Returns" resolved
reject("Rejected!"); // "Returns" rejected
// Code //
}):
};
// Usage //
promise()
.then(res => {
console.log(res)
}) // Done when resolved //
.catch(err => {
console.log(err)
}) // Done when Rejected //