summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/op.rb
diff options
context:
space:
mode:
authorMark Kretschmann <markey@web.de>2006-10-10 18:26:02 +0000
committerMark Kretschmann <markey@web.de>2006-10-10 18:26:02 +0000
commitfee27a0274be28bf32129ed922c80d0a0993cc9a (patch)
tree9940199384be5debdfe986da7552e9e1744d17ca /data/rbot/plugins/op.rb
parent6cd8a9744dc12e27e97393f2f854e9ae07e9cccc (diff)
Extended the opme plugin into a more general op plugin. Functionality is the same, but you can additionally op someone else. The old opme command was also kept for backwards compatibility.
Diffstat (limited to 'data/rbot/plugins/op.rb')
-rw-r--r--data/rbot/plugins/op.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/data/rbot/plugins/op.rb b/data/rbot/plugins/op.rb
new file mode 100644
index 00000000..6ebbc603
--- /dev/null
+++ b/data/rbot/plugins/op.rb
@@ -0,0 +1,38 @@
+class OpPlugin < Plugin
+
+ def help(plugin, topic="")
+ return "op [<user>] [<channel>] => grant <user> (if ommitted yourself) ops in <channel> (or in the current channel if no channel is specified)"
+ end
+
+ def op(m, params)
+ channel = params[:channel]
+ user = params[:user]
+ unless channel
+ if m.private?
+ target = user.nil? ? "you" : user
+ m.reply "You should tell me where you want me to op #{target}."
+ return
+ else
+ channel = m.channel.to_s
+ end
+ end
+ unless user
+ user = m.sourcenick
+ end
+
+ m.okay unless channel == m.channel.to_s
+ @bot.sendq("MODE #{channel} +o #{user}")
+ end
+
+ def opme(m, params)
+ params[:user] = m.sourcenick
+ op(m, params)
+ end
+
+end
+
+plugin = OpPlugin.new
+plugin.map("op [:user] [:channel]")
+plugin.map("opme [:channel]") # For backwards compatibility with 0.9.10
+plugin.default_auth("*",false)
+