Improved config options, added stayalive code from biGGer
This commit is contained in:
parent
d5fd951a39
commit
dd0cec62bc
3 changed files with 13 additions and 3 deletions
|
@ -19,12 +19,14 @@ if not os.path.exists('config'):
|
||||||
"user": "cloudbot",
|
"user": "cloudbot",
|
||||||
"realname": "CloudBot/DEV - http://j.mp/uS5Cvx",
|
"realname": "CloudBot/DEV - http://j.mp/uS5Cvx",
|
||||||
"nickserv_password": "",
|
"nickserv_password": "",
|
||||||
"channels": ["#channel"]
|
"channels": ["#channel"],
|
||||||
|
"command_prefix": ".",
|
||||||
|
"stayalive": "",
|
||||||
|
"stayalive_delay": "20",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"disabled_plugins": [],
|
"disabled_plugins": [],
|
||||||
"disabled_commands": [],
|
"disabled_commands": [],
|
||||||
"prefix": ".",
|
|
||||||
"acls": {},
|
"acls": {},
|
||||||
"api_keys":
|
"api_keys":
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,7 @@ def match_command(command):
|
||||||
|
|
||||||
def main(conn, out):
|
def main(conn, out):
|
||||||
inp = Input(conn, *out)
|
inp = Input(conn, *out)
|
||||||
commandprefix = bot.config['prefix']
|
commandprefix = conn.conf.get('command_prefix')
|
||||||
|
|
||||||
# EVENTS
|
# EVENTS
|
||||||
for func, args in bot.events[inp.command] + bot.events['*']:
|
for func, args in bot.events[inp.command] + bot.events['*']:
|
||||||
|
|
|
@ -49,6 +49,14 @@ def onjoin(paraml, conn=None, bot=None):
|
||||||
|
|
||||||
http.ua_skybot = 'CloudBot'
|
http.ua_skybot = 'CloudBot'
|
||||||
|
|
||||||
|
# stayalive code
|
||||||
|
|
||||||
|
stayalive = conn.conf.get('stayalive')
|
||||||
|
if stayalive:
|
||||||
|
while True:
|
||||||
|
time.sleep(conn.conf.get('stayalive_delay', 20))
|
||||||
|
conn.cmd('PING', [conn.nick])
|
||||||
|
|
||||||
|
|
||||||
@hook.regex(r'^\x01VERSION\x01$')
|
@hook.regex(r'^\x01VERSION\x01$')
|
||||||
def version(inp, notice=None):
|
def version(inp, notice=None):
|
||||||
|
|
Reference in a new issue