|
@@ -96,15 +96,12 @@ type loginResponse struct {
|
|
|
Token string `json:"token"`
|
|
Token string `json:"token"`
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func login(
|
|
|
|
|
- s *discordgo.Session,
|
|
|
|
|
- email, password string,
|
|
|
|
|
-) (*loginResponse, error) {
|
|
|
|
|
|
|
+func login(email, password string) (*loginResponse, error) {
|
|
|
data := struct {
|
|
data := struct {
|
|
|
Email string `json:"email"`
|
|
Email string `json:"email"`
|
|
|
Password string `json:"password"`
|
|
Password string `json:"password"`
|
|
|
}{email, password}
|
|
}{email, password}
|
|
|
- resp, err := s.RequestWithBucketID(
|
|
|
|
|
|
|
+ resp, err := session.RequestWithBucketID(
|
|
|
"POST",
|
|
"POST",
|
|
|
discordgo.EndpointLogin,
|
|
discordgo.EndpointLogin,
|
|
|
data,
|
|
data,
|
|
@@ -123,13 +120,13 @@ func login(
|
|
|
return &lr, nil
|
|
return &lr, nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func totp(s *discordgo.Session, code, ticket string) (*loginResponse, error) {
|
|
|
|
|
|
|
+func totp(code, ticket string) (*loginResponse, error) {
|
|
|
data := struct {
|
|
data := struct {
|
|
|
Code string `json:"code"`
|
|
Code string `json:"code"`
|
|
|
Ticket string `json:"ticket"`
|
|
Ticket string `json:"ticket"`
|
|
|
}{code, ticket}
|
|
}{code, ticket}
|
|
|
e := discordgo.EndpointAuth + "mfa/totp"
|
|
e := discordgo.EndpointAuth + "mfa/totp"
|
|
|
- resp, err := s.RequestWithBucketID("POST", e, data, e)
|
|
|
|
|
|
|
+ resp, err := session.RequestWithBucketID("POST", e, data, e)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|