Sha256: ce4eba28d85b67b10c3379ad414c706228225693cd8c0efbaae9cf8ec9d9d5fd

Contents?: true

Size: 542 Bytes

Versions: 11

Compression:

Stored size: 542 Bytes

Contents

# This is a simple plugin the envokes the "say" command on whatever is passed
# Example:
#
#    @robut say that was awesome!
#
# *Requires that the "say" command is installed and in the path
#
class Robut::Plugin::Say
  include Robut::Plugin

  desc "say <words> - uses Mac OS X's 'say' command to speak <words>"
  match "^say (.*)$", :sent_to_me => true do |phrase|
    phrase = clean(phrase)
    system("say #{phrase}")
  end

  private

  def clean(str)
    str.gsub("'", "").gsub(/[^A-Za-z0-9\s]+/, " ").gsub(/\s+/, ' ').strip
  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
sclemmer-robut-0.6.3 lib/robut/plugin/say.rb
sclemmer-robut-0.6.2 lib/robut/plugin/say.rb
sclemmer-robut-0.6.1 lib/robut/plugin/say.rb
sclemmer-robut-0.6.0 lib/robut/plugin/say.rb
sclemmer-robut-0.5.4 lib/robut/plugin/say.rb
sclemmer-robut-0.5.3 lib/robut/plugin/say.rb
sclemmer-robut-0.5.2 lib/robut/plugin/say.rb
robut-0.5.2 lib/robut/plugin/say.rb
robut-0.5.1 lib/robut/plugin/say.rb
robut-0.5.0 lib/robut/plugin/say.rb
robut-0.4.0 lib/robut/plugin/say.rb