Skip to content

Commit e2b0a9a

Browse files
committed
chore: Log points on reset
1 parent c6802f4 commit e2b0a9a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/ps/commands/points.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import type { ToTranslate, TranslatedText } from '@/i18n/types';
1010
import type { PSCommand } from '@/types/chat';
1111
import type { PSPointsType, PSRoomConfig } from '@/types/ps';
1212
import type { CSSProperties, ReactElement } from 'react';
13+
import { uploadToPastie } from 'ps-client/tools';
14+
import { log } from '@/utils/logger';
1315

1416
const NUM_PATTERN = /^-?\d+$/;
1517

@@ -244,6 +246,13 @@ export const command: PSCommand[] = [
244246
throw new ChatError($T('NOT_CONFIRMED'));
245247
});
246248

249+
const currentData = await queryPoints(message.target.id, roomPoints.priority, Infinity);
250+
if (currentData?.length) {
251+
const backupURL = await uploadToPastie(JSON.stringify(currentData, null, 2));
252+
log(`Backup for ${message.target.id}, reset ${pointsToReset} by ${message.author.id}: ${backupURL}`);
253+
message.target.send(`/modnote ${backupURL}`);
254+
}
255+
247256
await resetPoints(message.target.id, typeof pointsToReset === 'boolean' ? pointsToReset : pointsToReset.id);
248257
if (pointsToReset === true) return message.reply('Leaderboard has been reset!' as ToTranslate);
249258
message.reply(`Reset all users' ${pointsToReset.plural} to 0.` as ToTranslate);

0 commit comments

Comments
 (0)