mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
!uptime command #253522 18/06/15 02:39 AM
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 and I was wondering if someone could help me, because from one moment to the other I leave to function the command and not know why.





on *:text:!uptime*:#:{
if ((%flooduptime) || ($($+(%,flooduptime.,$nick),2))) { return }
set -u5 %flooduptime On
set -u10 %flooduptime. $+ $nick On
set %target $iif($2,$2,$mid(#,2-))
set %channel #
uptime
}

alias uptime {
sockclose uptime
sockopen uptime nightdev.com 80
}

on *:sockopen:uptime:{
if ($sockerr) { sockclose $sockname | halt }
sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ %target HTTP/1.1
sockwrite -n $sockname Host: www.nightdev.com
sockwrite -n $sockname $crlf
}

on *:sockread:uptime:{
if ($sockerr) { sockclose $sockname | halt }
var %data
sockread %data
tokenize 32 %data
if ($1 isnum) && ($2) { msg %channel %target has been online for $1- }
elseif (%data == The channel is not live.) msg %channel %target is currently not online/streaming.

}

on *:sockclose:uptime:{
unset %channel
unset %target
}


Any help is appreciated!

Re: !uptime command [Re: Khonor] #253527 18/06/15 10:35 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511

Re: !uptime command [Re: westor] #253593 20/06/15 11:22 PM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
If I seen this script but I need for multiple channels.

Re: !uptime command [Re: westor] #253597 21/06/15 02:28 AM
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 that is yours and it works very well, but need to work on multiple channels, you can do?

PS: And in the part where it says: "The streaming is currently offline." He it repeats twice in chat.



alias uptime_chan return

ON *:TEXT:!uptime:#: {
var %c = $chr(35) $+ $uptime_chan
if (%c == $chan) { uptime }
}

alias uptime {
sockclose uptime
sockopen uptime nightdev.com 80
}

ON *:SOCKOPEN:uptime: {
if ($sockerr) { sockclose $sockname | halt }
sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ $uptime_chan HTTP/1.1
sockwrite -n $sockname Host: $sock($sockname).addr
sockwrite -n $sockname $crlf
}

ON *:SOCKREAD:uptime: {
if ($sockerr) { sockclose $sockname }
var %data
sockread %data
if ($gettok(%data,1,32) isnum) && ($gettok(%data,2,32)) {
var %c = $chr(35) $+ $uptime_chan
if ($me !ison %c) { return }
.msg %c The streaming is up for $qt(%data) $+ .
}
elseif (*not live.* iswm %data) {
var %c = $chr(35) $+ $uptime_chan
if ($me !ison %c) { return }
.msg %c The streaming is currently offline.
}
}

Re: !uptime command [Re: Khonor] #253598 21/06/15 02:35 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Try use this code:

Code:
ON *:TEXT:!uptime:#: { 
  var %s = uptime_ $+ $ticks $+ $rand(1,10000)
  sockopen %s nightdev.com 80
  sockmark %s $mid($chan,2-)
}

ON *:SOCKOPEN:uptime_*: {
  if ($sockerr) { sockclose $sockname | return }
  sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname $crlf
}

ON *:SOCKREAD:uptime_*: {
  if ($sockerr) { sockclose $sockname | return }
  var %data
  sockread %data
  if ($gettok(%data,1,32) isnum) && ($gettok(%data,2,32)) {
    var %c = $chr(35) $+ $sock($sockname).mark
    if ($me !ison %c) { return }
    .msg %c The streaming is up for $qt(%data) $+ .
  }
  elseif (*not live.* iswm %data) {
    var %c = $chr(35) $+ $sock($sockname).mark
    if ($me !ison %c) { return }
    .msg %c The streaming is currently offline.
  }
}

Re: !uptime command [Re: westor] #253599 21/06/15 02:57 AM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
It does not work. [img]http://prntscr.com/7jfgoq[/img] cry

Re: !uptime command [Re: Khonor] #253600 21/06/15 03:41 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Of course and is working, probably you did something wrong on copy/paste, or you had place it into an wrong place.

Paste the code into the Remotes tab into the Script Editor into a new file and try again.

Re: !uptime command [Re: westor] #253601 21/06/15 03:50 AM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
I do not change anything. [img]http://prntscr.com/7jfthz[/img]

Re: !uptime command [Re: Khonor] #253602 21/06/15 04:12 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
If you are not getting any command response thats not code fault but you have probably did not add support for CAP (new twitch protocol) so try use this code:

NOTE: After you paste the code, restart the bot to apply.

Code:
ON *:TEXT:!uptime:#: { 
  var %s = uptime_ $+ $ticks $+ $rand(1,10000)
  sockopen %s nightdev.com 80
  sockmark %s $mid($chan,2-)
}

ON *:SOCKOPEN:uptime_*: {
  if ($sockerr) { sockclose $sockname | return }
  sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname $crlf
}

ON *:SOCKREAD:uptime_*: {
  if ($sockerr) { sockclose $sockname | return }
  var %data
  sockread %data
  if ($gettok(%data,1,32) isnum) && ($gettok(%data,2,32)) {
    var %c = $chr(35) $+ $sock($sockname).mark
    if ($me !ison %c) { return }
    .msg %c The streaming is up for $qt(%data) $+ .
  }
  elseif (*not live.* iswm %data) {
    var %c = $chr(35) $+ $sock($sockname).mark
    if ($me !ison %c) { return }
    .msg %c The streaming is currently offline.
  }
}

ON *:CONNECT: {
  if ($server == tmi.twitch.tv) {
    /raw CAP REQ :twitch.tv/membership
    /raw CAP REQ :twitch.tv/commands
  }
}

Re: !uptime command [Re: westor] #253604 21/06/15 03:03 PM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
It does not work, do not understand why this does not work and the other happens to the principle itself.

Re: !uptime command [Re: Khonor] #253605 21/06/15 04:12 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
I cannot understand why is not working into your bot, i had try it 100 times and everything working..

Re: !uptime command [Re: westor] #253610 21/06/15 10:25 PM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
I do not understand because they do not work, but if I use your other script that is only for my channel if it works.

Re: !uptime command [Re: Khonor] #253611 21/06/15 10:30 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Give a try this one:

Code:
ON *:TEXT:!uptime:#: { 
  var %s = uptime_ $+ $ticks $+ $rand(1,10000)
  sockopen %s nightdev.com 80
  sockmark %s $mid($chan,2-)
}

ON *:SOCKOPEN:uptime_*: {
  if ($sockerr) { sockclose $sockname | return }
  sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ $sock($sockname).mark HTTP/1.1
  sockwrite -n $sockname Host: $sock($sockname).addr
  sockwrite -n $sockname $crlf
}

ON *:SOCKREAD:uptime_*: {
  if ($sockerr) { sockclose $sockname | return }
  var %data
  sockread %data
  if ($gettok(%data,1,32) isnum) && ($gettok(%data,2,32)) {
    var %c = $chr(35) $+ $sock($sockname).mark
    .msg %c The streaming is up for $qt(%data) $+ .
  }
  elseif (*not live.* iswm %data) {
    var %c = $chr(35) $+ $sock($sockname).mark
    .msg %c The streaming is currently offline.
  }
}

ON *:CONNECT: {
  if ($server == tmi.twitch.tv) {
    /raw CAP REQ :twitch.tv/membership
    /raw CAP REQ :twitch.tv/commands
  }
}

Re: !uptime command [Re: westor] #253612 21/06/15 10:55 PM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
Still does not work, but good no matter thank you very much for all your help equal Westor.

Re: !uptime command [Re: Khonor] #253623 23/06/15 05:04 AM
Joined: Jan 2014
Posts: 101
M
Majeye Offline
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Mine works just fine. Just tested it in my own channel.

Here you go:

https://github.com/Majeye/MajeyeBot/blob/master/streamer_uptime

!uptime is the command

You can also do !uptime <Streamer Name> and it'll tell you someone elses uptime, even in your own channel.


Last edited by Majeye; 23/06/15 05:06 AM.
Re: !uptime command [Re: Majeye] #253631 23/06/15 02:49 PM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
If this used to work, but in the last few weeks it stopped. confused

Re: !uptime command [Re: Khonor] #253637 23/06/15 04:51 PM
Joined: May 2015
Posts: 133
K
keyeslol Offline
Vogon poet
Offline
Vogon poet
K
Joined: May 2015
Posts: 133
You need to send this:

/raw CAP REQ :twitch.tv/membership
/raw CAP REQ :twitch.tv/commands


twitter @keyeslol
Re: !uptime command [Re: Khonor] #256498 21/01/16 03:13 AM
Joined: Apr 2014
Posts: 33
B
bl968 Offline
Ameglian cow
Offline
Ameglian cow
B
Joined: Apr 2014
Posts: 33
Recently nightbot added a spam to the command. I dealt with it by changing....

Quote:
if ($1 isnum) && ($2) { msg %channel %target has been online for $1- }

to
Quote:
if ($1 isnum) && ($2) {
/msg %channel %target has been streaming for $gettok($1-,1,45)
}




Last edited by bl968; 21/01/16 03:14 AM.
Re: !uptime command [Re: Khonor] #256591 30/01/16 03:34 PM
Joined: Jan 2016
Posts: 79
X
x3pos Offline
Babel fish
Offline
Babel fish
X
Joined: Jan 2016
Posts: 79
bot saying

"1 hour, 32 minutes - Oh hey, you're using an API meant for Nightbot, not for whatever you're using. Maybe you'd want to try out the new Nightbot beta: https://beta.nightbot.tv".

can i delete other words.i want to only "hours and minutes"

Re: !uptime command [Re: x3pos] #256592 30/01/16 08:45 PM
Joined: Jul 2015
Posts: 13
S
Sissou Offline
Pikka bird
Offline
Pikka bird
S
Joined: Jul 2015
Posts: 13
Originally Posted By: x3pos
bot saying

"1 hour, 32 minutes - Oh hey, you're using an API meant for Nightbot, not for whatever you're using. Maybe you'd want to try out the new Nightbot beta: https://beta.nightbot.tv".

can i delete other words.i want to only "hours and minutes"




I use this and it works

Quote:

on *:text:!uptime*:#:{
if (!$2) { set %target $remove($chan,$chr(35)) }
else set %target $iif($2,$2,$mid(#,2-))
set %channel #
uptime
}

alias uptime {
sockclose uptime
sockopen uptime nightdev.com 80
}

on *:sockopen:uptime:{
if ($sockerr) { sockclose $sockname | halt }
sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ %target HTTP/1.1
sockwrite -n $sockname Host: www.nightdev.com
sockwrite -n $sockname $crlf
}

on *:sockread:uptime:{
if ($sockerr) { sockclose $sockname | halt }
var %data
sockread %data
tokenize 32 %data
var %delmessage = $deltok($1-, 5-30, 32)
var %online $remove(%delmessage,- Oh)
if ($1 isnum) && ($2) { msg %channel %target has been online for %online }
elseif (%data == The channel is not live. - Oh hey, you're using an API meant for Nightbot, not for whatever you're using. Maybe you'd want to try out the new Nightbot beta: https://beta.nightbot.tv) msg %channel %target is currently not online.
}

on *:sockclose:uptime:{
unset %channel
unset %target
}

Page 1 of 2 1 2