diff --git a/client/authorization.go b/client/authorization.go index ab08d51..6dbd8b9 100644 --- a/client/authorization.go +++ b/client/authorization.go @@ -46,7 +46,7 @@ func Authorize(client *Client, authorizationStateHandler AuthorizationStateHandl } type clientAuthorizer struct { - TdlibParameters chan *TdlibParameters + TdlibParameters chan *SetTdlibParametersRequest PhoneNumber chan string Code chan string State chan AuthorizationState @@ -55,7 +55,7 @@ type clientAuthorizer struct { func ClientAuthorizer() *clientAuthorizer { return &clientAuthorizer{ - TdlibParameters: make(chan *TdlibParameters, 1), + TdlibParameters: make(chan *SetTdlibParametersRequest, 1), PhoneNumber: make(chan string, 1), Code: make(chan string, 1), State: make(chan AuthorizationState, 10), @@ -68,13 +68,7 @@ func (stateHandler *clientAuthorizer) Handle(client *Client, state Authorization switch state.AuthorizationStateType() { case TypeAuthorizationStateWaitTdlibParameters: - _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ - Parameters: <-stateHandler.TdlibParameters, - }) - return err - - case TypeAuthorizationStateWaitEncryptionKey: - _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) + _, err := client.SetTdlibParameters(<-stateHandler.TdlibParameters) return err case TypeAuthorizationStateWaitPhoneNumber: @@ -169,14 +163,14 @@ func CliInteractor(clientAuthorizer *clientAuthorizer) { } type botAuthorizer struct { - TdlibParameters chan *TdlibParameters + TdlibParameters chan *SetTdlibParametersRequest Token chan string State chan AuthorizationState } func BotAuthorizer(token string) *botAuthorizer { botAuthorizer := &botAuthorizer{ - TdlibParameters: make(chan *TdlibParameters, 1), + TdlibParameters: make(chan *SetTdlibParametersRequest, 1), Token: make(chan string, 1), State: make(chan AuthorizationState, 10), } @@ -191,13 +185,7 @@ func (stateHandler *botAuthorizer) Handle(client *Client, state AuthorizationSta switch state.AuthorizationStateType() { case TypeAuthorizationStateWaitTdlibParameters: - _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ - Parameters: <-stateHandler.TdlibParameters, - }) - return err - - case TypeAuthorizationStateWaitEncryptionKey: - _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) + _, err := client.SetTdlibParameters(<-stateHandler.TdlibParameters) return err case TypeAuthorizationStateWaitPhoneNumber: diff --git a/example/bot/Bot.go b/example/bot/Bot.go index 0e19a72..0c4d570 100644 --- a/example/bot/Bot.go +++ b/example/bot/Bot.go @@ -9,8 +9,8 @@ import ( tdlib "github.com/c0re100/gotdlib/client" ) -func GetTdParameters() *tdlib.TdlibParameters { - return &tdlib.TdlibParameters{ +func GetTdParameters() *tdlib.SetTdlibParametersRequest { + return &tdlib.SetTdlibParametersRequest{ UseTestDc: false, DatabaseDirectory: "./tdlib-db", FilesDirectory: "./tdlib-files", diff --git a/example/command/ReplyCommand.go b/example/command/ReplyCommand.go index 595d2fa..22b4a6e 100644 --- a/example/command/ReplyCommand.go +++ b/example/command/ReplyCommand.go @@ -17,8 +17,8 @@ func GetSenderId(sender tdlib.MessageSender) int64 { } } -func GetTdParameters() *tdlib.TdlibParameters { - return &tdlib.TdlibParameters{ +func GetTdParameters() *tdlib.SetTdlibParametersRequest { + return &tdlib.SetTdlibParametersRequest{ UseTestDc: false, DatabaseDirectory: "./tdlib-db", FilesDirectory: "./tdlib-files", diff --git a/example/event/CustomEventFilter.go b/example/event/CustomEventFilter.go index 9acabf0..989a485 100644 --- a/example/event/CustomEventFilter.go +++ b/example/event/CustomEventFilter.go @@ -17,8 +17,8 @@ func GetSenderId(sender tdlib.MessageSender) int64 { } } -func GetTdParameters() *tdlib.TdlibParameters { - return &tdlib.TdlibParameters{ +func GetTdParameters() *tdlib.SetTdlibParametersRequest { + return &tdlib.SetTdlibParametersRequest{ UseTestDc: false, DatabaseDirectory: "./tdlib-db", FilesDirectory: "./tdlib-files", diff --git a/example/media/Photo_or_Album.go b/example/media/Photo_or_Album.go index 1bb296e..9873a06 100644 --- a/example/media/Photo_or_Album.go +++ b/example/media/Photo_or_Album.go @@ -17,8 +17,8 @@ func GetSenderId(sender tdlib.MessageSender) int64 { } } -func GetTdParameters() *tdlib.TdlibParameters { - return &tdlib.TdlibParameters{ +func GetTdParameters() *tdlib.SetTdlibParametersRequest { + return &tdlib.SetTdlibParametersRequest{ UseTestDc: false, DatabaseDirectory: "./tdlib-db", FilesDirectory: "./tdlib-files", diff --git a/example/pending/PendingUpdate.go b/example/pending/PendingUpdate.go index 86d9ef8..e0ec7a1 100644 --- a/example/pending/PendingUpdate.go +++ b/example/pending/PendingUpdate.go @@ -9,8 +9,8 @@ import ( tdlib "github.com/c0re100/gotdlib/client" ) -func GetTdParameters() *tdlib.TdlibParameters { - return &tdlib.TdlibParameters{ +func GetTdParameters() *tdlib.SetTdlibParametersRequest { + return &tdlib.SetTdlibParametersRequest{ UseTestDc: false, DatabaseDirectory: "./tdlib-db", FilesDirectory: "./tdlib-files", diff --git a/example/raw_update/raw.go b/example/raw_update/raw.go index 407016f..8fcf134 100644 --- a/example/raw_update/raw.go +++ b/example/raw_update/raw.go @@ -17,8 +17,8 @@ func GetSenderId(sender tdlib.MessageSender) int64 { } } -func GetTdParameters() *tdlib.TdlibParameters { - return &tdlib.TdlibParameters{ +func GetTdParameters() *tdlib.SetTdlibParametersRequest { + return &tdlib.SetTdlibParametersRequest{ UseTestDc: false, DatabaseDirectory: "./tdlib-db", FilesDirectory: "./tdlib-files",