File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import type { ToTranslate, TranslatedText } from '@/i18n/types';
1010import type { PSCommand } from '@/types/chat' ;
1111import type { PSPointsType , PSRoomConfig } from '@/types/ps' ;
1212import type { CSSProperties , ReactElement } from 'react' ;
13+ import { uploadToPastie } from 'ps-client/tools' ;
14+ import { log } from '@/utils/logger' ;
1315
1416const 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 ) ;
You can’t perform that action at this time.
0 commit comments