From 08b62fa4b33ef08ddc2a98651438546529b6c449 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 29 Jul 2007 11:08:32 +0000 Subject: User mode-checking methods now accept channel names and will try to resolve the corresponding Channel automatically --- lib/rbot/irc.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 38c4a3e9..0edfb35a 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -971,15 +971,33 @@ module Irc end def modes_on(channel) - channel.modes_of(self) + case channel + when Channel + channel.modes_of(self) + else + return @server.channel(channel).modes_of(self) if @server + raise "Can't resolve channel #{channel}" + end end def is_op?(channel) - channel.has_op?(self) + case channel + when Channel + channel.has_op?(self) + else + return @server.channel(channel).has_op?(self) if @server + raise "Can't resolve channel #{channel}" + end end def is_voice?(channel) - channel.has_voice?(self) + case channel + when Channel + channel.has_voice?(self) + else + return @server.channel(channel).has_voice?(self) if @server + raise "Can't resolve channel #{channel}" + end end end -- cgit v1.2.3