add discord api test call
This commit is contained in:
22
netlify/functions/bot-status.js
Normal file
22
netlify/functions/bot-status.js
Normal 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'),
|
||||
};
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user