2019-07-04 00:27:39 +03:00
|
|
|
const axios = require('axios');
|
|
|
|
|
|
|
|
exports.runQuery = function (matrixClient, room, userInput, registrar) {
|
2020-06-28 10:07:58 +03:00
|
|
|
axios.get(`${registrar.config.fediverse.domain}/api/v1/accounts/${userInput}`).then((findUID) => {
|
2019-07-04 00:27:39 +03:00
|
|
|
axios({
|
|
|
|
method: 'POST',
|
2020-06-28 10:07:58 +03:00
|
|
|
url: `${registrar.config.fediverse.domain}/api/v1/accounts/${findUID.data.id}/unfollow`,
|
2021-01-17 12:58:02 +03:00
|
|
|
headers: { Authorization: `Bearer ${registrar.fediverse_auth.access_token}` },
|
2019-07-04 00:27:39 +03:00
|
|
|
})
|
|
|
|
.then((response) => {
|
|
|
|
matrixClient.sendHtmlNotice(room.roomId,
|
|
|
|
'',
|
|
|
|
`Unsubscribed:
|
2020-06-28 10:07:58 +03:00
|
|
|
<blockquote>${registrar.config.fediverse.domain}/${response.data.id}`);
|
2019-07-04 00:27:39 +03:00
|
|
|
});
|
|
|
|
}).catch((e) => {
|
|
|
|
matrixClient.sendHtmlNotice(room.roomId,
|
|
|
|
'', `${e}`);
|
|
|
|
});
|
|
|
|
};
|