Bash.org Random Quote

By Jonesy44 on Dec 08, 2008

Yes! i know, it's been done before. But i perfer this version for a few of reasons;

**Version 1.00*** It actually gives the quote, not a link

  • It only gives one liners so it doesn't spam a channel
  • Can be used as an alias, /bash or as a command [!@.'`]bash
    **Version 1.10*** New /bash [quotenum] support added, you can still add a channel after
  • Channel command support for quotenums added too
    Hope you enjoy! Please rate & comment. x

COMMANDS

/bash [quote-num] [#channel]
[!@.'`]bash [quote-num]

SCREENSHOT
Image

; Bash.org Script by Jonesy44 ========;
; irc.chatscape.net // #chatscape ====;
; Version 1.10 =======================;
; ====================================;
; DO NOT EDIT ANYTHING IN THIS FILE ==;
; UNLESS YOU KNOW WHAT YOU'RE DOING ==;
; ====================================;
on $*:TEXT:/[!@\.'`]bash*/:#: {
  if (!$sock(bash)) { bash $iif($1 isnum,$1 $chan,$chan) }
  else { msg $chan 4Bash.org Socket in use, Please wait..  }
}
alias bash {
  if ($1) {
    if ($me ison $1) {
      set %bash.chan $1
    }
    elseif ($1 isnum) { 
      set %bash.q $1
      if ($me ison $2) {
        set %bash.chan $2
      }
    }
  }
  else {
    unset %bash.* 
  }
  $iif(%bash.chan,msg %bash.chan,echo -a) 4Bash.org Getting $iif(!%bash.q,a random,) quote $iif(%bash.q,$chr(35) $+ %bash.q,) from bash.org, Please wait.. 
  if ($sock(bash)) {
    sockclose bash
  }
  sockopen bash www.bash.org 80
}
alias bash.removetags {
  noop $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%bash.n)
  var %y = $remove($replace(%bash.n,&lt;,<,&gt;,>,&quot;,"),&nbsp;)
  unset %bash.n
  return %y
}
on *:SOCKOPEN:bash: {
  sockwrite -nt $sockname GET $iif(!%bash.q,/?random,$+(/?,%bash.q)) HTTP/1.1
  sockwrite -nt $sockname Host: www.bash.org
  sockwrite -nt $sockname $crlf
}
on *:SOCKREAD:bash: {
  var %x
  sockread %x
  if (<p class="quote">* iswm %x) {
    if ($right(%x,4) == </p>) {
      $iif(%bash.chan,msg %bash.chan,echo -a) 4Bash.org - $gettok($bash.removetags(%x),1,32) Quote: $remove($gettok($bash.removetags(%x),3-,32),[X])
      sockclose bash
      unset %bash.*
    }
    else { 
      if (!%bash.q) {
        sockclose bash  
        sockopen bash www.bash.org 80
      }
      else {
        $iif(%bash.chan,msg %bash.chan,echo -a) 4Bash.org Sorry, Quote %bash.q is not a One-Liner
      }
    }
  }
}

Comments

Sign in to comment.
dma   -  Dec 13, 2015

good script///yeah i think i made a bash some where on there lol

 Respond  
MashhitDK   -  Sep 03, 2011

Just wanted to say thanks...

 Respond  
Jonesy44   -  Dec 11, 2008

Mountaindew: thanks for the help; here's the product, so far! :D http://www.hawkee.com/profile/img/2454/

 Respond  
Jonesy44   -  Dec 10, 2008

Lazy: should be sorted now, my bad! :P

big_boya: sure, remove the variable checking and it'll mash out the full quote, but it may have a bit of html in it so use the html remove alias

 Respond  
big_boya   -  Dec 09, 2008

can you make one that it dont have to be a one liner?

 Respond  
Lazy   -  Dec 09, 2008

Good update, but a few things you might want to change. In the ON TEXT event using bash $chan will always make $1 #channel in the bash alias. So if ($1 isnum) won't work if you are using this on your bot.

 Respond  
Jonesy44   -  Dec 09, 2008

I'll kick that one's ass with mine :P

 Respond  
guest598594   -  Dec 09, 2008

Thank you MD!! YOU ARE A GOD!! how did you know that may i ask? i got the return log WWW-Authentication etcetc but had no idea how to get round it XD

There was already an mIRC script: http://forum.utorrent.com/viewtopic.php?id=15387&p=1

But it looks like it could be made a lot better.

 Respond  
Jonesy44   -  Dec 09, 2008

**Version 1.10*** New /bash [quotenum] support added, you can still add a channel after

  • Channel command support for quotenums added too
 Respond  
Jonesy44   -  Dec 09, 2008

Thank you MD!! YOU ARE A GOD!! how did you know that may i ask? i got the return log WWW-Authentication etcetc but had no idea how to get round it XD

Thank you again! <333

 Respond  
guest598594   -  Dec 09, 2008

Jonesy: uTorrent Web UI API

So you'd socket to http://[IP]:[PORT]/gui/?list=1

And to authenticate:

sockwrite -nt $sockname Authorization: Basic $encode(USER:PASS,m)

I was gonna make one once but I just decided it'd be easier to just open uTorrent itself ;)

 Respond  
Jonesy44   -  Dec 09, 2008

Cheers Napa: It was my result of boredom! and i fancied doign some socket stuff! I was trying to make a utorrent socket, but i couldnt find out how to authenticate, any help welcome!

Thanks Lazy: I don't think Bash gives out " :/ but if it does, i'll happily add it in! thanks for posting x]

 Respond  
Lazy   -  Dec 08, 2008

Nice job.

var %y = $remove($replace(%n,<,<,>,>,","), )

Might want to edit your code to replace the " with " as well.

 Respond  
napa182   -  Dec 08, 2008

nice work jonesy44, and it seem's to be a fun lil code. 7/10

 Respond  
Jonesy44   -  Dec 08, 2008

Added a screenie x]

 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.