]> jfr.im git - z_archive/Ophion.git/blob - modules/autoload/chkick.py
Initialize repo
[z_archive/Ophion.git] / modules / autoload / chkick.py
1 from classes import *
2 from util import *
3
4 name = 'channel kick'
5 def init(cache):
6 cache.currmod = __name__
7 cache.hookcmd('KICK', 3, kick, 1, helpkick)
8 cache.hookcmd('BAN', 3, ban, 1, helpban)
9 def deinit(cache, reloading=False):
10 cache.currmod = __name__
11 cache.unhookcmd('KICK')
12 cache.unhookcmd('BAN')
13
14 def kick(nick, target, params, bot, cache):
15 pieces = params.split(None, 1)
16 reason = "Requested by %s" % (nick)
17 if len(pieces) == 2:
18 reason = "%s (%s)" % (pieces[1], reason)
19 bot.raw("KICK %s %s :%s" % (target, pieces[0], reason))
20
21 def ban(nick, target, params, bot, cache):
22 bot.raw("MODE %s +b %s" % (target, pieces[0]))
23 bot.msg(nick, "Done.")
24
25 def helpkick(): return ['KICK <#channel> [<reason>]', 'Kicks <user>']
26 def helpban(): return ['BAN <hostmask>', 'Bans <hostmask>. (Doesn\'t kick)']