Oops, forgot default parmeter and an import

This commit is contained in:
Luke Rogers 2012-04-25 19:48:14 +12:00
parent 2533d7fffe
commit 5185b13621

View file

@ -1,9 +1,7 @@
import re import re
import socket import socket
import subprocess
import platform
import time
from time import sleep
from util import hook from util import hook
socket.setdefaulttimeout(10) socket.setdefaulttimeout(10)
@ -41,6 +39,7 @@ def onjoin(paraml, conn=None, bot=None):
conn.msg(nickserv_name, nickserv_command % nickserv_password) conn.msg(nickserv_name, nickserv_command % nickserv_password)
bot.config['censored_strings'].append(nickserv_password) bot.config['censored_strings'].append(nickserv_password)
time.sleep(1) time.sleep(1)
# Set bot modes # Set bot modes
mode = conn.conf.get('mode') mode = conn.conf.get('mode')
if mode: if mode:
@ -51,10 +50,13 @@ def onjoin(paraml, conn=None, bot=None):
conn.join(channel) conn.join(channel)
time.sleep(1) time.sleep(1)
# Stay-alive code print "onjoin() sucessfully completed."
stayalive = conn.conf.get('stayalive', False)
if stayalive:
delay = conn.conf.get('stayalive_delay', 20) @hook.event('004')
def keep_alive(paraml, conn=None):
keepalive = conn.conf.get('keep_alive', False)
if keepalive:
while True: while True:
time.sleep(delay)
conn.cmd('PING', [conn.nick]) conn.cmd('PING', [conn.nick])
time.sleep(120)