class Lita::Handlers::Whatthecommit
Public Instance Methods
arbitraryComment(response, num)
click to toggle source
# File lib/lita/handlers/whatthecommit.rb, line 52 def arbitraryComment(response, num) case num when 0 response.reply("You should really thing of something more clever...") when 1 response.reply("Oh no, what have I done?") when 2 response.reply("I think this is how Skynet started.") when 3 response.reply("You might want to add a NSFW tag to that one") end end
getCommit(response)
click to toggle source
# File lib/lita/handlers/whatthecommit.rb, line 15 def getCommit(response) name = getName(response.user.name) case rand(6) when 0 response.reply("How about this #{name}?") when 1 response.reply("This ought to do the trick") when 2 response.reply("Really #{name}? Alright, use this") when 3 response.reply("The laziness you extrude to us all astounds me, #{name}") when 4 response.reply("OK then...") when 5 response.reply("OK, but this is the last time") end http_response = http.get("http://whatthecommit.com/index.txt") commit = http_response.body response.reply(">>>git commit -m '#{commit.gsub("\n","")}'") if commit.include? "fuck" or commit.include? "crap" or commit.include? "shit" arbitraryComment(response, 3) #else #arbitraryComment(response, rand(3)) end end
getName(username)
click to toggle source
# File lib/lita/handlers/whatthecommit.rb, line 7 def getName(username) if redis.get(username) then requestedName = redis.get(username) else requestedName = username end end
reply_target(message:)
click to toggle source
# File lib/lita/handlers/whatthecommit.rb, line 44 def reply_target(message:) if message.source.private_message Source.new(user: message.user, private_message: true) else Source.new(room: message.source.room) end end