aboutsummaryrefslogtreecommitdiff
path: root/telegram/connect.go
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-01 04:25:24 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2023-08-01 04:25:24 +0300
commitef831fc9725601a94149ce94c3fb686afc77e0a5 (patch)
tree4046e57e03097d9af33cde558056cd5393fa77f4 /telegram/connect.go
parent748366ad6a9dc4b2a269d5499ae1d5d7e8526762 (diff)
Migrate to TDLib 1.8.14 (multiple usernames support)
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),