diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-18 09:14:34 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-02-18 09:14:34 +0000 |
commit | ebc294a867a29ae3f712677a5e155537600b7c5f (patch) | |
tree | bdcad0f1ca14758082db9fc7b4619976bc473d8b | |
parent | 238188cfd7621a4b95ab8095fd27db7cda7fb263 (diff) |
basics: respond to public pings too (i.e. to /ping lib/rbot/rfc2812.rbchannel)
-rw-r--r-- | lib/rbot/core/basics.rb | 13 |
1 files 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
|