From a860467ad40fad37f9fc886ea1a1d1f95a3bd2d7 Mon Sep 17 00:00:00 2001 From: Dmitry Kim Date: Fri, 21 Sep 2007 11:07:52 +0000 Subject: + (core/auth) "!who is :user" syntax --- lib/rbot/core/auth.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'lib/rbot') diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb index c6c55aff..59bcd54a 100644 --- a/lib/rbot/core/auth.rb +++ b/lib/rbot/core/auth.rb @@ -238,10 +238,6 @@ class AuthModule < CoreBotModule end def auth_whoami(m, params) - rep = "" - # if m.public? - # rep << m.source.nick << ", " - # end m.reply _("you are %{who}") % { :who => get_botusername_for(m.source).gsub( /^everyone$/, _("no one that I know")).gsub( @@ -249,6 +245,19 @@ class AuthModule < CoreBotModule } end + def auth_whois(m, params) + return auth_whoami(m, params) if !m.public? + u = m.channel.users[params[:user]] + + return m.reply "I don't see anyone named '#{params[:user]}' here" unless u + + m.reply _("#{params[:user]} is %{who}") % { + :who => get_botusername_for(u).gsub( + /^everyone$/, _("no one that I know")).gsub( + /^owner$/, _("my boss")) + } + end + def help(cmd, topic="") case cmd when "login" @@ -836,6 +845,10 @@ auth.map "whoami", :action => 'auth_whoami', :auth_path => '!*!' +auth.map "who is :user", + :action => 'auth_whois', + :auth_path => '!*!' + auth.map "auth :password", :action => 'auth_auth', :public => false, -- cgit v1.2.3