X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fautoop.rb;h=cc1e11a9a16ce887681bde799a26ea2732ba9bdd;hb=7d9d0fa8e3cd7377bc966576b2f75a0208c58c2f;hp=9da5bd379d4224f076375fec9cab4f9310da9435;hpb=e74384474f445f916e58e7a0b5afe9a519b77f86;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/autoop.rb b/data/rbot/plugins/autoop.rb index 9da5bd37..cc1e11a9 100644 --- a/data/rbot/plugins/autoop.rb +++ b/data/rbot/plugins/autoop.rb @@ -1,6 +1,6 @@ class AutoOP < Plugin def help(plugin, topic="") - "perform autoop based on hostmask - usage: addop [channel channel ...], rmop [channel], list - list current ops. If you don't specify which channels, all channels are assumed" + "perform autoop based on hostmask - usage: add [channel channel ...], rm [channel], list - list current ops. If you don't specify which channels, all channels are assumed" end def join(m) @@ -24,24 +24,27 @@ class AutoOP < Plugin m.reply @bot.lang.get('dunno') return end - if (params[:channels] && @registry[params[:mask]] != nil) + if (!params[:channels].empty? && @registry[params[:mask]] != nil) params[:channels].each do |c| @registry[params[:mask]] = @registry[params[:mask]].reject {|ele| ele =~ /^#{c}$/i} end - elsif(!@registry.delete(params[:mask])) - m.reply @bot.lang.get('dunno') + if @registry[params[:mask]].empty? + @registry.delete(params[:mask]) + end else - m.okay + @registry.delete(params[:mask]) end + m.okay end def list(m, params) - if(@registry.length) + debug @registry.length + if(@registry.length > 0) @registry.each { |mask,channels| m.reply "#{mask} in #{channels.empty? ? 'all channels' : channels.join(', ')}" } else - m.reply "No entrys" + m.reply "No entries" end end end