From c5d9887a53f693539297c95c9c7ef358932a9136 Mon Sep 17 00:00:00 2001 From: 5elenay <5elenay@protonmail.com> Date: Mon, 13 Sep 2021 17:49:16 +0300 Subject: [PATCH] fixes #3 --- client.go | 2 +- http.go | 1 - websocket.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client.go b/client.go index f0b5ade..d4dd126 100644 --- a/client.go +++ b/client.go @@ -189,7 +189,7 @@ func (c *Client) Auth() error { return fmt.Errorf("can't auth user (not a self-bot.)") } - resp, err := c.Request("POST", "/auth/login", []byte("{\"email\":\""+c.SelfBot.Email+"\",\"password\":\""+c.SelfBot.Password+"\",\"captcha\": \"\"}")) + resp, err := c.Request("POST", "/auth/session/login", []byte("{\"email\":\""+c.SelfBot.Email+"\",\"password\":\""+c.SelfBot.Password+"\",\"name\":\"Revoltgo\"}")) if err != nil { return err diff --git a/http.go b/http.go index 25cd681..2c6c99e 100644 --- a/http.go +++ b/http.go @@ -23,7 +23,6 @@ func (c Client) Request(method, path string, data []byte) ([]byte, error) { if c.SelfBot == nil { req.Header.Set("x-bot-token", c.Token) } else if c.SelfBot.SessionToken != "" && c.SelfBot.UserId != "" { - req.Header.Set("x-user-id", c.SelfBot.UserId) req.Header.Set("x-session-token", c.SelfBot.SessionToken) } diff --git a/websocket.go b/websocket.go index 2a28455..6cc03c0 100644 --- a/websocket.go +++ b/websocket.go @@ -54,7 +54,7 @@ func (c *Client) handleWebsocketAuth() { if c.SelfBot == nil { c.Socket.SendText(fmt.Sprintf("{\"type\":\"Authenticate\",\"token\":\"%s\"}", c.Token)) } else { - c.Socket.SendText(fmt.Sprintf("{\"type\":\"Authenticate\",\"id\":\"%s\",\"session_token\":\"%s\",\"user_id\":\"%s\"}", c.SelfBot.Id, c.SelfBot.SessionToken, c.SelfBot.UserId)) + c.Socket.SendText(fmt.Sprintf("{\"type\":\"Authenticate\",\"result\":\"Success\",\"_id\":\"%s\",\"token\":\"%s\",\"user_id\":\"%s\",\"name\":\"Revoltgo\"}", c.SelfBot.Id, c.SelfBot.SessionToken, c.SelfBot.UserId)) } }