mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
Hi,


I don't get it working this command... I put the JSON Script in a new remote file, replaced "Bot_AccessToken" with "Access_Token Of My Bot"


I am using mTwitch for scripts based on JSON and also the OAuth Token for the bot.




Quote:
alias -l twitch.token {
if ($1 == My_Bot) return Bot_AccessToken
}

on $*:TEXT:/^!(status|game)(\s|$)/iS:#:{
var %n = $lower($regml(1))
var %json = TwitchStreamUpdate
var %data
if ($0 == 1) {
JSONOpen -du %json https://api.twitch.tv/kraken/channels/ $+ $lower($mid(#, 2-))
if ($JSONError) {
/msg # $msgtags(display-name).key -> Unable to retrieve $lower(%n $+ .)
}
elseif ($json(%json, %n)) {
/msg # $msgtags(display-name).key -> Current %n $+ : $v1
}
else {
/msg # $msgtags(display-name).key -> Unable to retrieve $lower(%n $+ .)
}
}
elseif ($nick != $mid(#,2-)) {
return
}
else {
var %data, %json = TwitchStreamUpdate
if (%n == status) {
%data = {"channel":{"status":" $+ $escape($2-) $+ "}}
}
else {
%data = {"channel":{"game":" $+ $escape($2-) $+ "}}
}
JSONOpen -duw %json https://api.twitch.tv/kraken/channels/ $+ $lower($mid(#, 2-))
JSONUrlMethod %json PUT
JSONUrlHeader %json Connection close
JSONUrlHeader %json Accept application/vnd.twitchtv.v3+json
JSONUrlHeader %json Content-type application/json
JSONUrlHeader %json Content-length $len(%data)
JSONUrlHeader %json Authorization OAuth Access_Token "channel_editor"
JSONUrlGet %json %data
if ($jsonerror) {
/msg # $msgtags(display-name).key -> Unable to update $lower(%n $+ .)
}
elseif ($JSON(%json, %n)) {
/msg # $msgtags(display-name).key -> Updated $lower($1) $+ : $v1
}
else {
/msg # $msgtags(display-name).key -> Unable to update $lower(%n $+ .)
}
}
}

alias -l escape return $regsubex($1-, /([^a-z\d_-\.])/gi, \ $+ \t)




I tested with the Access Token to access and edit the Status and Game, but nothing has paid off me so far only get the following answer:



Quote:
- Me: !game The Binding of Isaac: Afterbirth.

- Bot: Unable to update game.




Quote:
- Me: !status Test test.

- Bot: Unable to update status.



What am i doing wrong? Any help is appreciated.

Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
...?


Link Copied to Clipboard