Class: ModSpox::Plugin
- Inherits:
-
Object
- Object
- ModSpox::Plugin
- Defined in:
- lib/mod_spox/Plugin.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
Called before the object is destroyed by the ModSpox::PluginManager.
-
#initialize(pipeline) ⇒ Plugin
constructor
A new instance of Plugin.
-
#me ⇒ Object
Returns the nick model of the bot.
-
#name ⇒ Object
Returns the name of the class.
-
#reply(target, message) ⇒ Object
- target
- target for message message
-
string message This is a helper method that will send an outgoing Privmsg to the given target.
Constructor Details
#initialize(pipeline) ⇒ Plugin
Returns a new instance of Plugin.
6 7 8 9 10 |
# File 'lib/mod_spox/Plugin.rb', line 6 def initialize(pipeline) raise Exceptions::BotException.new('Plugin creation failed to supply message pipeline') unless pipeline.is_a?(Pipeline) @pipeline = pipeline @pipeline.hook_plugin(self) end |
Instance Method Details
#destroy ⇒ Object
Called before the object is destroyed by the ModSpox::PluginManager
13 14 15 |
# File 'lib/mod_spox/Plugin.rb', line 13 def destroy Logger.log("Destroy method for plugin #{name} has not been defined.", 15) end |
#me ⇒ Object
Returns the nick model of the bot
31 32 33 34 35 36 37 38 |
# File 'lib/mod_spox/Plugin.rb', line 31 def me nick = Models::Nick.filter(:botnick => true).first if(nick) return nick else raise Exception.new("Fatal Error: I don't know who I am.") end end |
#name ⇒ Object
Returns the name of the class
18 19 20 |
# File 'lib/mod_spox/Plugin.rb', line 18 def name self.class.name.to_s.gsub(/^.+:/, '') end |