From 463627505d21d4066a93190def1921f14aacf11b Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 26 Jul 2007 11:11:17 +0000 Subject: Channel methods to check for user modes, with quickies to check for op and voice --- lib/rbot/irc.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 89bf5521..206cc98f 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -1336,6 +1336,21 @@ module Irc @mode[sym.to_sym] = kl.new(self) end + def modes_of(user) + l = [] + @mode.map { |s, m| + l << s if (m.class <= UserMode and m.list[user]) + } + l + end + + def has_op?(user) + @mode.has_key?(:o) and @mode[:o].list[user] + end + + def has_voice?(user) + @mode.has_key?(:v) and @mode[:v].list[user] + end end -- cgit v1.2.3