diff --git a/.gitignore b/.gitignore index c569490..e053709 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ node_modules dist .env .env.* + +# Local Netlify folder +.netlify \ No newline at end of file diff --git a/netlify/functions/bot-status.js b/netlify/functions/bot-status.js index 12961a9..005030c 100644 --- a/netlify/functions/bot-status.js +++ b/netlify/functions/bot-status.js @@ -1,22 +1,13 @@ const axios = require('axios'); exports.handler = async function(event, context) { - axios - .get(`https://discord.com/api/v9/users/@me`, { - headers: { - Authorization: `Bot ${process.env.token}`, - }, - }) - .then((response) => { - return { - statusCode: 200, - body: JSON.stringify(response.data), - }; - }) - .catch((error) => { - return { - statusCode: 500, - body: JSON.stringify({ errorMsg: 'discord api shat itself brb' }), - }; - }); + let response = await axios.get(`https://discord.com/api/v9/users/@me`, { + headers: { + Authorization: `Bot ${process.env.token}`, + }, + }); + return { + statusCode: 200, + body: JSON.stringify(response.data), + }; };