summaryrefslogtreecommitdiff
path: root/lib/rbot/core/basics.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot/core/basics.rb')
-rw-r--r--lib/rbot/core/basics.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/rbot/core/basics.rb b/lib/rbot/core/basics.rb
index 44b800f5..2fbafaf7 100644
--- a/lib/rbot/core/basics.rb
+++ b/lib/rbot/core/basics.rb
@@ -9,15 +9,15 @@
class BasicsModule < CoreBotModule
- def listen(m)
- return unless m.kind_of?(PrivMessage)
- if m.ctcp == 'PING'
- m.ctcp_reply m.ctcp, m.message
- if m.private?
- @bot.irclog "@ #{m.source} pinged me"
- else
- @bot.irclog "@ #{m.source} pinged #{m.target}"
- end
+ def ctcp_listen(m)
+ who = m.private? ? "me" : m.target
+ case m.ctcp.intern
+ when :PING
+ m.ctcp_reply m.message
+ @bot.irclog "@ #{m.source} pinged #{who}"
+ when :TIME
+ m.ctcp_reply Time.now.to_s
+ @bot.irclog "@ #{m.source} asked #{who} what time it is"
end
end