ligh7hau5/commands/fren.js

21 lines
698 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}/follow`,
headers: { Authorization: `Bearer ${registrar.config.fediverseToken}` },
})
.then((response) => {
matrixClient.sendHtmlNotice(room.roomId,
'',
`Subscribed:
2019-07-08 00:36:51 +03:00
<blockquote>${registrar.config.fediverse}/${response.data.id}`);
2019-07-04 00:27:39 +03:00
});
}).catch((e) => {
matrixClient.sendHtmlNotice(room.roomId,
'', `${e}`);
});
};