Add more info about captcha issue

Recognize 'captcha-required' discord error instead of printing null
error message. Also add info on how to get the token and a link to
original  issue to README.
This commit is contained in:
Artem Savkov 2018-05-19 08:40:37 +02:00
parent 4fc5649367
commit 9e086eb68e
2 changed files with 19 additions and 0 deletions

16
README
View File

@ -61,6 +61,22 @@ Plugin adds 'discord' protocol to bitlbee, add your account as usual:
> account add discord <email> <password>
> account discord on
On your first login you might need to authorize bitlbee's ip address
(discord will send you an email with a link) or get a captcha-request. In
latter case you will have to manually set discord login-token to log in:
> account off discord
> acc discord set token_cache xxxxxxxx
To get your token you'll have to login with your browser and locate it in
"local storage"
Chrome: Developer Tools -> Application -> Local Storage -> https://discordapp.com -> token
Firefox: Web Developer -> Storage Inspector -> Local Storage -> http://discordapp.com -> token
For more info on captcha issue and any progress on making it less painful see
https://github.com/sm00th/bitlbee-discord/issues/118
You also need to configure discord channels you would like to join/autojoin. To
do that use bitlbee's 'chat list' functionality (`help chat list` and `help
chat add`):

View File

@ -276,11 +276,14 @@ static void discord_http_login_cb(struct http_request *req)
json_value *em = NULL;
json_value *email = json_o_get(js, "email");
json_value *password = json_o_get(js, "password");
json_value *captcha_key = json_o_get(js, "captcha_key");
if (email != NULL && email->type == json_array) {
em = email->u.array.values[0];
} else if (password != NULL && password->type == json_array) {
em = password->u.array.values[0];
} else if (captcha_key != NULL && captcha_key->type == json_array) {
em = captcha_key->u.array.values[0];
}
if (em != NULL && em->type == json_string) {