ligh7hau5/commands/unfren.js

21 lines
702 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.get(`${registrar.config.fediverse}/api/v1/accounts/${userInput}`).then((findUID) => {
axios({
method: 'POST',
url: `${registrar.config.fediverse}/api/v1/accounts/${findUID.data.id}/unfollow`,
headers: { Authorization: `Bearer ${registrar.config.fediverseToken}` },
})
.then((response) => {
matrixClient.sendHtmlNotice(room.roomId,
'',
`Unsubscribed:
<blockquote>${registrar.config.fediverse}/${response.data.id}`);
});
}).catch((e) => {
matrixClient.sendHtmlNotice(room.roomId,
'', `${e}`);
});
};