summaryrefslogtreecommitdiff
path: root/data/rbot
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
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')
-rw-r--r--data/rbot/plugins/op.rb38
-rw-r--r--data/rbot/plugins/opme.rb25
2 files changed, 38 insertions, 25 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)
+
diff --git a/data/rbot/plugins/opme.rb b/data/rbot/plugins/opme.rb
deleted file mode 100644
index 54f61b91..00000000
--- a/data/rbot/plugins/opme.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-class OpMePlugin < Plugin
-
- def help(plugin, topic="")
- return "opme [<channel>] => grant user ops in <channel> (or in the current channel if no channel is specified)"
- end
-
- def opme(m, params)
- channel = params[:chan]
- unless channel
- if m.private?
- m.reply "you should tell me where you want me to op you"
- return
- else
- channel = m.channel.to_s
- end
- end
- target = m.sourcenick
- m.okay unless channel == m.channel.to_s
- @bot.sendq("MODE #{channel} +o #{target}")
- end
-end
-
-plugin = OpMePlugin.new
-plugin.map("opme [:chan]")
-plugin.default_auth("*",false)