fixed bug in stayalive code
This commit is contained in:
parent
1789cd3b26
commit
e061f4dd6d
2 changed files with 5 additions and 4 deletions
|
@ -23,8 +23,8 @@ if not os.path.exists('config'):
|
|||
"invitejoin": true,
|
||||
"autorejoin": false,
|
||||
"command_prefix": ".",
|
||||
"stayalive": "",
|
||||
"stayalive_delay": "20"
|
||||
"stayalive": true,
|
||||
"stayalive_delay": 20
|
||||
}
|
||||
},
|
||||
"disabled_plugins": [],
|
||||
|
|
|
@ -18,7 +18,7 @@ def invite(paraml, conn=None):
|
|||
return None
|
||||
|
||||
|
||||
# Rejoin on kick (Configuragble, defaults to False)
|
||||
# Rejoin on kick (Configurable, defaults to False)
|
||||
@hook.event('KICK')
|
||||
def rejoin(paraml, conn=None):
|
||||
autorejoin = conn.conf.get('autorejoin', False)
|
||||
|
@ -56,6 +56,7 @@ def onjoin(paraml, conn=None, bot=None):
|
|||
# Stay-alive code
|
||||
stayalive = conn.conf.get('stayalive')
|
||||
if stayalive:
|
||||
delay = conn.conf.get('stayalive_delay', 20)
|
||||
while True:
|
||||
time.sleep(conn.conf.get('stayalive_delay', 20))
|
||||
time.sleep(delay)
|
||||
conn.cmd('PING', [conn.nick])
|
||||
|
|
Reference in a new issue