Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Random Quote Bot Script by Ford_Lawnmower irc.Geekshed.net #Script-Help
- menu Channel,Status {
- .$iif($group(#Quote) == On,$style(1)) Quote Trigger
- ..$iif($group(#Quote) == On,$style(2)) On: .enable #Quote
- ..$iif($group(#Quote) == Off,$style(2)) Off: .disable #Quote
- }
- #Quote on
- On $*:Text:/^(!|@)Quote/Si:#: {
- if ($timer($+(Quote,$network,$nick))) { return }
- .timer $+ $+(Quote,$network,$nick) 1 6 noop
- var %method $iif($regml(1) == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%)/),.msg $chan,.notice $nick))
- Quote %method $2-
- }
- #Quote end
- alias EchoQuote { Quote echo -a $1- }
- alias -l Quote {
- $1-2 Searching for your Quote. Please wait........
- var %sockname $+(Quote,$network,$2,$ticks)
- sockopen %sockname www.quotedb.com 80
- sockmark %sockname $1-2 /quote/quote.php?action=random_quote&=&=&
- }
- On *:sockopen:Quote*: {
- if (!$sockerr) {
- sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
- sockwrite -n $sockname Host: www.quotedb.com
- sockwrite -n $sockname $crlf
- }
- else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
- }
- On *:sockread:Quote*: {
- if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
- else {
- var %Quote | sockread %Quote
- if ($regex(%Quote,/document\.write\('(.*)<br>/i))) { sockmark $sockname $addtok($sock($sockname).mark,$regml(1),32) }
- if ($regex(%Quote,/<a\shref="http.*">(.*)<\/a>/i)) {
- put $gettok($sock($sockname).mark,1-2,32) $+(07,$gettok($sock($sockname).mark,4-,32)) by04 $regml(1)
- sockclose $sockname
- return
- }
- }
- }
- alias -l Put {
- if (!$regex($1,/(\.|^)(msg|notice|echo)$/Si)) || (!$3) { echo -st **Put error** Syntax /Put msg #channel text - or - /Put notice nickname text | return }
- tokenize 32 $regsubex($1-,/([$\|%\[\]\}\{][^\s]*)/g,$+($chr(2),$chr(2),\t))
- var %tokens $0, %Tstart 3, %Dtimer 1500
- if ($timer($+(Put,$2,$network)).secs) { %Dtimer = $calc($v1 * 1000) }
- while ($len($($+($,%Tstart,-,%tokens),2)) > 430) {
- dec %tokens
- if ($len($($+($,%Tstart,-,%tokens),2)) <= 430) {
- .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
- inc %Dtimer 1500
- %Tstart = $calc(%tokens + 1)
- %tokens = $0
- }
- }
- .timer -m 1 %Dtimer $1-2 $($+($,%Tstart,-,%tokens),2))
- .timer $+ $+(Put,$2,$network) -m 1 $calc(%Dtimer + 1500) noop
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement