| @@ 147-173 (lines=27) @@ | ||
| 144 | return '' |
|
| 145 | ||
| 146 | ||
| 147 | @require_chanmsg |
|
| 148 | @require_privilege(OP, 'You are not a channel operator.') |
|
| 149 | @commands('ban') |
|
| 150 | @priority('high') |
|
| 151 | def ban(bot, trigger): |
|
| 152 | """Ban a user from the channel |
|
| 153 | ||
| 154 | The bot must be a channel operator for this command to work. |
|
| 155 | """ |
|
| 156 | if bot.channels[trigger.sender].privileges[bot.nick] < HALFOP: |
|
| 157 | return bot.reply("I'm not a channel operator!") |
|
| 158 | text = trigger.group().split() |
|
| 159 | argc = len(text) |
|
| 160 | if argc < 2: |
|
| 161 | return |
|
| 162 | opt = Identifier(text[1]) |
|
| 163 | banmask = opt |
|
| 164 | channel = trigger.sender |
|
| 165 | if not opt.is_nick(): |
|
| 166 | if argc < 3: |
|
| 167 | return |
|
| 168 | channel = opt |
|
| 169 | banmask = text[2] |
|
| 170 | banmask = configureHostMask(banmask) |
|
| 171 | if banmask == '': |
|
| 172 | return |
|
| 173 | bot.write(['MODE', channel, '+b', banmask]) |
|
| 174 | ||
| 175 | ||
| 176 | @require_chanmsg |
|
| @@ 232-257 (lines=26) @@ | ||
| 229 | bot.write(['MODE', channel, '+q', quietmask]) |
|
| 230 | ||
| 231 | ||
| 232 | @require_chanmsg |
|
| 233 | @require_privilege(OP, 'You are not a channel operator.') |
|
| 234 | @commands('unquiet') |
|
| 235 | def unquiet(bot, trigger): |
|
| 236 | """Unquiet a user |
|
| 237 | ||
| 238 | The bot must be a channel operator for this command to work. |
|
| 239 | """ |
|
| 240 | if bot.channels[trigger.sender].privileges[bot.nick] < OP: |
|
| 241 | return bot.reply("I'm not a channel operator!") |
|
| 242 | text = trigger.group().split() |
|
| 243 | argc = len(text) |
|
| 244 | if argc < 2: |
|
| 245 | return |
|
| 246 | opt = Identifier(text[1]) |
|
| 247 | quietmask = opt |
|
| 248 | channel = trigger.sender |
|
| 249 | if not opt.is_nick(): |
|
| 250 | if argc < 3: |
|
| 251 | return |
|
| 252 | quietmask = text[2] |
|
| 253 | channel = opt |
|
| 254 | quietmask = configureHostMask(quietmask) |
|
| 255 | if quietmask == '': |
|
| 256 | return |
|
| 257 | bot.write(['MODE', channel, '-q', quietmask]) |
|
| 258 | ||
| 259 | ||
| 260 | @require_chanmsg |
|
| @@ 204-229 (lines=26) @@ | ||
| 201 | bot.write(['MODE', channel, '-b', banmask]) |
|
| 202 | ||
| 203 | ||
| 204 | @require_chanmsg |
|
| 205 | @require_privilege(OP, 'You are not a channel operator.') |
|
| 206 | @commands('quiet') |
|
| 207 | def quiet(bot, trigger): |
|
| 208 | """Quiet a user |
|
| 209 | ||
| 210 | The bot must be a channel operator for this command to work. |
|
| 211 | """ |
|
| 212 | if bot.channels[trigger.sender].privileges[bot.nick] < OP: |
|
| 213 | return bot.reply("I'm not a channel operator!") |
|
| 214 | text = trigger.group().split() |
|
| 215 | argc = len(text) |
|
| 216 | if argc < 2: |
|
| 217 | return |
|
| 218 | opt = Identifier(text[1]) |
|
| 219 | quietmask = opt |
|
| 220 | channel = trigger.sender |
|
| 221 | if not opt.is_nick(): |
|
| 222 | if argc < 3: |
|
| 223 | return |
|
| 224 | quietmask = text[2] |
|
| 225 | channel = opt |
|
| 226 | quietmask = configureHostMask(quietmask) |
|
| 227 | if quietmask == '': |
|
| 228 | return |
|
| 229 | bot.write(['MODE', channel, '+q', quietmask]) |
|
| 230 | ||
| 231 | ||
| 232 | @require_chanmsg |
|
| @@ 176-201 (lines=26) @@ | ||
| 173 | bot.write(['MODE', channel, '+b', banmask]) |
|
| 174 | ||
| 175 | ||
| 176 | @require_chanmsg |
|
| 177 | @require_privilege(OP, 'You are not a channel operator.') |
|
| 178 | @commands('unban') |
|
| 179 | def unban(bot, trigger): |
|
| 180 | """Unban a user from the channel |
|
| 181 | ||
| 182 | The bot must be a channel operator for this command to work. |
|
| 183 | """ |
|
| 184 | if bot.channels[trigger.sender].privileges[bot.nick] < HALFOP: |
|
| 185 | return bot.reply("I'm not a channel operator!") |
|
| 186 | text = trigger.group().split() |
|
| 187 | argc = len(text) |
|
| 188 | if argc < 2: |
|
| 189 | return |
|
| 190 | opt = Identifier(text[1]) |
|
| 191 | banmask = opt |
|
| 192 | channel = trigger.sender |
|
| 193 | if not opt.is_nick(): |
|
| 194 | if argc < 3: |
|
| 195 | return |
|
| 196 | channel = opt |
|
| 197 | banmask = text[2] |
|
| 198 | banmask = configureHostMask(banmask) |
|
| 199 | if banmask == '': |
|
| 200 | return |
|
| 201 | bot.write(['MODE', channel, '-b', banmask]) |
|
| 202 | ||
| 203 | ||
| 204 | @require_chanmsg |
|