0
0
Fork 0

フォルダ分け

This commit is contained in:
Xeltica 2020-09-08 20:05:22 +09:00
parent 046351a8fa
commit d20ac2c507
10 changed files with 21 additions and 21 deletions

View file

@ -1,33 +0,0 @@
import { api } from './misskey';
import { config } from './config';
import { User } from './models/entities/user';
import { updateUser } from './users';
export const format = async (user: User): Promise<string> => {
const miUser = await api<Record<string, any>>(user.host, 'users/show', { username: user.username }, user.token);
if (miUser.error) {
throw miUser.error;
}
const notesDelta = toSignedString(miUser.notesCount - user.prevNotesCount);
const followingDelta = toSignedString(miUser.followingCount - user.prevFollowingCount);
const followersDelta = toSignedString(miUser.followersCount - user.prevFollowersCount);
await updateUser(user.username, user.host, {
prevNotesCount: miUser.notesCount,
prevFollowingCount: miUser.followingCount,
prevFollowersCount: miUser.followersCount,
});
return `昨日のMisskeyの活動は
ノート: ${miUser.notesCount}(${notesDelta})
フォロー : ${miUser.followingCount}(${followingDelta})
フォロワー :${miUser.followersCount}(${followersDelta})
${config.url}
#misshaialert`;
};
export const toSignedString = (num: number): string => num < 0 ? num.toString() : '+' + num;