Skip to content

Commit

Permalink
chore: remove context args in telegram auth method.
Browse files Browse the repository at this point in the history
  • Loading branch information
syhily committed Nov 22, 2022
1 parent fe66474 commit ae430f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/telegram/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/telegram/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit ae430f6

Please sign in to comment.