^-^
This commit is contained in:
parent
74f1fcf529
commit
88304ff795
2 changed files with 7 additions and 11 deletions
14
cloudbot.py
14
cloudbot.py
|
@ -5,31 +5,27 @@ from core import bot as _bot
|
||||||
import os
|
import os
|
||||||
import Queue
|
import Queue
|
||||||
import sys
|
import sys
|
||||||
import re
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
sys.path += ['plugins', 'lib', 'core'] # add stuff to the sys.path for easy imports
|
# set up enviroment
|
||||||
|
sys.path += ['plugins', 'lib'] # add stuff to the sys.path for easy imports
|
||||||
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
|
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
|
||||||
|
|
||||||
print 'CloudBot DEV <http://git.io/cloudbotirc>'
|
print 'CloudBot REFRESH <http://git.io/cloudbotirc>'
|
||||||
|
|
||||||
# create new bot object
|
# create new bot object
|
||||||
bot = _bot.Bot("cloudbot")
|
bot = _bot.Bot("cloudbot")
|
||||||
bot.logger.debug("Bot initalized.")
|
bot.logger.debug("Bot initalized.")
|
||||||
|
|
||||||
# bootstrap the reloader
|
# bootstrap the reloader
|
||||||
|
bot.logger.debug("Bootstrapping reloader.")
|
||||||
eval(compile(open(os.path.join('core', 'reload.py'), 'U').read(),
|
eval(compile(open(os.path.join('core', 'reload.py'), 'U').read(),
|
||||||
os.path.join('core', 'reload.py'), 'exec'))
|
os.path.join('core', 'reload.py'), 'exec'))
|
||||||
reload(init=True)
|
reload(init=True)
|
||||||
|
|
||||||
|
bot.logger.debug("Starting main loop.")
|
||||||
|
|
||||||
|
|
||||||
print 'Connection(s) made, starting main loop.'
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
reload() # these functions only do things
|
reload() # these functions only do things
|
||||||
# if changes have occured
|
|
||||||
|
|
||||||
for connection in bot.connections.itervalues():
|
for connection in bot.connections.itervalues():
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -87,8 +87,8 @@ class Bot(object):
|
||||||
# create a formatter and set the formatter for the handler.
|
# create a formatter and set the formatter for the handler.
|
||||||
frmt = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
|
frmt = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')
|
||||||
fh.setFormatter(frmt)
|
fh.setFormatter(frmt)
|
||||||
simplefrmt = logging.Formatter('[%(levelname)s] %(message)s')
|
simple_frmt = logging.Formatter('[%(levelname)s] %(message)s')
|
||||||
sh.setFormatter(simplefrmt)
|
sh.setFormatter(simple_frmt)
|
||||||
|
|
||||||
# add the Handlers to the logger
|
# add the Handlers to the logger
|
||||||
logger.addHandler(fh)
|
logger.addHandler(fh)
|
||||||
|
|
Reference in a new issue