@@ -28,16 +28,14 @@ def default_mask(trigger):
2828
2929
3030@plugin .require_chanmsg
31- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
31+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
32+ @plugin .require_bot_privilege (plugin .OP , ERROR_MESSAGE_NOT_OP , reply = True )
3233@plugin .command ('op' )
3334def op (bot , trigger ):
3435 """
3536 Command to op users in a room. If no nick is given,
3637 Sopel will op the nick who sent the command
3738 """
38- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .OP :
39- bot .reply (ERROR_MESSAGE_NOT_OP )
40- return
4139 nick = trigger .group (2 )
4240 channel = trigger .sender
4341 if not nick :
@@ -46,16 +44,14 @@ def op(bot, trigger):
4644
4745
4846@plugin .require_chanmsg
49- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
47+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
48+ @plugin .require_bot_privilege (plugin .OP , ERROR_MESSAGE_NOT_OP , reply = True )
5049@plugin .command ('deop' )
5150def deop (bot , trigger ):
5251 """
5352 Command to deop users in a room. If no nick is given,
5453 Sopel will deop the nick who sent the command
5554 """
56- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .OP :
57- bot .reply (ERROR_MESSAGE_NOT_OP )
58- return
5955 nick = trigger .group (2 )
6056 channel = trigger .sender
6157 if not nick :
@@ -64,16 +60,14 @@ def deop(bot, trigger):
6460
6561
6662@plugin .require_chanmsg
67- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
63+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
64+ @plugin .require_bot_privilege (plugin .HALFOP , ERROR_MESSAGE_NOT_OP , reply = True )
6865@plugin .command ('voice' )
6966def voice (bot , trigger ):
7067 """
7168 Command to voice users in a room. If no nick is given,
7269 Sopel will voice the nick who sent the command
7370 """
74- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .HALFOP :
75- bot .reply (ERROR_MESSAGE_NOT_OP )
76- return
7771 nick = trigger .group (2 )
7872 channel = trigger .sender
7973 if not nick :
@@ -82,16 +76,14 @@ def voice(bot, trigger):
8276
8377
8478@plugin .require_chanmsg
85- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
79+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
80+ @plugin .require_bot_privilege (plugin .HALFOP , ERROR_MESSAGE_NOT_OP , reply = True )
8681@plugin .command ('devoice' )
8782def devoice (bot , trigger ):
8883 """
8984 Command to devoice users in a room. If no nick is given,
9085 Sopel will devoice the nick who sent the command
9186 """
92- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .HALFOP :
93- bot .reply (ERROR_MESSAGE_NOT_OP )
94- return
9587 nick = trigger .group (2 )
9688 channel = trigger .sender
9789 if not nick :
@@ -100,14 +92,12 @@ def devoice(bot, trigger):
10092
10193
10294@plugin .require_chanmsg
103- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
95+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
96+ @plugin .require_bot_privilege (plugin .HALFOP , ERROR_MESSAGE_NOT_OP , reply = True )
10497@plugin .command ('kick' )
10598@plugin .priority ('high' )
10699def kick (bot , trigger ):
107100 """Kick a user from the channel."""
108- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .HALFOP :
109- bot .reply (ERROR_MESSAGE_NOT_OP )
110- return
111101 text = trigger .group ().split ()
112102 argc = len (text )
113103 if argc < 2 :
@@ -153,17 +143,15 @@ def configureHostMask(mask):
153143
154144
155145@plugin .require_chanmsg
156- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
146+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
147+ @plugin .require_bot_privilege (plugin .HALFOP , ERROR_MESSAGE_NOT_OP , reply = True )
157148@plugin .command ('ban' )
158149@plugin .priority ('high' )
159150def ban (bot , trigger ):
160151 """Ban a user from the channel
161152
162153 The bot must be a channel operator for this command to work.
163154 """
164- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .HALFOP :
165- bot .reply (ERROR_MESSAGE_NOT_OP )
166- return
167155 text = trigger .group ().split ()
168156 argc = len (text )
169157 if argc < 2 :
@@ -183,16 +171,14 @@ def ban(bot, trigger):
183171
184172
185173@plugin .require_chanmsg
186- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
174+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
175+ @plugin .require_bot_privilege (plugin .HALFOP , ERROR_MESSAGE_NOT_OP , reply = True )
187176@plugin .command ('unban' )
188177def unban (bot , trigger ):
189178 """Unban a user from the channel
190179
191180 The bot must be a channel operator for this command to work.
192181 """
193- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .HALFOP :
194- bot .reply (ERROR_MESSAGE_NOT_OP )
195- return
196182 text = trigger .group ().split ()
197183 argc = len (text )
198184 if argc < 2 :
@@ -212,16 +198,14 @@ def unban(bot, trigger):
212198
213199
214200@plugin .require_chanmsg
215- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
201+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
202+ @plugin .require_bot_privilege (plugin .OP , ERROR_MESSAGE_NOT_OP , reply = True )
216203@plugin .command ('quiet' )
217204def quiet (bot , trigger ):
218205 """Quiet a user
219206
220207 The bot must be a channel operator for this command to work.
221208 """
222- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .OP :
223- bot .reply (ERROR_MESSAGE_NOT_OP )
224- return
225209 text = trigger .group ().split ()
226210 argc = len (text )
227211 if argc < 2 :
@@ -241,16 +225,14 @@ def quiet(bot, trigger):
241225
242226
243227@plugin .require_chanmsg
244- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
228+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
229+ @plugin .require_bot_privilege (plugin .OP , ERROR_MESSAGE_NOT_OP , reply = True )
245230@plugin .command ('unquiet' )
246231def unquiet (bot , trigger ):
247232 """Unquiet a user
248233
249234 The bot must be a channel operator for this command to work.
250235 """
251- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .OP :
252- bot .reply (ERROR_MESSAGE_NOT_OP )
253- return
254236 text = trigger .group ().split ()
255237 argc = len (text )
256238 if argc < 2 :
@@ -270,7 +252,8 @@ def unquiet(bot, trigger):
270252
271253
272254@plugin .require_chanmsg
273- @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV )
255+ @plugin .require_privilege (plugin .OP , ERROR_MESSAGE_NO_PRIV , reply = True )
256+ @plugin .require_bot_privilege (plugin .OP , ERROR_MESSAGE_NOT_OP , reply = True )
274257@plugin .command ('kickban' , 'kb' )
275258@plugin .example ('.kickban [#chan] user1 user!*@* get out of here' )
276259@plugin .priority ('high' )
@@ -279,9 +262,6 @@ def kickban(bot, trigger):
279262
280263 The bot must be a channel operator for this command to work.
281264 """
282- if bot .channels [trigger .sender ].privileges [bot .nick ] < plugin .HALFOP :
283- bot .reply (ERROR_MESSAGE_NOT_OP )
284- return
285265 text = trigger .group ().split ()
286266 argc = len (text )
287267 if argc < 4 :
0 commit comments