mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Anyone could help with me with seeing how long a users account has been created for? Been trying to get one but no luck smirk

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Making use of my JSON parser you can use:
Code:
;; $twitch_accountage(username|userid)
;;     Returns the number of seconds the account has existed
alias twitch_accountage {
  var %result
  JSONOpen -uw accountage https://api.twitch.tv/kraken/users/ $+ $$1
  JSONUrlHeader accountage Client-ID e8e68mu4x2sxsewuw6w82wpfuyprrdx
  JSONUrlGet accountage

  if (!$JSONError) {
    %result = $TwitchTime($JSON(accountage, created_at))
    %result = $calc($ctime - %result)
  }
  JSONClose accountage
  return %result
}

;; Translates ISO-8601-1 dates into a EPOCH time stamp
alias -l TwitchTime {
  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))
      inc %t %o
    }
    return %t
  }
}

Last edited by FroggieDaFrog; 05/01/17 04:31 AM.

I am SReject
My Stuff
Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Hmm would it be possible for it to display it in Years,Months,Days,Seconds?

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
Check out /help $duration

Last edited by FroggieDaFrog; 05/01/17 11:05 PM.

I am SReject
My Stuff
Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
Okay :P and one thing sorry to bug but could you do the command format so like when i do !created for example it would put in chat the command smile

Joined: Sep 2016
Posts: 33
P
Ameglian cow
OP Offline
Ameglian cow
P
Joined: Sep 2016
Posts: 33
im just trying to get it so that its like !created $user and !created $2 and that either one can be used


Link Copied to Clipboard