ligh7hau5/commands/fediverse/mordy.js

21 lines
562 B
JavaScript
Raw Normal View History

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