diff options
-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 |