restructured IRC engine (this does not work yet)

This commit is contained in:
Luke Rogers 2013-10-02 16:08:17 +13:00
parent 1cc38cb139
commit 7c399db0ea
6 changed files with 189 additions and 111 deletions

View file

@ -4,16 +4,25 @@ from core import bot as _bot
import os
import sys
import signal
# set up enviroment
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
print 'CloudBot REFRESH <http://git.io/cloudbotirc>'
def exit_gracefully(signum, frame):
bot.stop()
# store the original SIGINT handler
original_sigint = signal.getsignal(signal.SIGINT)
signal.signal(signal.SIGINT, exit_gracefully)
# create new bot object
bot = _bot.Bot("cloudbot")
bot.logger.debug("Bot initalized.")
bot.logger.debug("Bot initalized, starting main loop.")
bot.logger.debug("Starting main loop.")
while True:
while bot.running:
bot.loop()
bot.logger.debug("Stopped main loop.")