Get username from roblox API rather than manually passing it

This commit is contained in:
itzaname 2019-01-17 23:19:18 -05:00
parent b846ebe575
commit 85aadb514b

View File

@ -15,7 +15,7 @@ type Session struct {
} }
// New create a new session and logs in with provided data // New create a new session and logs in with provided data
func New(username, cookie string) (*Session, error) { func New(cookie string) (*Session, error) {
cookieJar, _ := cookiejar.New(nil) cookieJar, _ := cookiejar.New(nil)
rbxCookie := []*http.Cookie{&http.Cookie{ rbxCookie := []*http.Cookie{&http.Cookie{
Name: ".ROBLOSECURITY", Name: ".ROBLOSECURITY",
@ -28,7 +28,7 @@ func New(username, cookie string) (*Session, error) {
Jar: cookieJar, Jar: cookieJar,
} }
session := Session{0, username, client} session := Session{0, "", client}
/*err := session.Login(username, password) /*err := session.Login(username, password)
if err != nil { if err != nil {
@ -41,6 +41,7 @@ func New(username, cookie string) (*Session, error) {
} }
session.ID = info.UserID session.ID = info.UserID
session.Username = info.UserName
return &session, err return &session, err
} }