add discord api test call

This commit is contained in:
2021-07-31 15:11:33 +02:00
parent a0b83f7ed9
commit de3cf665c3
3 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import axios from '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: response.data,
};
})
.catch((error) => {
return {
statusCode: 500,
body: JSON.stringify('discord api shat itself brb'),
};
});
};