Class: Robut::Plugin::TWSS

Inherits:
Object
  • Object
show all
Includes:
Robut::Plugin
Defined in:
lib/robut/plugin/twss.rb

Overview

A simple plugin that feeds everything said in the room through the twss gem. Requires the ‘twss’ gem, obviously.

Instance Attribute Summary

Attributes included from Robut::Plugin

#connection, #private_sender, #reply_to

Instance Method Summary collapse

Methods included from Robut::Plugin

#at_nick, #fake_message, included, #initialize, #nick, #reply, #sent_to_me?, #store, #without_nick, #words

Instance Method Details

#handle(time, sender_nick, message) ⇒ Object

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.



16
17
18
# File 'lib/robut/plugin/twss.rb', line 16

def handle(time, sender_nick, message)
  reply("That's what she said!") if TWSSClassifier.is_twss?(words(message).join(" "))
end

#usageObject

Returns a description of how to use this plugin



9
10
11
# File 'lib/robut/plugin/twss.rb', line 9

def usage
  "<words> - responds with \"That's what she said!\" if #{nick} thinks <words> is a valid TWSS"
end