diff options
-rw-r--r-- | data/rbot/plugins/op.rb | 38 | ||||
-rw-r--r-- | data/rbot/plugins/opme.rb | 25 |
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) |