Class: Robut::Presence
- Inherits:
-
Object
- Object
- Robut::Presence
- Defined in:
- lib/robut/presence.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
The Robut::Connection that has all the connection info.
Instance Method Summary collapse
-
#handle_message(plugins, time, nick, message, room_name = nil) ⇒ Object
Sends the chat message
messagethroughplugins. -
#initialize(connection) ⇒ Presence
constructor
A new instance of Presence.
Constructor Details
#initialize(connection) ⇒ Presence
Returns a new instance of Presence.
8 9 10 |
# File 'lib/robut/presence.rb', line 8 def initialize(connection) self.connection = connection end |
Instance Attribute Details
#connection ⇒ Object
The Robut::Connection that has all the connection info.
6 7 8 |
# File 'lib/robut/presence.rb', line 6 def connection @connection end |
Instance Method Details
#handle_message(plugins, time, nick, message, room_name = nil) ⇒ Object
Sends the chat message message through plugins.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/robut/presence.rb', line 13 def (plugins, time, nick, , room_name=nil) # ignore all messages sent by robut. If you really want robut to # reply to itself, you can use +fake_message+. return if nick == connection.config.nick time = Time.now return if time < (STARTED + 10) plugins.each do |plugin| begin rsp = plugin.handle(room_name, nick, ) break if rsp == true rescue => e error = "UH OH! #{plugin.class.name} just crashed!" if nick reply(error, nick) # Connection#reply else reply(error) # Room#reply end if connection.config.logger connection.config.logger.error e connection.config.logger.error e.backtrace.join("\n") end end end end |