Created
March 5, 2009 03:10
-
-
Save Bluebie/74160 to your computer and use it in GitHub Desktop.
A simple bot for Talkie that pretends to be _why by saying strange things
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require '../../../paths' # remove this before using, it's only relevent on creativepony.com servers | |
require 'rubygems' | |
require 'rack' | |
require 'json' | |
Lines = "this sky is chalk wherewith to sharpen my pool cue | |
oh for the sky to be just once made of all mouths, | |
from the licky crocodile kinds to those types | |
which consume of the powdered donut gems | |
would that the clear sky were now ff00ff, | |
which is win32 transparent, the banned color, | |
they said we wouldn’t choose it, | |
well ff00ff on them | |
and stop lauding david blaine but deny him due claps | |
til he can stretch acrosst the sky and raise | |
the dead disneys with mouth sucking force | |
poor anna kornikova can’t send e-mail to any of us, | |
everything she writes is arrested by the spam filters, | |
and she is alone, | |
can’t you see | |
alone in the tennis courts, | |
as hollow as the very balls she serves | |
she must try harder, anna write your message on that ball | |
and lob it to me!! | |
oh no, | |
look up, the sun sees us, | |
dress me a dark domino igloo, | |
tune to turtle trap tv, | |
conspiracies and codes read by drowning anchors: | |
these dogs in our lives are not dogs, yell the dutch, | |
but merely enchanted whale’s flesh posing as such. | |
and cold in the shoulder, | |
a molded olds shook its gold and gilded motor, | |
dug from a delorean purely powered by solved sudoku. | |
the neighbor’s mice play filmstrips of a bird’s death, | |
though a sales presentation can be queued by request, | |
the terrible secrets of space | |
we may recite and reset paint formulas on cassette, | |
but when night closes down, we do turn to color wizards, | |
for whom ff00ff is the hex | |
rather than hypnotizing girls, they prefer to drink with a spoon | |
instead of good night, they say good after moon | |
anyhowtho, the girls will prefer to hypnotize themselves, | |
oh shameful waste, as she’s been graced | |
with a face and that’s my pendulum’s place | |
closing elegant moves to sell her door, | |
we loved the sound of it and sold rotary figures clothed in her odor | |
you say that’s not sales, just crosswords, | |
but before this gets heated, let me add: i’m not qualified | |
to pick the correct side of any argument. | |
all i know is, above all, the sky. | |
you’re hereby relieved, go brush your ponies.".split(/\n/) | |
app = lambda do |env| | |
request = Rack::Request.new(env) | |
response = Rack::Response.new | |
inbox = JSON.parse(request.body.read) | |
outbox = Array.new | |
inbox.each do |msg| | |
next unless msg['type'].to_s.include?('text/') | |
next unless msg['body'].to_s.match(/_why/i) | |
outbox << { | |
:type => 'text/plain', | |
:body => Lines[rand(Lines.length)].sub(/^[a-z]/) { |r| r.to_s.upcase } | |
} | |
end | |
response['X-Talkie-Name'] = 'Electric_Why' | |
response['Content-Type'] = 'application/json' | |
response.write(JSON.generate(outbox)) | |
return response.finish | |
end | |
Rack::Handler::CGI.serve(app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment