Skip to content

Commit 9341dbb

Browse files
authored
Merge pull request #1662 from borzovplus/auth-resend-code-method
Added ResendCode method in auth module
2 parents 131dfb7 + f4af79b commit 9341dbb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

telegram/auth/user.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,19 @@ func (c *Client) SendCode(ctx context.Context, phone string, options SendCodeOpt
8888
return sentCode, nil
8989
}
9090

91+
func (c *Client) ResendCode(ctx context.Context, phone string, hash string) (tg.AuthSentCodeClass, error) {
92+
sentCode, err := c.api.AuthResendCode(ctx, &tg.AuthResendCodeRequest{
93+
PhoneNumber: phone,
94+
PhoneCodeHash: hash,
95+
})
96+
97+
if err != nil {
98+
return nil, errors.Wrap(err, "resend code")
99+
}
100+
101+
return sentCode, nil
102+
}
103+
91104
// ErrPasswordAuthNeeded means that 2FA auth is required.
92105
//
93106
// Call Client.Password to provide 2FA password.

0 commit comments

Comments
 (0)