Class: DebugPlugin

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

Overview

Toggle debug mode

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



20
21
22
# File 'lib/campfire/polling_bot/plugins/debug/debug_plugin.rb', line 20

def help
  [['<enable|disable> debugging', "enable or disable debug mode"]]
end

#process(message) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/campfire/polling_bot/plugins/debug/debug_plugin.rb', line 6

def process(message)
  case message.command
  when /(enable|disable) debug/i
    if $1 == 'enable'
      bot.debug = true
    else
      bot.debug = false
    end
    bot.say("ok, debugging is #{bot.debug ? 'enabled' : 'disabled'}")
    return HALT
  end
end