Jethro commented on a Page, quote socket  -  Nov 24, 2010

Jenny wrote:> Ok works nice. Would be better if you can have a setting whereby when put on a bot, it will msg the channel every hour or whatever time you choose with a quote. A small on/off menu with timer would make this a great snippet. I would then give it a definite like :)

on $*:text:/^!(auto)?(quote)\b|(off)$/iS:#:{
  if !%t { inc -u6 %t
    if $regml(1) = quote { quotes # | halt }
    elseif $regml(1) = off {
      if $timer(auto) { .timerauto off | .msg # Auto quote has been turned off! }
      halt
    }
    else { goto $iif(!$2 || $2 !isnum,error,timer) }
    :error | .msg # $nick $+ , please enter a number. e.g. !autoquote 20 $&
      (This sets quote to message in the channel every 20 seconds.) | halt
    :timer
    $+(.timer,$regml(1)) 0 $2 quotes #
    .msg # Auto quote has been set to message the channel every $2 seconds!
    halt
  }
}
alias quotes {
  sockopen quotes www.randomquotes.net 80
  sockmark quotes $iif($active = $1,.msg $1,echo -at) 12,1[4,1Random Quotes12,1]
}
on *:sockopen:quotes:{
  var %quotes sockwrite -n quotes
  %quotes GET / HTTP/1.1
  %quotes Host: $+($sock(quotes).addr,$str($crlf,2))
}
on *:sockread:quotes:{
  var %quotes | sockread %quotes
  if (<p class="quote"> isin %quotes) {
    $sock(quotes).mark $remove($gettok($v2,2,62),<br,</p)
    sockclose quotes
  }
}

Now you can have it both ways. For your own use, enter: /quotes

For other people to use:

For manual quote, enter: !quote
For timed quote, enter: !autoquote
To turn timed quote off, enter !off

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.