20 lines
729 B
JavaScript
20 lines
729 B
JavaScript
const axios = require('axios');
|
|
|
|
exports.runQuery = function (matrixClient, room, userInput, registrar) {
|
|
axios.get(`${registrar.config.fediverse.domain}/api/v1/accounts/${userInput}`).then((findUID) => {
|
|
axios({
|
|
method: 'POST',
|
|
url: `${registrar.config.fediverse.domain}/api/v1/accounts/${findUID.data.id}/unfollow`,
|
|
headers: { Authorization: `Bearer ${registrar.fediverse_auth.access_token}` },
|
|
})
|
|
.then((response) => {
|
|
matrixClient.sendHtmlNotice(room.roomId,
|
|
'',
|
|
`Unsubscribed:
|
|
<blockquote>${registrar.config.fediverse.domain}/${response.data.id}`);
|
|
});
|
|
}).catch((e) => {
|
|
matrixClient.sendHtmlNotice(room.roomId,
|
|
'', `${e}`);
|
|
});
|
|
};
|