This repository was archived by the owner on Sep 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Expand file tree Collapse file tree 2 files changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -8,19 +8,22 @@ pub fn aboutme() {
88 Ok ( user) => {
99 println ! ( "ID: {}" , user. user_id. bright_black( ) ) ;
1010 println ! ( "Plan: {}" , color_plan( user. plan) ) ;
11- let end_date = user. plan_data_end ;
12- println ! (
13- "Your plan ends at: {}/{}/{} {}:{}" ,
14- end_date. day( ) ,
15- end_date. month( ) ,
16- end_date. year( ) ,
17- end_date. hour( ) ,
18- end_date. minute( )
19- ) ;
20- println ! (
21- " Which means you have {} days left!" ,
22- user. last_data_left. days. to_string( ) . green( ) . bold( )
23- ) ;
11+ if let Some ( end_date) = user. plan_data_end {
12+ println ! (
13+ "Your plan ends at: {}/{}/{} {}:{}" ,
14+ end_date. day( ) ,
15+ end_date. month( ) ,
16+ end_date. year( ) ,
17+ end_date. hour( ) ,
18+ end_date. minute( )
19+ ) ;
20+ }
21+ if let Some ( time_left) = user. last_data_left {
22+ println ! (
23+ " Which means you have {} days left!" ,
24+ time_left. days. to_string( ) . green( ) . bold( )
25+ ) ;
26+ }
2427 println ! ( "Memory:" ) ;
2528 println ! (
2629 " Total: {}{}" ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ use serde::Deserialize;
33use super :: FetchError ;
44
55#[ derive( Deserialize , Debug ) ]
6- pub struct UserDate {
6+ pub struct TimeLeft {
77 pub days : u32 ,
88 pub hours : u32 ,
99 pub minutes : u32 ,
@@ -25,9 +25,9 @@ pub struct User {
2525 pub plan : String ,
2626 pub locale : String ,
2727 #[ serde( rename = "planDataEnd" ) ]
28- pub plan_data_end : chrono:: DateTime < chrono:: Utc > ,
28+ pub plan_data_end : Option < chrono:: DateTime < chrono:: Utc > > ,
2929 #[ serde( rename = "lastDataLeft" ) ]
30- pub last_data_left : UserDate ,
30+ pub last_data_left : Option < TimeLeft > ,
3131}
3232#[ tracing:: instrument]
3333pub fn fetch_user ( token : String ) -> Result < User , FetchError > {
You can’t perform that action at this time.
0 commit comments