diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-02 07:16:17 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-02 07:16:17 +0000 |
commit | 414734f9872b1d60d2c92951965c0aba0cdf5884 (patch) | |
tree | 793e0decdc769d9c9e1f792c2b91078b8c44f4a8 /lib | |
parent | 4fc1ba54e78e689b25633dbb1c76b594c3b8e6e5 (diff) |
+ ctcp_listen plugin delegate
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/ircbot.rb | 8 | ||||
-rw-r--r-- | lib/rbot/plugins.rb | 12 |
2 files changed, 19 insertions, 1 deletions
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 |