2021-02-14 10:57:35 +03:00
|
|
|
exports.runQuery = function (roomId, event, userInput) {
|
2020-05-21 02:02:27 +03:00
|
|
|
axios({
|
|
|
|
method: 'POST',
|
2021-02-01 11:58:59 +03:00
|
|
|
url: `${config.fediverse.domain}/api/v1/statuses`,
|
2021-02-14 10:57:35 +03:00
|
|
|
headers: { Authorization: `Bearer ${fediverse.auth.access_token}` },
|
2021-01-17 12:58:02 +03:00
|
|
|
data: {
|
|
|
|
status: `@mordekai ${userInput}`,
|
2021-02-14 10:57:35 +03:00
|
|
|
content_type: 'text/markdown',
|
2020-05-21 02:02:27 +03:00
|
|
|
visibility: 'unlisted',
|
2021-02-14 10:57:35 +03:00
|
|
|
expires_in: '7200',
|
2020-05-21 02:02:27 +03:00
|
|
|
},
|
|
|
|
})
|
2021-02-14 10:57:35 +03:00
|
|
|
.then(() => {
|
|
|
|
matrix.utils.addReact(event, '✅');
|
|
|
|
})
|
2020-05-21 02:02:27 +03:00
|
|
|
.catch((e) => {
|
2021-02-14 10:57:35 +03:00
|
|
|
matrix.utils.addReact(event, '❌');
|
|
|
|
matrix.utils.sendError(event, roomId, e);
|
2020-05-21 02:02:27 +03:00
|
|
|
});
|
|
|
|
};
|