feat(10grans): add make-it-rain
This commit is contained in:
parent
fcadc5addc
commit
58ef31356a
7 changed files with 60 additions and 3 deletions
|
@ -141,3 +141,25 @@ module.exports.unfollow = (roomId, account, event, original) => {
|
|||
matrix.utils.sendError(event, roomId, e);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.getStatusMentions = (notice, event, original) => {
|
||||
const posters = [];
|
||||
const prefix = '@';
|
||||
const users = axios({
|
||||
method: 'GET',
|
||||
url: `${config.fediverse.domain}/api/v1/statuses/${notice}`,
|
||||
headers: { Authorization: `Bearer ${fediverse.auth.access_token}` },
|
||||
}).then((notice) => {
|
||||
const citizens = [];
|
||||
citizens.push(notice.data.account.acct);
|
||||
for (let i = 0; i < notice.data.mentions.length; i++) citizens.push(notice.data.mentions[i].acct);
|
||||
const filtered = citizens.filter(users => !config.fediverse.username.includes(users))
|
||||
for (let i = 0; i < filtered.length; i++) posters.push(prefix.concat(filtered[i]));
|
||||
return posters;
|
||||
})
|
||||
.catch((e) => {
|
||||
matrix.utils.addReact(event, '❌');
|
||||
matrix.utils.sendError(event, roomId, e);
|
||||
});
|
||||
return users;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue