diff options
-rw-r--r-- | bocelli/base.rb | 2 | ||||
-rw-r--r-- | example.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/bocelli/base.rb b/bocelli/base.rb index bea8959..e4998c1 100644 --- a/bocelli/base.rb +++ b/bocelli/base.rb @@ -53,7 +53,7 @@ module Bocelli end def process(str) - if str =~ /\A(\S+) PRIVMSG (\S+) :?(.*)/ + if str =~ /\A:?(\S+) PRIVMSG (\S+) :?(.*)/ metadata = { user: $1, channel: $2, @@ -35,6 +35,10 @@ class TestBot < Bocelli::Base on 'current' do out '%s %s' % [@bocelli[:str].inspect, @bocelli[:route].inspect] end + + on 'user' do + out @bocelli[:metadata][:user] + end end TestBot.configure('chat.freenode.net', 6667, 'bocelli%03d' % rand(1000)) |