]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - data/rbot/plugins/op.rb
Two plugins had the executable property set. Reset it
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / op.rb
1 class OpPlugin < Plugin
2
3   def help(plugin, topic="")
4     return "op [<user>] [<channel>] => grant <user> (if ommitted yourself) ops in <channel> (or in the current channel if no channel is specified)"
5   end
6
7   def op(m, params)
8     channel = params[:channel]
9     user = params[:user]
10     unless channel
11       if m.private?
12         target = user.nil? ? "you" : user 
13         m.reply "You should tell me where you want me to op #{target}."
14         return
15       else
16         channel = m.channel.to_s
17       end
18     end
19     unless user
20       user = m.sourcenick
21     end
22
23     m.okay unless channel == m.channel.to_s
24     @bot.sendq("MODE #{channel} +o #{user}")
25   end
26
27   def opme(m, params)
28     params[:user] = m.sourcenick
29     op(m, params)
30   end
31
32 end
33
34 plugin = OpPlugin.new
35 plugin.map("op [:user] [:channel]")
36 plugin.map("opme [:channel]") # For backwards compatibility with 0.9.10
37 plugin.default_auth("*",false)
38