Added another function into DangerCord function file.

This commit is contained in:
Nahokey
2024-04-28 18:55:18 +00:00
parent ee5960ddc1
commit 483875609b
+19 -2
View File
@@ -25,7 +25,7 @@ async function dangercordcheckVerification(userId, accessToken) {
return 0; // Not allowed to continue
} else {
return 1; // Allowed to continue
}
}
}
} catch (error) {
console.error('Error fetching user data:', error);
@@ -33,4 +33,21 @@ async function dangercordcheckVerification(userId, accessToken) {
}
}
module.exports = { dangercordcheckVerification };
async function dangercordcheckInfo(userId, accessToken) {
const url = `https://dangercord.com/api/v1/user/${userId}`;
const headers = {
'Authorization': `Bearer ${cfg.dangerCordAPIKey}`
};
try {
const response = await fetch(url, { headers });
const userData = await response.json();
return userData;
} catch (error) {
console.error('Error fetching user data:', error);
return;
}
}
module.exports = { dangercordcheckVerification, dangercordcheckInfo };