File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -20,21 +20,25 @@ export const My_LOGS = async (ctx) => {
20
20
try {
21
21
const { data } = await API . get ( `users/logs/${ id } ` ) ;
22
22
23
- const logins = [ "Here are your logins.\n" ] ;
23
+ if ( data . length === 0 ) {
24
+ await ctx . reply ( "You have no logins." ) ;
25
+ } else {
26
+ const logins = [ "Here are your logins.\n" ] ;
24
27
25
- await Promise . all (
26
- data . map ( async ( login ) => {
27
- const td = new Date ( login . createdAt ) ;
28
+ await Promise . all (
29
+ data . map ( async ( login ) => {
30
+ const td = new Date ( login . createdAt ) ;
28
31
29
- const translatedDate = `${ td . getFullYear ( ) } /${ td . getMonth ( ) } /${ td . getDay ( ) } ${ td . getHours ( ) } :${ td . getMinutes ( ) } ` ;
32
+ const translatedDate = `${ td . getFullYear ( ) } /${ td . getMonth ( ) } /${ td . getDay ( ) } ${ td . getHours ( ) } :${ td . getMinutes ( ) } ` ;
30
33
31
- const log = `Login to ${ login . service . name } . Provided by ${ login . company . companyName } at ${ translatedDate } .` ;
34
+ const log = `Login to ${ login . service . name } . Provided by ${ login . company . companyName } at ${ translatedDate } .` ;
32
35
33
- logins . push ( log ) ;
34
- } )
35
- ) ;
36
+ logins . push ( log ) ;
37
+ } )
38
+ ) ;
36
39
37
- await ctx . reply ( logins . join ( "\n" ) ) ;
40
+ await ctx . reply ( logins . join ( "\n" ) ) ;
41
+ }
38
42
} catch ( error ) {
39
43
await ctx . reply ( error . response . data . message ) ;
40
44
}
You can’t perform that action at this time.
0 commit comments