0
0
Fork 0
This commit is contained in:
Xeltica 2021-01-07 01:29:52 +09:00
parent f08d1324d0
commit 6a18812e9d
16 changed files with 175 additions and 34 deletions

View file

@ -0,0 +1,17 @@
import { Users } from '../models';
import { updateRating } from '../functions/update-rating';
import { api } from '../services/misskey';
import { MiUser } from '../functions/update-score';
export default async () => {
const users = await Users.find();
for (const u of users) {
console.log(`Update rating of ${u.username}@${u.host}...`);
const miUser = await api<MiUser & { error: unknown }>(u.host, 'users/show', { username: u.username }, u.token);
if (miUser.error) {
console.log(`Failed to fetch data of ${u.username}@${u.host}. Skipped`);
continue;
}
await updateRating(u, miUser);
}
};