From fee27a0274be28bf32129ed922c80d0a0993cc9a Mon Sep 17 00:00:00 2001 From: Mark Kretschmann Date: Tue, 10 Oct 2006 18:26:02 +0000 Subject: 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. --- data/rbot/plugins/op.rb | 38 ++++++++++++++++++++++++++++++++++++++ data/rbot/plugins/opme.rb | 25 ------------------------- 2 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 data/rbot/plugins/op.rb delete mode 100644 data/rbot/plugins/opme.rb 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 [] [] => grant (if ommitted yourself) ops in (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 [] => grant user ops in (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) -- cgit v1.2.3