0
0
Fork 0

style: use space indentation

feat: no new users allowed
fix: change base language to Korean
fix: change gacha to random text from devs
This commit is contained in:
아르페 2024-02-02 01:35:17 +09:00
parent 320dfc0696
commit b6a3b0cd53
35 changed files with 335 additions and 367 deletions

View file

@ -38,23 +38,23 @@ export const work = async () => {
await calculateAllRating(groupedUsers);
}
catch (e) {
printLog('Misskey Tools with LycheeBridge 레이팅 계산에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
Store.dispatch({ nowCalculating: false });
printLog('Misskey Tools with LycheeBridge 레이팅 계산에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
Store.dispatch({ nowCalculating: false });
}
finally {
Store.dispatch({ nowCalculating: false });
printLog(`${users.length}개의 계정 레이팅 계산이 완료되었습니다.`);
Store.dispatch({ nowCalculating: false });
printLog(`${users.length}개의 계정 레이팅 계산이 완료되었습니다.`);
}
try {
printLog(`${users.length}개의 계정에 알림을 전송하고 있습니다.`);
printLog(`${users.length}개의 계정에 알림을 전송하고 있습니다.`);
await sendAllAlerts(groupedUsers);
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
printLog('Misskey Tools with LycheeBridge 알림 전송이 완료되었습니다.');
printLog('Misskey Tools with LycheeBridge 알림 전송이 완료되었습니다.');
}
};
@ -75,10 +75,10 @@ const calculateRating = async (host: string, users: User[]) => {
// ユーザーが削除されている場合、レコードからも消してとりやめ
printLog(`${toAcct(user)} 게정이 삭제, 정지, 또는 토큰이 제거된 것으로 보이며, 시스템에서 계정이 제거되었습니다.`, 'warn');
await deleteUser(user.username, user.host);
continue;
continue;
} else {
printLog(`Misskey 오류: ${JSON.stringify(e.error)}`, 'error');
continue;
continue;
}
} else if (e instanceof TimedOutError) {
printLog(`${user.host} 인스턴스로의 연결에 실패하여 레이팅 계산을 중단합니다.`, 'error');
@ -105,7 +105,7 @@ const sendAlerts = async (host: string, users: User[]) => {
.map(user => {
const count = userScoreCache.get(toAcct(user));
if (count == null) return null;
if (count.notesCount - (user.prevNotesCount ?? 0) <= 1) return null;
if (count.notesCount - (user.prevNotesCount ?? 0) <= 1) return null;
return {
user,
count,
@ -121,31 +121,31 @@ const sendAlerts = async (host: string, users: User[]) => {
// 通知
for (const {user, count, message} of models.filter(m => m.user.alertMode === 'notification' || m.user.alertMode === 'both')) {
try {
try {
await sendNotificationAlert(message, user);
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
if (user.alertMode === 'notification') {
await updateScore(user, count);
}
}
} finally {
if (user.alertMode === 'notification') {
await updateScore(user, count);
}
}
}
// アラート
for (const {user, count, message} of models.filter(m => m.user.alertMode === 'note' || m.user.alertMode === 'both')) {
try {
try {
await sendNoteAlert(message, user);
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
await Promise.all([
updateScore(user, count),
delay(1000),
]);
}
} catch (e) {
printLog('Misskey Tools with LycheeBridge 알림 전송에 실패했습니다.', 'error');
printLog(e instanceof Error ? errorToString(e) : JSON.stringify(e, null, ' '), 'error');
} finally {
await Promise.all([
updateScore(user, count),
delay(1000),
]);
}
}
printLog(`${host} 인스턴스의 사용자 ${users.length}명의 알림 전송이 완료되었습니다.`);