Max's Quote Bot

By MaxEvans on Mar 23, 2009

This is an idea I had to create a quote bot that pulls a random quote from the site quotationspage.com. I started out using a txt file, then thought about using sockets to pull from the site as an unlimited quote resource. Or, moreso than a txt file. It's pretty cool.

Usage:

Make sure you're using the lastest version of mIRC.

Load the script into your bot.

Use !quote to trigger a random quote.

<%MaxEvans> !quote
<@[Jack]> "The reward of one duty is the power to fulfill another. " - George Eliot (1819 - 1880)
<%MaxEvans> !quote
<@[Jack]> "Honesty may be the best policy, but it's important to remember that apparently, by elimination, dishonesty is the second-best policy. " - George Carlin (1937 - 2008)

Thanks to Scakk for helping with the code.

alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) | return %x }

alias quotation {
  if (!$sock(quotationspage)) {
    sockopen quotationspage www.quotationspage.com 80
    set %quotechan $chan
  }
}
on *:sockopen:quotationspage: {
  sockwrite -n $sockname GET /random.php3 HTTP/2.0
  sockwrite -n $sockname Host: www.quotationspage.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname $crlf
}
on *:sockread:quotationspage: {
  sockread %quotationspage
  if (<dt class="quote"> isin %quotationspage) {
    set %quote %quotationspage
  }
}
on *:sockclose:quotationspage: {
  set %author $htmlfree($gettok(%quote,19-,62))
  .msg %quotechan $qt($remove($htmlfree(%quote),%author)) - %author
  unset %quot* %author
}
on *:TEXT:!quote:#: {
  quotation
}

Comments

Sign in to comment.
VinX   -  Aug 19, 2009

23:39:07 [@VinX] !quote
23:39:11 [&V-BOT] "Trying to determine what is going on in the world by reading newspapers is like trying to tell the time by watching the second hand of a clock. " - 4 Ben Hecht (1893 - 1964) - More quotations on: [Journalism]

how do i change the "text" color ?

 Respond  
Aucun50   -  Mar 24, 2009

Nice one i like it a lot 8/10 here.

 Respond  
MaxEvans   -  Mar 23, 2009

I noticed that some quotes did have that on them, but I'm not completely sure how to remove them. Other than that, thanks. =]

 Respond  
Kirby   -  Mar 23, 2009

Ah, you've finally got it working. :)
Nice to see that you've changed /quote to /quotation instead.

<@null> "You ask me why I do not write something....I think one's feelings waste themselves in words, they ought all to be distilled into actions and into actions which bring results. " - Florence Nightingale (1820 - 1910), in Cecil Woodham-Smith, Florence Nightingale, 1951 - More quotations on: [Writing] [Actions]
For some of the quotes, I get > More quotations on: [Writing] [Actions] [Passion]. etc. Do you want to keep those in? (I think they were originally hyperlinks, on the site.)

Should be /unset %quot than /unset %quote. :X

Otherwise, good work MaxEvans.

/me rates 7.0

 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.