fix(timeline): some missing files
This commit is contained in:
parent
8e2ce18f26
commit
12c422c324
2 changed files with 35 additions and 0 deletions
9
commands/expand.js
Normal file
9
commands/expand.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
exports.runQuery = async (roomId, event, userInput) => {
|
||||||
|
return matrix.utils.fetchEncryptedOrNot(roomId, { event_id: userInput })
|
||||||
|
.then(event => matrix.utils.expandReact(event))
|
||||||
|
.catch(e => {
|
||||||
|
matrixClient.sendHtmlNotice(roomId, 'Sad!', '<strong>Sad!</strong>')
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
};
|
||||||
|
|
26
commands/fediverse/react.js
vendored
Normal file
26
commands/fediverse/react.js
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
const run = async (roomId, event, id, emoji, remove) => {
|
||||||
|
axios({
|
||||||
|
method: remove ? 'DELETE' : 'PUT',
|
||||||
|
url: `${config.fediverse.domain}/api/v1/pleroma/statuses/${id}/reactions/${emoji}`,
|
||||||
|
headers: { Authorization: `Bearer ${fediverse.auth.access_token}` },
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
matrix.utils.addReact(event, '✅');
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
matrix.utils.addReact(event, '❌');
|
||||||
|
matrix.utils.sendError(event, roomId, e);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.runQuery = async (roomId, event, userInput, remove) => {
|
||||||
|
try {
|
||||||
|
const chunks = userInput.trim().split(' ');
|
||||||
|
if (chunks.length !== 2) throw '';
|
||||||
|
const id = encodeURIComponent(chunks[0]);
|
||||||
|
const emoji = encodeURIComponent(chunks[1]);
|
||||||
|
return run(roomId, event, id, emoji, remove);
|
||||||
|
} catch (e) {
|
||||||
|
return matrixClient.sendHtmlNotice(roomId, 'Sad!', '<strong>Sad!</strong>').catch(() => {});
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue