mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2014
Posts: 52
Babel fish
OP Offline
Babel fish
Joined: Sep 2014
Posts: 52
First off I am using SReject's JSONforMirc 0.2.4 and I am trying to make an alias to unfollow a twitch channel. I have the following alias to PUT a follow to the API and it works perfectly. I have the required scope for my OAuth token.
Code:
alias followchan {
  var %json followput
  JSONOpen -duw %json https://api.twitch.tv/kraken/users/ $+ $lower($me) $+ /follows/channels/ $+ $lower($1)
  JSONUrlMethod %json PUT
  JSONUrlHeader %json Connection close
  JSONUrlHeader %json Accept application/vnd.twitchtv.v3+json
  JSONUrlHeader %json Authorization OAuth $oauth
  JSONUrlGet %json
}

But when I try to UNfollow a channel with this code
Code:
alias unfollowchan {
  var %json followdel
  JSONOpen -duw %json https://api.twitch.tv/kraken/users/ $+ $lower($me) $+ /follows/channels/ $+ $lower($1)
  JSONUrlMethod %json DEL
  JSONUrlHeader %json Connection close  
  JSONUrlHeader %json Accept application/vnd.twitchtv.v3+json
  JSONUrlHeader %json Authorization OAuth $oauth
  JSONUrlGet %json
}

Turning on the JSONDebugger when running the alias gives me this error:
Quote:

/JSONUrlGet - followdel --RAISED-- Unable to Parse: Invalid JSON

According to the API documentation the only difference between the 2 actions is to change PUT to DELETE, the process should be the same otherwise. Unfortunately DELETE is not one of the accepted methods for SReject's parser, only DEL. So I was thinking that may have something to do with it.

Any help is appreciated. smile

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
This is a mistake on my part. I will be fixing it shortly for the v0.2.x series

This is now fixed. See Here for downloads

Last edited by FroggieDaFrog; 13/06/16 12:15 PM.

I am SReject
My Stuff
Joined: Sep 2014
Posts: 52
Babel fish
OP Offline
Babel fish
Joined: Sep 2014
Posts: 52
Thank you Mr. Frog/Sreject. I was hoping you would "hop" in and help ( blush sorry)
I changed DEL to DELETE and it worked. The object was deleted successfully. Thank you so much for your hard work. Your JSON parser is such a huge help to mIRC n00bs like me. grin

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Its no problem. I wouldn't've made the script public if I didn't want to make others' lives easier.

--

In the future, if you notice anything that feels like a bug, missing feature, etc feel free to open an issue on the github. I can't really fix broken code if I don't know its broke


I am SReject
My Stuff
Joined: Mar 2016
Posts: 50
T
Babel fish
Offline
Babel fish
T
Joined: Mar 2016
Posts: 50
Since you have the script there how do I make my bot follow a user that types !followme in my chat?


Link Copied to Clipboard