Class: BookmarkPlugin
- Inherits:
-
Campfire::PollingBot::Plugin
- Object
- Campfire::PollingBot::Plugin
- BookmarkPlugin
- Defined in:
- lib/campfire/polling_bot/plugins/bookmark/bookmark_plugin.rb
Overview
Plugin to allow saving of transcript bookmarks
Constant Summary
Constants inherited from Campfire::PollingBot::Plugin
Campfire::PollingBot::Plugin::HALT
Instance Attribute Summary
Attributes inherited from Campfire::PollingBot::Plugin
Instance Method Summary collapse
-
#help ⇒ Object
return array of available commands and descriptions.
- #process(message) ⇒ Object
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
#help ⇒ Object
return array of available commands and descriptions
25 26 27 |
# File 'lib/campfire/polling_bot/plugins/bookmark/bookmark_plugin.rb', line 25 def help [["bookmark: <name>", "bookmark the current location"]] end |
#process(message) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/campfire/polling_bot/plugins/bookmark/bookmark_plugin.rb', line 5 def process() case .command when /^(?:add |create )?bookmark:?\s*(?:this as:?)?\s*("?)(.*?)\1$/i save_bookmark(, $2) bot.say("Ok, saved bookmark: #{$2}") return HALT when /(?:list|show) (\S+) bookmarks/i, /(?:list|show) bookmarks for (\S+)/i list_bookmarks(.person, $1) return HALT when /(list|show) bookmarks$/ list_bookmarks(.person, .person) return HALT when /delete bookmark (?:#\s*)?(\d+)/ delete_bookmark(.person, $1.to_i) return HALT end end |