- substitute_name = who
- who = 'random'
- end\r
-
- # pick a random person\r
- if who == 'random'
- if substitute_name
- # take out the Mr. T facts if you're inserting someone's name
- # beacuse tons of them suck, and most of them revolve around
- # "pitying" someone or something.
- people = FACTMAP.keys - ["mrt"]
- who = people[rand(people.length)]
- else
- who = FACTMAP.keys[rand(FACTMAP.length)]
- end\r
- end\r
-
- # get the long name\r
- longwho = FACTMAP[who]\r
- unless longwho\r
- m.reply "Who the crap is #{who}?!?!"\r
- return\r
- end\r
- \r
- matcher = %r{<h1> And now a random fact about #{longwho}...</h1>(.+?)<hr />}\r
-
- # get the fact
- factdata = @bot.httputil.get(URI.parse("http://www.4q.cc/index.php?pid=fact&person=#{who}"))
- unless factdata
- m.reply "This #{longwho} fact punched my teeth in. (HTTP error)"