Class: TimePlugin

Inherits:
Campfire::PollingBot::Plugin show all
Defined in:
lib/campfire/polling_bot/plugins/time/time_plugin.rb

Overview

Simple sample plugin to just give the current time

Constant Summary

Constants inherited from Campfire::PollingBot::Plugin

Campfire::PollingBot::Plugin::HALT

Instance Attribute Summary

Attributes inherited from Campfire::PollingBot::Plugin

#bot, #config

Instance Method Summary collapse

Methods inherited from Campfire::PollingBot::Plugin

accepts, #accepts?, accepts?, bot, bot=, directory, directory=, inherited, #initialize, load_all, load_plugin_classes, #logger, logger, priority, #priority, requires_config, requires_config?, #requires_config?, setup_database, subclasses, #to_s

Constructor Details

This class inherits a constructor from Campfire::PollingBot::Plugin

Instance Method Details

#helpObject

return array of available commands and descriptions



14
15
16
# File 'lib/campfire/polling_bot/plugins/time/time_plugin.rb', line 14

def help
  [['time', "say the current time"]]
end

#process(message) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/campfire/polling_bot/plugins/time/time_plugin.rb', line 5

def process(message)
  case message.command
  when /time/i
    bot.say("#{message.person}, the time is #{Time.now}")
    return HALT
  end
end