wesabe / wesabot

Wesabe's Campfire bot framework

This URL has Read+Write access

wesabot / campfire / polling_bot / plugins / time_plugin.rb
100644 17 lines (15 sloc) 0.427 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Simple sample plugin to just give the current time
class TimePlugin < Campfire::PollingBot::Plugin
  accepts :text_message, :addressed_to_me => true
  
  def process(message)
    case message.command
    when /time/i
      bot.say("#{message.person}, the time is #{Time.now}")
      return HALT
    end
  end
 
  # return array of available commands and descriptions
  def help
    [['time', "say the current time"]]
  end
end