From e00ea339ca3baaa9cfe74f6cec85c36e83307b61 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 7 Apr 2008 01:02:13 +0200 Subject: + use the message() delegate instead of listen() when possible --- data/rbot/plugins/games/azgame.rb | 3 +-- data/rbot/plugins/games/quiz.rb | 4 +--- data/rbot/plugins/games/shiritori.rb | 3 +-- data/rbot/plugins/games/wheelfortune.rb | 4 ++-- 4 files changed, 5 insertions(+), 9 deletions(-) (limited to 'data/rbot/plugins/games') diff --git a/data/rbot/plugins/games/azgame.rb b/data/rbot/plugins/games/azgame.rb index b1bb09e5..4f60278f 100644 --- a/data/rbot/plugins/games/azgame.rb +++ b/data/rbot/plugins/games/azgame.rb @@ -144,8 +144,7 @@ class AzGamePlugin < Plugin @registry[:wordcache] = @wordcache end - def listen(m) - return unless m.kind_of?(PrivMessage) + def message(m) return if m.channel.nil? or m.address? k = m.channel.downcase.to_s # to_sym? return unless @games.key?(k) diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index 792b75ae..a9ceddaf 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -360,9 +360,7 @@ class QuizPlugin < Plugin # Reimplemented from Plugin # - def listen( m ) - return unless m.kind_of?(PrivMessage) - + def message(m) chan = m.channel return unless @quizzes.has_key?( chan ) q = @quizzes[chan] diff --git a/data/rbot/plugins/games/shiritori.rb b/data/rbot/plugins/games/shiritori.rb index 71016e54..84ee9620 100644 --- a/data/rbot/plugins/games/shiritori.rb +++ b/data/rbot/plugins/games/shiritori.rb @@ -453,8 +453,7 @@ class ShiritoriPlugin < Plugin end # all messages from a channel is sent to its shiritori game if any - def listen(m) - return unless m.kind_of?(PrivMessage) + def message(m) return unless @games.has_key?(m.channel) # send the message to the game in the channel to handle it @games[m.channel].handle_message m diff --git a/data/rbot/plugins/games/wheelfortune.rb b/data/rbot/plugins/games/wheelfortune.rb index 37eb63b5..cc9a1446 100644 --- a/data/rbot/plugins/games/wheelfortune.rb +++ b/data/rbot/plugins/games/wheelfortune.rb @@ -506,8 +506,8 @@ class WheelOfFortune < Plugin end end - def listen(m) - return unless m.kind_of?(PrivMessage) and not m.address? + def message(m) + return if m.address? ch = m.channel.irc_downcase(m.server.casemap).intern return unless game = @games[ch] return unless game.running? -- cgit v1.2.3