From 414734f9872b1d60d2c92951965c0aba0cdf5884 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 2 Sep 2007 07:16:17 +0000 Subject: [PATCH] + ctcp_listen plugin delegate --- lib/rbot/ircbot.rb | 8 +++++++- lib/rbot/plugins.rb | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index fd346670..f1f39f30 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -1,3 +1,8 @@ +#-- vim:sw=2:et +#++ +# +# :title: rbot core + require 'thread' require 'etc' @@ -539,8 +544,9 @@ class Bot unless ignored @plugins.delegate "listen", m + @plugins.delegate("ctcp_listen", m) if m.ctcp @plugins.privmsg(m) if m.address? - if not m.replied + if not m.replied @plugins.delegate "unreplied", m end end diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 99ae31b6..061c6a73 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -1,3 +1,8 @@ +#-- vim:sw=2:et +#++ +# +# :title: rbot plugin management + require 'singleton' module Irc @@ -60,6 +65,13 @@ module Plugins QuitMessage, PartMessage, JoinMessage, NickMessage, etc. + ctcp_listen(UserMessage):: + Called for all messages that contain a CTCP command. + Use message.ctcp to get the CTCP command, and + message.message to get the parameter string. To reply, + use message.ctcp_reply, which sends a private NOTICE + to the sender. + privmsg(PrivMessage):: Called for a PRIVMSG if the first word matches one the plugin register()d for. Use m.plugin to get -- 2.32.0.93.g670b81a890