2020-07-03 20:05:39 +03:00
|
|
|
const axios = require('axios');
|
|
|
|
|
|
|
|
exports.runQuery = function (matrixClient, room, userInput, registrar) {
|
|
|
|
axios({
|
|
|
|
method: 'GET',
|
|
|
|
url: `${registrar.config.fediverse.domain}/api/v1/statuses/${userInput}`,
|
2021-01-17 12:58:02 +03:00
|
|
|
headers: { Authorization: `Bearer ${registrar.fediverse_auth.access_token}` },
|
2020-07-03 20:05:39 +03:00
|
|
|
}).then((response) => {
|
|
|
|
matrixClient.sendHtmlNotice(room.roomId,
|
|
|
|
'',
|
|
|
|
`<b><a href="${registrar.config.fediverse.domain}/notice/${response.data.id}">${response.data.account.acct}</a>
|
|
|
|
<blockquote><i>${response.data.content}<br>
|
|
|
|
${response.data.media_attachments.map(media =>
|
|
|
|
`<a href="${media.remote_url}"><b>${media.description}</b></a>`)
|
|
|
|
.join('<br>')}
|
|
|
|
(id: ${response.data.id}</a>)
|
|
|
|
</blockquote>`);
|
|
|
|
});
|
|
|
|
};
|