moved bot loop into bot class

This commit is contained in:
Luke Rogers 2013-10-02 13:43:01 +13:00
parent 7e4ea3a9ff
commit 1cc38cb139
2 changed files with 21 additions and 15 deletions

View file

@ -1,12 +1,9 @@
#!/usr/bin/env python
# we import bot as _bot for now, for legacy reasons
from core import bot as _bot
from core import loader, main
import os
import Queue
import sys
import time
# set up enviroment
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
@ -19,13 +16,4 @@ bot.logger.debug("Bot initalized.")
bot.logger.debug("Starting main loop.")
while True:
loader.reload(bot) # these functions only do things
for connection in bot.connections.itervalues():
try:
out = connection.out.get_nowait()
main.main(bot, connection, out)
except Queue.Empty:
pass
while all(connection.out.empty() for connection in bot.connections.itervalues()):
time.sleep(.1)
bot.loop()