@@ -22,24 +22,26 @@ def check_for_chan_mode(char, mode_warn, event):
22
22
return False
23
23
24
24
25
- def mode_cmd (mode , text , text_inp , chan , nick , event , mode_warn = True ):
25
+ def mode_cmd (mode , action , param , event , mode_warn = True ):
26
26
"""generic mode setting function"""
27
+ chan = event .chan
28
+ nick = event .nick
27
29
if not check_for_chan_mode (mode [1 ], mode_warn , event ):
28
30
return False
29
31
30
- split = text_inp .split (" " )
32
+ split = param .split (" " )
31
33
if split [0 ].startswith ("#" ):
32
34
channel = split [0 ]
33
35
target = split [1 ]
34
36
else :
35
37
channel = chan
36
38
target = split [0 ]
37
39
38
- event .notice ("Attempting to {} {} in {}..." .format (text , target , channel ))
40
+ event .notice ("Attempting to {} {} in {}..." .format (action , target , channel ))
39
41
event .admin_log (
40
42
MODE_CMD_LOG .format (
41
43
nick = nick ,
42
- cmd = text ,
44
+ cmd = action ,
43
45
mode = mode ,
44
46
target = target ,
45
47
channel = channel ,
@@ -50,22 +52,23 @@ def mode_cmd(mode, text, text_inp, chan, nick, event, mode_warn=True):
50
52
return True
51
53
52
54
53
- def mode_cmd_no_target (mode , text , text_inp , chan , event , mode_warn = True ):
55
+ def mode_cmd_no_target (mode , action , param , event , mode_warn = True ):
54
56
"""generic mode setting function without a target"""
57
+ chan = event .chan
55
58
if not check_for_chan_mode (mode [1 ], mode_warn , event ):
56
59
return False
57
60
58
- split = text_inp .split (" " )
61
+ split = param .split (" " )
59
62
if split [0 ].startswith ("#" ):
60
63
channel = split [0 ]
61
64
else :
62
65
channel = chan
63
66
64
- event .notice ("Attempting to {} {}..." .format (text , channel ))
67
+ event .notice ("Attempting to {} {}..." .format (action , channel ))
65
68
event .admin_log (
66
69
MODE_CMD_NO_TARGET_LOG .format (
67
70
nick = event .nick ,
68
- cmd = text ,
71
+ cmd = action ,
69
72
mode = mode ,
70
73
channel = channel ,
71
74
)
@@ -74,80 +77,80 @@ def mode_cmd_no_target(mode, text, text_inp, chan, event, mode_warn=True):
74
77
return True
75
78
76
79
77
- def do_extban (char , text , text_inp , chan , nick , event , adding = True ):
80
+ def do_extban (char , action , param , event , adding = True ):
78
81
serv_info = event .conn .memory ["server_info" ]
79
82
if char not in serv_info .get ("extbans" , "" ):
80
83
return False
81
84
82
85
extban_pfx = serv_info ["extban_prefix" ]
83
86
84
- split = text_inp .split (" " )
87
+ split = param .split (" " )
85
88
if split [0 ].startswith ("#" ):
86
89
channel = split [0 ]
87
90
target = split [1 ]
88
- text_inp = "{} {}{}:{}" .format (channel , extban_pfx , char , target )
91
+ param = "{} {}{}:{}" .format (channel , extban_pfx , char , target )
89
92
else :
90
93
target = split [0 ]
91
- text_inp = "{}{}:{}" .format (extban_pfx , char , target )
94
+ param = "{}{}:{}" .format (extban_pfx , char , target )
92
95
93
- mode_cmd ("+b" if adding else "-b" , text , text_inp , chan , nick , event )
96
+ mode_cmd ("+b" if adding else "-b" , action , param , event )
94
97
return True
95
98
96
99
97
100
@hook .command (permissions = ["op_ban" , "op" , "chanop" ])
98
- def ban (text , chan , nick , event ):
101
+ def ban (text , event ):
99
102
"""[channel] <user> - bans <user> in [channel], or in the caller's channel if no channel is specified"""
100
- mode_cmd ("+b" , "ban" , text , chan , nick , event )
103
+ mode_cmd ("+b" , "ban" , text , event )
101
104
102
105
103
106
@hook .command (permissions = ["op_ban" , "op" , "chanop" ])
104
- def unban (text , chan , nick , event ):
107
+ def unban (text , event ):
105
108
"""[channel] <user> - unbans <user> in [channel], or in the caller's channel if no channel is specified"""
106
- mode_cmd ("-b" , "unban" , text , chan , nick , event )
109
+ mode_cmd ("-b" , "unban" , text , event )
107
110
108
111
109
112
@hook .command (permissions = ["op_quiet" , "op" , "chanop" ])
110
- def quiet (text , chan , nick , event ):
113
+ def quiet (text , event ):
111
114
"""[channel] <user> - quiets <user> in [channel], or in the caller's channel if no channel is specified"""
112
- if mode_cmd ("+q" , "quiet" , text , chan , nick , event , False ):
115
+ if mode_cmd ("+q" , "quiet" , text , event , False ):
113
116
return
114
117
115
- if not do_extban ("m" , "quiet" , text , chan , nick , event , True ):
118
+ if not do_extban ("m" , "quiet" , text , event , True ):
116
119
event .notice ("Unable to set +q or a mute extban on this network." )
117
120
118
121
119
122
@hook .command (permissions = ["op_quiet" , "op" , "chanop" ])
120
- def unquiet (text , chan , nick , event ):
123
+ def unquiet (text , event ):
121
124
"""[channel] <user> - unquiets <user> in [channel], or in the caller's channel if no channel is specified"""
122
- if mode_cmd ("-q" , "unquiet" , text , chan , nick , event , False ):
125
+ if mode_cmd ("-q" , "unquiet" , text , event , False ):
123
126
return
124
127
125
- if not do_extban ("m" , "unquiet" , text , chan , nick , event , False ):
128
+ if not do_extban ("m" , "unquiet" , text , event , False ):
126
129
event .notice ("Unable to unset +q or a mute extban on this network." )
127
130
128
131
129
132
@hook .command (permissions = ["op_voice" , "op" , "chanop" ])
130
- def voice (text , chan , nick , event ):
133
+ def voice (text , event ):
131
134
"""[channel] <user> - voices <user> in [channel], or in the caller's channel if no channel is specified"""
132
- mode_cmd ("+v" , "voice" , text , chan , nick , event )
135
+ mode_cmd ("+v" , "voice" , text , event )
133
136
134
137
135
138
@hook .command (permissions = ["op_voice" , "op" , "chanop" ])
136
- def devoice (text , chan , nick , event ):
139
+ def devoice (text , event ):
137
140
"""[channel] <user> - devoices <user> in [channel], or in the caller's channel if no channel is specified"""
138
- mode_cmd ("-v" , "devoice" , text , chan , nick , event )
141
+ mode_cmd ("-v" , "devoice" , text , event )
139
142
140
143
141
144
@hook .command (permissions = ["op_op" , "op" , "chanop" ])
142
- def op (text , chan , nick , event ):
145
+ def op (text , event ):
143
146
"""[channel] <user> - ops <user> in [channel], or in the caller's channel if no channel is specified"""
144
- mode_cmd ("+o" , "op" , text , chan , nick , event )
147
+ mode_cmd ("+o" , "op" , text , event )
145
148
146
149
147
150
@hook .command (permissions = ["op_op" , "op" , "chanop" ])
148
- def deop (text , chan , nick , event ):
151
+ def deop (text , event ):
149
152
"""[channel] <user> - deops <user> in [channel], or in the caller's channel if no channel is specified"""
150
- mode_cmd ("-o" , "deop" , text , chan , nick , event )
153
+ mode_cmd ("-o" , "deop" , text , event )
151
154
152
155
153
156
@hook .command (permissions = ["op_topic" , "op" , "chanop" ])
@@ -209,24 +212,24 @@ def remove(text, chan, conn, nick, event):
209
212
210
213
211
214
@hook .command (permissions = ["op_mute" , "op" , "chanop" ], autohelp = False )
212
- def mute (text , chan , event ):
215
+ def mute (text , event ):
213
216
"""[channel] - mutes [channel], or in the caller's channel if no channel is specified"""
214
- mode_cmd_no_target ("+m" , "mute" , text , chan , event )
217
+ mode_cmd_no_target ("+m" , "mute" , text , event )
215
218
216
219
217
220
@hook .command (permissions = ["op_mute" , "op" , "chanop" ], autohelp = False )
218
- def unmute (text , chan , event ):
221
+ def unmute (text , event ):
219
222
"""[channel] - unmutes [channel], or in the caller's channel if no channel is specified"""
220
- mode_cmd_no_target ("-m" , "unmute" , text , chan , event )
223
+ mode_cmd_no_target ("-m" , "unmute" , text , event )
221
224
222
225
223
226
@hook .command (permissions = ["op_lock" , "op" , "chanop" ], autohelp = False )
224
- def lock (text , chan , event ):
227
+ def lock (text , event ):
225
228
"""[channel] - locks [channel], or in the caller's channel if no channel is specified"""
226
- mode_cmd_no_target ("+i" , "lock" , text , chan , event )
229
+ mode_cmd_no_target ("+i" , "lock" , text , event )
227
230
228
231
229
232
@hook .command (permissions = ["op_lock" , "op" , "chanop" ], autohelp = False )
230
- def unlock (text , chan , event ):
233
+ def unlock (text , event ):
231
234
"""[channel] - unlocks [channel], or in the caller's channel if no channel is specified"""
232
- mode_cmd_no_target ("-i" , "unlock" , text , chan , event )
235
+ mode_cmd_no_target ("-i" , "unlock" , text , event )
0 commit comments