From ebc294a867a29ae3f712677a5e155537600b7c5f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 18 Feb 2007 09:14:34 +0000 Subject: basics: respond to public pings too (i.e. to /ping lib/rbot/rfc2812.rbchannel) --- lib/rbot/core/basics.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/rbot/core/basics.rb b/lib/rbot/core/basics.rb index 38c96b23..5c5bcdee 100644 --- a/lib/rbot/core/basics.rb +++ b/lib/rbot/core/basics.rb @@ -6,10 +6,15 @@ class BasicsModule < CoreBotModule def listen(m) return unless m.kind_of?(PrivMessage) - if(m.private? && m.message =~ /^\001PING\s+(.+)\001/) - @bot.notice m.sourcenick, "\001PING #$1\001" - @bot.irclog "@ #{m.sourcenick} pinged me" - return + if m.message =~ /^\001PING\s+(.+)\001/ + ping_id = $1 + if m.private? + @bot.notice m.source, "\001PING #{ping_id}\001" + @bot.irclog "@ #{m.source} pinged me" + else + @bot.notice m.source, "\001PING #{ping_id}\001" + @bot.irclog "@ #{m.source} pinged #{m.target}" + end end end -- cgit v1.2.3