From ae430f6e3c870e25877238746b53c7a382830f33 Mon Sep 17 00:00:00 2001 From: Yufan Sheng Date: Tue, 22 Nov 2022 14:27:01 +0800 Subject: [PATCH] chore: remove context args in telegram auth method. --- internal/telegram/auth.go | 6 +++--- internal/telegram/common.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/telegram/auth.go b/internal/telegram/auth.go index 4a1f966..52ab33b 100644 --- a/internal/telegram/auth.go +++ b/internal/telegram/auth.go @@ -15,14 +15,14 @@ import ( // Authentication is used for log into the telegram with a session support. // Every telegram execution will require this method. -func (t *Telegram) Authentication(ctx context.Context) error { +func (t *Telegram) Authentication() error { // Setting up authentication flow helper based on terminal auth. flow := auth.NewFlow(&terminalAuth{mobile: t.mobile}, auth.SendCodeOptions{}) - if err := t.client.Auth().IfNecessary(ctx, flow); err != nil { + if err := t.client.Auth().IfNecessary(t.ctx, flow); err != nil { return err } - status, _ := t.client.Auth().Status(ctx) + status, _ := t.client.Auth().Status(t.ctx) if !status.Authorized { return errors.New("failed to login, please check you login info or refresh the session by --refresh") } diff --git a/internal/telegram/common.go b/internal/telegram/common.go index 819f6c0..76f3f66 100644 --- a/internal/telegram/common.go +++ b/internal/telegram/common.go @@ -75,7 +75,7 @@ func New(channelID, mobile string, appID int64, appHash string, sessionPath, pro client: client, } - if err := t.Authentication(t.ctx); err != nil { + if err := t.Authentication(); err != nil { return nil, err }