feat(matrix/fediverse): allow users to directly reply on Fediverse posts from Matrix, using <mx-reply> on our new meta field.

feat(matrix/fediverse): allow users to favorite, reblog, and redact Fediverse posts from Matrix, using m.reaction on our new meta field.
feat(fediverse): add suggestions for follow/unfollow commands.
refactor(matrix/fediverse): add meta field for commands by reaction, and commands by reply.
refactor(fediverse): relax polling on timeline/notifs thru new handling.
This commit is contained in:
vulet 2021-02-14 15:57:35 +08:00
parent 430fb350c1
commit 42563ebc35
26 changed files with 619 additions and 375 deletions

View file

@ -1,24 +1,20 @@
exports.runQuery = function (matrixClient, room, userInput) {
exports.runQuery = function (roomId, event, userInput) {
axios({
method: 'POST',
url: `${config.fediverse.domain}/api/v1/statuses`,
headers: { Authorization: `Bearer ${fediverse_auth.access_token}` },
headers: { Authorization: `Bearer ${fediverse.auth.access_token}` },
data: {
status: `@mordekai ${userInput}`,
content_type: `text/markdown`,
content_type: 'text/markdown',
visibility: 'unlisted',
expires_in: '7200'
expires_in: '7200',
},
}).then((response) => {
matrixClient.sendHtmlNotice(room.roomId,
'',
`<b>
<blockquote><i>${response.data.content}<br>
(id: ${response.data.id}</a>)
</blockquote><br>`);
})
.then(() => {
matrix.utils.addReact(event, '✅');
})
.catch((e) => {
matrixClient.sendHtmlNotice(room.roomId,
'', `${e}`);
matrix.utils.addReact(event, '❌');
matrix.utils.sendError(event, roomId, e);
});
};