diff --git a/functions/dangerCordUtils.js b/functions/dangerCordUtils.js index 11187da..c59d4de 100644 --- a/functions/dangerCordUtils.js +++ b/functions/dangerCordUtils.js @@ -21,11 +21,11 @@ async function dangercordcheckVerification(userId, accessToken) { return 1; // Allowed to continue } else { // Determine if report level is acceptable - if (userData.reports >= 1 && userData.last_reported >= Date.now() - (30 * 24 * 60 * 60 * 1000)) { - return 0; // Not allowed to continue - } else { - return 1; // Allowed to continue -} + if (userData.reports >= 1 && userData.last_reported >= Date.now() - (30 * 24 * 60 * 60 * 1000)) { + 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 };