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
I have this script to query the time it followed a channel, but does not respond or it simply does not recognize the followers and says that you are not following the channel.








on $*:TEXT:/^!followage( \S+)?$/i:#:{
if ($( $+(%, FloodPro., #), 2) || $( $+(%, FloodPro., $nick), 2)) {
return
}

set -u3 $+(%, FloodPro., #) $true
set -u5 $+(%, FloodPro., $nick) $true

var %chan = $mid(#, 2-)
var %user = $iif($len($2), $2, $nick)

if ($FollowCheck(%user, %chan)) {
var %date = $v1
msg # %user - You follow # for: $replace( $asctime(%date, dd mmm yyyy), jan, janvier, feb, février, mar, mars, apr, avril, may, mai, jun, juin, jul, juillet, aug, aout, sep, septembre, oct, octobre, nov, novembre, dec, décembre) ( $+ $replace( $duration( $calc($ctime - %date)), wks, semaines, day, jour, days, jours, hrs, heures, min, minutes)) $+ ) }
elseif (%NoFollow) {
msg # %user - You're not following the # channel.
}
}


alias FollowCheck {
var %date
JSONOpen -ud FollowCheck https://api.twitch.tv/kraken/users/ $+ $1 $+ /follows/channels/ $+ $iif(#* iswm $2, $mid($2,2-), $2)
if (!$JSONError) {
set -u0 %noFollow $true
if ($JSON(FollowCheck, created_at)) {
%date = $v1
if ($JSONError) {
%date = $null
}
else {
unset %NoFollow
%date = $ConvertTwitchTime(%date)
if ($prop == duration) {
%date = $calc($ctime - %date)
}
}
}
JSONClose FollowCheck
}
return %date
}

alias ConvertTwitchTime {
if ($regex($1-, /^(\d\d(?:\d\d)?)-(\d\d)-(\d\d)T(\d\d)\:(\d\d)\:(\d\d)(?:(?:Z$)|(?:([+-])(\d\d)\:(\d+)))?$/i)) {
var %m = $Gettok(January February March April May June July August September October November December, $regml(2), 32), %d = $ord($base($regml(3),10,10)), %o = +0, %t
if ($regml(0) > 6) %o = $regml(7) $+ $calc($regml(8) * 3600 + $regml(9))
%t = $calc($ctime(%m %d $regml(1) $regml(4) $+ : $+ $regml(5) $+ : $+ $regml(6)) - %o)
if ($asctime(zz) !== 0 && $regex($v1, /^([+-])(\d\d)(\d+)$/)) {
%o = $regml(1) $+ $calc($regml(2) * 3600 + $regml(3))
%t = $calc(%t + %o )
}
return %t
}
}

Last edited by Khonor; 13/05/16 04:01 PM.
Joined: Oct 2014
Posts: 35
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
You need JSON for mIRC - http://hawkee.com/snippet/10194/


Matti
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
Hey Matti,

Thank you very much for your answer, now if longer works properly.

Regards,
-Khonor


Link Copied to Clipboard