registration fix

This commit is contained in:
Aleksandr Zelenin 2018-10-10 16:35:28 +03:00
parent d892a9395a
commit 997dc1006a
2 changed files with 5 additions and 3 deletions

View file

@ -59,7 +59,7 @@ func main() {
// client authorizer
authorizer := client.ClientAuthorizer()
go client.CliInteractor(authorizer, false)
go client.CliInteractor(authorizer)
// or bot authorizer
botToken := "000000000:gsVCGG5YbikxYHC7bP5vRvmBqJ7Xz6vG6td"

View file

@ -98,7 +98,7 @@ func (stateHandler *clientAuthorizer) Handle(client *Client, state Authorization
return ErrNotSupportedAuthorizationState
}
func CliInteractor(clientAuthorizer *clientAuthorizer, registration bool) {
func CliInteractor(clientAuthorizer *clientAuthorizer) {
for {
select {
case state := <-clientAuthorizer.State:
@ -118,7 +118,9 @@ func CliInteractor(clientAuthorizer *clientAuthorizer, registration bool) {
fmt.Println("Enter code: ")
fmt.Scanln(&code)
if registration {
if !state.(*AuthorizationStateWaitCode).IsRegistered {
fmt.Println("Phone number is not registered.")
fmt.Println("Enter first name: ")
fmt.Scanln(&firstName)