blob: 6ebbc603504e6e61d7ec7e1fee37a7cf292b9011 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)
|