diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-11 14:52:05 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-11 14:52:05 +0000 |
commit | 471fffa8a1c23d7fc5f64fe3c1bd0306d27632c3 (patch) | |
tree | a10fc776692a671460d737c39c58878214c51c9c /lib | |
parent | 386274dd8f83d4aac27e837f1dca11f0f9250ee8 (diff) |
Minor messagemapper optimizations
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/botuser.rb | 10 | ||||
-rw-r--r-- | lib/rbot/messagemapper.rb | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb index 41fca6cf..52b83151 100644 --- a/lib/rbot/botuser.rb +++ b/lib/rbot/botuser.rb @@ -101,6 +101,16 @@ class String end
+class Symbol
+
+ # Returns an Irc::Auth::Comand from the receiver
+ def to_irc_auth_command
+ Irc::Auth::Command.new(self)
+ end
+
+end
+
+
module Irc
diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index 39b258e3..e009f030 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -47,7 +47,7 @@ module Irc def initialize(parent) @parent = parent @templates = Array.new - @fallback = 'usage' + @fallback = :usage end # args:: hash format containing arguments for this template @@ -162,7 +162,7 @@ module Irc debug "#{f.inspect} => #{r}" } debug "no handler found, trying fallback" - if @fallback != nil && @parent.respond_to?(@fallback) + if @fallback && @parent.respond_to?(@fallback) if m.bot.auth.allow?(@fallback, m.source, m.replyto) @parent.send(@fallback, m, {}) return true |