Sha256: 8ff0a310ad1807611a06dd877e0ea3917a5cfab13a70fe9ce0155c41b4bda1eb

Contents?: true

Size: 664 Bytes

Versions: 5

Compression:

Stored size: 664 Bytes

Contents

require 'twss'

# A simple plugin that feeds everything said in the room through the
# twss gem. Requires the 'twss' gem, obviously.
class Robut::Plugin::TWSS
  include Robut::Plugin

  # Returns a description of how to use this plugin
  def usage
    "<words> - responds with \"That's what she said!\" if #{nick} thinks <words> is a valid TWSS"
  end

  # Responds "That's what she said!" if the TWSS gem returns true for
  # +message+. Strips out any reference to our nick in +message+
  # before it stuffs +message+ into the gem.
  def handle(time, sender_nick, message)
    reply("That's what she said!") if ::TWSS.classify(words(message).join(" "))
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
robut-0.5.2 lib/robut/plugin/twss.rb
robut-0.5.1 lib/robut/plugin/twss.rb
robut-0.5.0 lib/robut/plugin/twss.rb
robut-0.4.0 lib/robut/plugin/twss.rb
robut-0.3.0 lib/robut/plugin/twss.rb