aboutsummaryrefslogtreecommitdiff
path: root/telegram/connect.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/connect.go')
-rw-r--r--telegram/connect.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/telegram/connect.go b/telegram/connect.go
index 8324319..ef03428 100644
--- a/telegram/connect.go
+++ b/telegram/connect.go
@@ -13,7 +13,7 @@ import (
const chatsLimit int32 = 999
type clientAuthorizer struct {
- TdlibParameters chan *client.TdlibParameters
+ TdlibParameters chan *client.SetTdlibParametersRequest
PhoneNumber chan string
Code chan string
State chan client.AuthorizationState
@@ -31,13 +31,7 @@ func (stateHandler *clientAuthorizer) Handle(c *client.Client, state client.Auth
switch state.AuthorizationStateType() {
case client.TypeAuthorizationStateWaitTdlibParameters:
- _, err := c.SetTdlibParameters(&client.SetTdlibParametersRequest{
- Parameters: <-stateHandler.TdlibParameters,
- })
- return err
-
- case client.TypeAuthorizationStateWaitEncryptionKey:
- _, err := c.CheckDatabaseEncryptionKey(&client.CheckDatabaseEncryptionKeyRequest{})
+ _, err := c.SetTdlibParameters(<-stateHandler.TdlibParameters)
return err
case client.TypeAuthorizationStateWaitPhoneNumber:
@@ -116,7 +110,7 @@ func (c *Client) Connect(resource string) error {
log.Warn("Connecting to Telegram network...")
c.authorizer = &clientAuthorizer{
- TdlibParameters: make(chan *client.TdlibParameters, 1),
+ TdlibParameters: make(chan *client.SetTdlibParametersRequest, 1),
PhoneNumber: make(chan string, 1),
Code: make(chan string, 1),
State: make(chan client.AuthorizationState, 10),