ligh7hau5/commands/fediverse/boo.js

19 lines
628 B
JavaScript
Raw Normal View History

2019-07-04 00:27:39 +03:00
const axios = require('axios');
exports.runQuery = function (matrixClient, room, userInput, registrar) {
axios({
method: 'POST',
2020-06-28 10:07:58 +03:00
url: `${registrar.config.fediverse.domain}/api/v1/statuses/${userInput}/unfavourite`,
headers: { Authorization: `Bearer ${registrar.fediverse_auth.access_token}` },
2019-07-04 00:27:39 +03:00
}).then((response) => {
matrixClient.sendHtmlNotice(room.roomId,
'',
`You have boo'd: <a href="${response.data.url}">${response.data.account.acct}</a>
<blockquote>${response.data.content}`);
})
.catch((e) => {
matrixClient.sendHtmlNotice(room.roomId,
'', `${e}`);
});
};