diff --git a/main.go b/main.go index a2fdc87..40eb55b 100644 --- a/main.go +++ b/main.go @@ -90,25 +90,19 @@ func main() { var number string fmt.Scanln(&number) _, err := client.SendPhoneNumber(number) - if err != nil { - fmt.Printf("Error sending phone number: %v", err) - } + logOnError(err, "Error sending phone number.") } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitCodeType { fmt.Print("Enter code: ") var code string fmt.Scanln(&code) _, err := client.SendAuthCode(code) - if err != nil { - fmt.Printf("Error sending auth code : %v", err) - } + logOnError(err, "Error sending auth code.") } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitPasswordType { fmt.Print("Enter Password: ") var password string fmt.Scanln(&password) _, err := client.SendAuthPassword(password) - if err != nil { - fmt.Printf("Error sending auth password: %v", err) - } + logOnError(err, "Error sending auth password.") } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateReadyType { fmt.Println("Authorization Ready! Let's rock") break