Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding DOUBLE ALL THE Ys and commenting on matcher parts

  • Loading branch information...
commit 0d470497c7d42b6dd78f9483cab3dfb860bc2c93 1 parent bbce5cd
Mike Połtyn authored
Showing with 11 additions and 4 deletions.
  1. +1 −1  README.md
  2. +10 −3 yuno.rb
View
2  README.md
@@ -39,7 +39,7 @@ If you want to use a stock Yuno described here, you can fill the URL for skill w
The regex invoking the bot is:
- ^(NOT SURE IF|YO DAWG|)(.*)((Y U NO|BUT WHEN I DO|ALL THE|OR|SO|YO DAWG) (.+)| ON THE MOO+N| HAS BEEN DOUBLED)$
+ ^(NOT SURE IF|YO DAWG|)(.*)((DOUBLE THE|Y U NO|BUT WHEN I DO| OR|ALL THE|SO|YO DAWG) (.+)| ON THE MOO+N| HAS BEEN DOUBLED)$
License
-------
View
13 yuno.rb
@@ -5,7 +5,7 @@ class Yuno < AwesomeBotFactory::Skill
c.details = ""
c.author = "holek"
c.url = "http://abf-yuno.herokuapp.com/yuno"
- c.regex = "^(NOT SURE IF|YO DAWG|)(.*)((DOUBLE THE|Y U NO|BUT WHEN I DO|ALL THE|OR|SO|YO DAWG) (.+)| ON THE MOO+N| HAS BEEN DOUBLED)$"
+ c.regex = "^(NOT SURE IF|YO DAWG|)(.*)((DOUBLE THE|Y U NO|BUT WHEN I DO| OR|ALL THE|SO|YO DAWG) (.+)| ON THE MOO+N| HAS BEEN DOUBLED)$"
end
matches :prepend, :text_1, :text_rest, :action, :text_2
@@ -20,25 +20,32 @@ def reply
image = "http://memecaptain.com/i?u=http%3A%2F%2F2.bp.blogspot.com%2F-VdG-cMb7IBo%2FTb3aSReMhVI%2FAAAAAAAAAHY%2F0i-RZfYYRkY%2Fs1600%2FXzibit.png&tt=#{URI.encode_www_form_component("#{self.prepend} #{self.text_1}")}&tb=#{URI.encode_www_form_component("#{self.action} #{self.text_2}")}"
else
case self.action
- # Y U NO/BUT WHEN I DO
+ # My Little Pony Princess Luna gag
when "DOUBLE THE"
image = "http://memecaptain.com/i?u=https%3A%2F%2Fimg.skitch.com%2F20120222-jfx4k9ydn7xum58wwuea85k9r6.png"
image << "&tb=#{URI.encode_www_form_component(self.body)}"
+ # Y U NO rage guy
when "Y U NO"
image = "http://memecaptain.com/i?u=http%3A%2F%2Fmemecaptain.com%2Fy_u_no.jpg"
image << "&tt=#{URI.encode_www_form_component(self.text_1)}" unless self.text_1.empty?
image << "&tb=#{URI.encode_www_form_component("#{self.action} #{self.text_2}")}"
+ # The Most Interesting Man
when "BUT WHEN I DO"
image = "http://memecaptain.com/i?u=http%3A%2F%2Fmemecaptain.com%2Fmost_interesting.jpg"
image << "&tt=#{URI.encode_www_form_component(self.text_1)}" unless self.text_1.empty?
image << "&tb=#{URI.encode_www_form_component("#{self.action} #{self.text_2}")}"
+ # X all the Y
+ # (including Princess Luna DOUBLE ALL THE Y's)
when "ALL THE"
- if self.text_2[-1,1] == '?'
+ if /DOUBLE/.match(self.text_1)
+ image_url = "https%3A%2F%2Fimg.skitch.com%2F20120327-qsp9h5rwsnfcgqsim38muffxgw.png"
+ elsif self.text_2[-1,1] == '?'
image_url = "http%3A%2F%2Fmemecaptain.com%2Fall_the_things2.jpg"
else
image_url = "http%3A%2F%2Fmemecaptain.com%2Fall_the_things.jpg"
end
image = "http://memecaptain.com/i?u=#{image_url}&tt=#{URI.encode_www_form_component(self.body)}"
+ # Xzibit
when "YO DAWG"
if self.text_1.empty? # There should be nothing before "YO DAWG"
image = "http://memecaptain.com/i?u=http%3A%2F%2F2.bp.blogspot.com%2F-VdG-cMb7IBo%2FTb3aSReMhVI%2FAAAAAAAAAHY%2F0i-RZfYYRkY%2Fs1600%2FXzibit.png&tb=#{URI.encode_www_form_component(self.body)}"
Please sign in to comment.
Something went wrong with that request. Please try again.