2009-07-08 17:04:30 +00:00
|
|
|
from util import hook
|
2009-11-21 01:12:29 +00:00
|
|
|
import socket
|
|
|
|
|
|
|
|
socket.setdefaulttimeout(5) # global setting
|
2009-03-16 04:30:46 +00:00
|
|
|
|
2009-04-18 00:57:18 +00:00
|
|
|
|
2009-11-19 04:32:28 +00:00
|
|
|
#autorejoin channels
|
|
|
|
@hook.event('KICK')
|
2009-03-15 06:51:39 +00:00
|
|
|
def rejoin(bot, input):
|
2009-11-19 04:32:28 +00:00
|
|
|
if input.paraml[1] == input.conn.nick:
|
|
|
|
if input.paraml[0] in input.conn.channels:
|
|
|
|
input.conn.join(input.paraml[0])
|
2009-03-15 06:51:39 +00:00
|
|
|
|
2009-11-19 04:32:28 +00:00
|
|
|
#join channels when invited
|
|
|
|
@hook.event('INVITE')
|
|
|
|
def invite(bot, input):
|
2009-03-15 06:51:39 +00:00
|
|
|
if input.command == 'INVITE':
|
2009-11-19 01:42:37 +00:00
|
|
|
input.conn.join(input.inp)
|
2009-11-19 04:32:28 +00:00
|
|
|
|
|
|
|
#join channels when server says hello & identify bot
|
|
|
|
@hook.event('004')
|
|
|
|
def onjoin(bot, input):
|
|
|
|
for channel in input.conn.channels:
|
|
|
|
input.conn.join(channel)
|
|
|
|
|
|
|
|
nickserv_password = input.conn.conf.get('nickserv_password', '')
|
|
|
|
nickserv_name = input.conn.conf.get('nickserv_name', 'nickserv')
|
|
|
|
nickserv_command = input.conn.conf.get('nickserv_command', 'IDENTIFY %s')
|
|
|
|
if nickserv_password:
|
|
|
|
input.conn.msg(nickserv_name, nickserv_command % nickserv_password)
|