ligh7hau5/commands/fediverse/status.js
2024-09-29 20:53:07 +03:00

15 lines
515 B
JavaScript

exports.runQuery = function (roomId, event, userInput) {
axios({
method: 'GET',
url: `https://${fediverse.auth[event.getSender()].domain}/api/v1/statuses/${userInput}`,
headers: { Authorization: `Bearer ${fediverse.auth[event.getSender()].access_token}` },
})
.then((response) => {
response.label = 'status';
fediverse.utils.formatter(response, roomId);
})
.catch((e) => {
matrix.utils.addReact(event, '❌');
matrix.utils.sendError(event, roomId, e);
});
};