mIRC Home    About    Download    Register    News    Help

Print Thread
Working !uptime command for mIRC (Twitch Bot) #266871 26/02/20 01:09 AM
Joined: Jan 2020
Posts: 17
D
dah Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Jan 2020
Posts: 17
Hello, there guys, I've been searching around the forums on the internet and some !uptime commands they don't seem to work or just outdated. I'm looking for a working !uptime command that shows how long I have or/ the person has been following the stream for? The code I've got now when I type "!uptime" it says "username is not online" I was wondering if you could find the working code it will show in the chat when you type !uptime it will say the correct time as it shows for the StreamElements bot. Basically when you type !uptime the StreamElements it displays the time even though if the streamer is online or offline. The code I'm using now;

Quote
ON *:TEXT:!uptime*:#tehrani: {
VAR %stream $IIF($2,$2,$remove(#,$chr(35)))
jsonopen -ud uptime https://api.twitch.tv/kraken/streams/ $+ %stream
IF ($JSONError) MSG $chan Error.
ELSEIF ($regex($JSON(uptime, stream, created_at), /^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/)) MSG $chan %stream has been streaming for $duration($calc($ctime - ($ctime($gettok(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec, $regml(2), 32) $regml(3) $regml(1) $regml(4) $+ : $+ $regml(5) $+ : $+ $regml(6)) - 18000)),2) $+ .
ELSE MSG $chan %stream is not online. LuvOops
}

Re: Working !uptime command for mIRC (Twitch Bot) [Re: dah] #266874 26/02/20 06:34 AM
Joined: Jan 2004
Posts: 1,300
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,300
Can you include a debug message to show the string output by: $JSON(uptime, stream, created_at)
so we can see if the string is different than expected by the regex.
also, please use CODE not QUOTE to include the script code.

Re: Working !uptime command for mIRC (Twitch Bot) [Re: dah] #266875 26/02/20 08:33 AM
Joined: Apr 2010
Posts: 939
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 939
Please run the following command and report back what it says:
Code
//echo -a $JSONVersion


I am SReject
My Stuff
Re: Working !uptime command for mIRC (Twitch Bot) [Re: FroggieDaFrog] #266877 26/02/20 02:22 PM
Joined: Jan 2020
Posts: 17
D
dah Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Jan 2020
Posts: 17
I'm having trouble at the moment in the "twitch/tv.9nty" tab it's making noises that an application is corrupted or something?
I typed "//echo -a $JSONVersion" and it said this..
[Linked Image from i.imgur.com]

The issue is now fixed now I had to uninstall the program and install and start from fresh.
When I type the !uptime script command in the chat it shows this.
[Linked Image from i.imgur.com]

Last edited by dah; 26/02/20 04:35 PM.
Re: Working !uptime command for mIRC (Twitch Bot) [Re: FroggieDaFrog] #266878 26/02/20 04:43 PM
Joined: Jan 2020
Posts: 17
D
dah Offline OP
Pikka bird
OP Offline
Pikka bird
D
Joined: Jan 2020
Posts: 17
Originally Posted by FroggieDaFrog
Please run the following command and report back what it says:
Code
//echo -a $JSONVersion


[Linked Image from i.imgur.com]