1 class ModesPlugin < Plugin
3 def help(plugin, topic="")
4 return "'op [<user>] [<channel>]' => grant user> (if ommitted yourself) ops in <channel> (or in the current channel if no channel is specified). Use deop instead of op to remove the privilege."
8 channel = params[:channel]
10 do_mode(m, channel, user, "+o")
14 params[:user] = m.sourcenick
19 channel = params[:channel]
21 do_mode(m, channel, user, "-o")
25 params[:user] = m.sourcenick
30 channel = params[:channel]
32 do_mode(m, channel, user, "+h")
36 params[:user] = m.sourcenick
41 channel = params[:channel]
43 do_mode(m, channel, user, "-h")
46 def dehopme(m, params)
47 params[:user] = m.sourcenick
52 channel = params[:channel]
54 do_mode(m, channel, user, "+v")
57 def voiceme(m, params)
58 params[:user] = m.sourcenick
62 def devoice(m, params)
63 channel = params[:channel]
65 do_mode(m, channel, user, "-v")
68 def devoiceme(m, params)
69 params[:user] = m.sourcenick
73 def do_mode(m, channel, user, mode)
76 target = user.nil? ? "you" : user
77 m.reply "You should tell me where you want me to #{mode} #{target}."
83 channel = m.server.channel(channel)
85 unless channel.has_user?(@bot.nick)
86 m.reply "I am not in that channel"
95 m.okay unless channel == m.channel.to_s
96 @bot.mode(channel, mode, user)
100 plugin = ModesPlugin.new
101 plugin.map("op [:user] [:channel]")
102 plugin.map("opme [:channel]") # For backwards compatibility with 0.9.10
103 plugin.map("deop [:user] [:channel]")
104 plugin.map("deopme [:channel]") # For backwards compatibility with 0.9.10
105 plugin.map("hop [:user] [:channel]")
106 plugin.map("hopme [:channel]")
107 plugin.map("dehop [:user] [:channel]")
108 plugin.map("dehopme [:channel]")
109 plugin.map("voice [:user] [:channel]")
110 plugin.map("voiceme [:channel]")
111 plugin.map("devoice [:user] [:channel]")
112 plugin.map("devoiceme [:channel]")
113 plugin.default_auth("*",false)