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
+23 -6
View File
@@ -21,11 +21,11 @@ async function dangercordcheckVerification(userId, accessToken) {
return 1; // Allowed to continue return 1; // Allowed to continue
} else { } else {
// Determine if report level is acceptable // Determine if report level is acceptable
if (userData.reports >= 1 && userData.last_reported >= Date.now() - (30 * 24 * 60 * 60 * 1000)) { if (userData.reports >= 1 && userData.last_reported >= Date.now() - (30 * 24 * 60 * 60 * 1000)) {
return 0; // Not allowed to continue return 0; // Not allowed to continue
} else { } else {
return 1; // Allowed to continue return 1; // Allowed to continue
} }
} }
} catch (error) { } catch (error) {
console.error('Error fetching user data:', 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 };