From: Giuseppe Bilotta Date: Sat, 12 Apr 2008 22:03:47 +0000 (+0200) Subject: + MotdMessage class X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=1f7b45bcfa05821884ba47d4e42608c8f9b5a6b1;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git + MotdMessage class --- diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 12f08789..3d20b71d 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -586,9 +586,11 @@ class Bot @plugins.delegate "notice", message } @client[:motd] = proc { |data| + m = MotdMessage.new(self, server, data[:source], data[:target], data[:motd]) data[:motd].each_line { |line| irclog "MOTD: #{line}", "server" } + @plugins.delegate "motd", m } @client[:nicktaken] = proc { |data| new = "#{data[:nick]}_" diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index d923fd8e..616bef28 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -219,6 +219,11 @@ module Irc class WelcomeMessage < BasicUserMessage end + # class for handling MOTD from the server. Yes, MotdMessage + # is somewhat redundant, but it fits with the naming scheme + class MotdMessage < BasicUserMessage + end + # class for handling IRC user messages. Includes some utilities for handling # the message, for example in plugins. # The +message+ member will have any bot addressing "^bot: " removed diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index ebefa3b6..631984c1 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -126,6 +126,10 @@ module Plugins Called when the welcome message is received on joining a server succesfully. + motd(MotdMessage):: + Called when the Message Of The Day is fully + recevied from the server. + connect:: Called when a server is joined successfully, but before autojoin channels are joined (no params)