From 6860952284e7d92fbaf1a5b1aebd2dc30bbc9472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ma=C5=84czak?= <56172798+jakubmanczak@users.noreply.github.com> Date: Sat, 31 Jul 2021 15:57:22 +0200 Subject: [PATCH] fix test function IV --- .gitignore | 3 +++ netlify/functions/bot-status.js | 27 +++++++++------------------ 2 files changed, 12 insertions(+), 18 deletions(-) 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), + }; };