twitch - check if someone is a follower - 15/04/14 11:01 PM
hi.
i want my twitch bot to giveaway something with a special keyword (that shouldnt be the problem, i think i will be able to make it on my own). right after chosing someone it should read a hashtable or .txt file and check if the person is in it.
now to the part thats too hard for me.
https://github.com/justintv/Twitch-API/b...schannelstarget
there is a url that checks if someone is following a channel or not.
if someone is not following it will display
i modified a script that gets random facts from a website.
will this work?
if this code is somewhat ok and is doing ok, i need help retrieving the information of the website. i highlighted "the problem" red. how can i check if it says 404 after "status":?
it could be possible if it only checks the first few letters, because when someone is following, the site will give out something else:
i hope you guys understand what i mean :p
thanks in advance
i want my twitch bot to giveaway something with a special keyword (that shouldnt be the problem, i think i will be able to make it on my own). right after chosing someone it should read a hashtable or .txt file and check if the person is in it.
now to the part thats too hard for me.
https://github.com/justintv/Twitch-API/b...schannelstarget
there is a url that checks if someone is following a channel or not.
if someone is not following it will display
Code:
{"error":"Not Found","status":404,"message":"_user_ is not following _channel_"}
i modified a script that gets random facts from a website.
will this work?
Code:
alias twitchfollow { if ($sock(twitchfollow)) { sockclose twitchfollow} %twitch1 = https://api.twitch.tv/kraken/users/ %twitch2 = $nick %twitch3 = /follows/channels/_channel_ sockopen twitchfollow %twitch1 $+ %nick $+ %twitch3 80 } on *:sockopen:twitchfollow: { if ($sockerr) { msg $chan problem encountered, pls try again sockclose twitchfollow } else { sockwrite -n $sockname GET / HTTP/1.0 sockwrite -n $sockname Host: %twitch1 $+ %nick $+ %twitch3 $+ $crlf $+ $crlf } } on *:sockread:twitchfollow : { if ($sockerr) { msg $chan problem encountered, pls try again sockclose twitchfollow } else { sockread %twitchinfo [color:#FF0000](if ..status != 404)[/color] { set %twitchfollow $left($htmlfree(%twitchinfo),-6) } } } on *:sockclose:twitchfollow : { if (%twitchfollow) { if ($hget(followers,$nick) = 0) { hadd -m followers $nick 1 } } unset %twitchinfo %twitchfollow } alias htmlfree { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
if this code is somewhat ok and is doing ok, i need help retrieving the information of the website. i highlighted "the problem" red. how can i check if it says 404 after "status":?
it could be possible if it only checks the first few letters, because when someone is following, the site will give out something else:
Code:
{"created_at":"2014-04-15T18:39:19Z","_links":{"self":"https://api.twitch.tv/kraken and so on..
i hope you guys understand what i mean :p
thanks in advance