File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ try {
190190 title = await page . locator ( 'h1' ) . first ( ) . innerText ( ) ;
191191 }
192192 const game_id = page . url ( ) . split ( '/' ) . pop ( ) ;
193+ const existedInDb = db . data [ user ] [ game_id ] ;
193194 db . data [ user ] [ game_id ] ||= { title, time : datetime ( ) , url : page . url ( ) } ; // this will be set on the initial run only!
194195 console . log ( 'Current free game:' , title ) ;
195196 if ( bundle_includes ) console . log ( ' This bundle includes:' , bundle_includes ) ;
@@ -198,7 +199,7 @@ try {
198199
199200 if ( btnText == 'in library' ) {
200201 console . log ( ' Already in library! Nothing to claim.' ) ;
201- await notify ( `Game already in library: ${ url } ` ) ;
202+ if ( ! existedInDb ) await notify ( `Game already in library: ${ url } ` ) ;
202203 notify_game . status = 'existed' ;
203204 db . data [ user ] [ game_id ] . status ||= 'existed' ; // does not overwrite claimed or failed
204205 if ( db . data [ user ] [ game_id ] . status . startsWith ( 'failed' ) ) db . data [ user ] [ game_id ] . status = 'manual' ; // was failed but now it's claimed
You can’t perform that action at this time.
0 commit comments