ligh7hau5/commands/clap.js

19 lines
624 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}/favourite`,
headers: { Authorization: `Bearer ${registrar.config.fediverse.token}` },
2019-07-04 00:27:39 +03:00
}).then((response) => {
matrixClient.sendHtmlNotice(room.roomId,
'',
`You have clapped: <a href="${response.data.url}">${response.data.account.acct}</a>:
<blockquote>${response.data.content}`);
})
.catch((e) => {
matrixClient.sendHtmlNotice(room.roomId,
'', `${e}`);
});
};