From 91c86c1d92cd0aa73e60eee739744792d3397bfa Mon Sep 17 00:00:00 2001 From: Fanir Date: Sat, 1 Mar 2014 01:34:46 +0100 Subject: [PATCH] a few cleanups --- main.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index bae43c5..788e8b0 100755 --- a/main.py +++ b/main.py @@ -26,13 +26,12 @@ # SETTINGS CAN BE FOUND AT THE BOTTOM OF THE FILE -import sys, time, string, socket, re, signal, struct +import sys, string, socket, re, signal +from time import sleep from select import poll, POLLIN, POLLPRI, POLLOUT,\ POLLERR, POLLHUP, POLLNVAL from threading import Thread, Event -from APIcollection import Twitter - bot = None @@ -158,7 +157,7 @@ class pircbot(): log.show(log.WARNING, "Got killed by %s: %s" % (params[0], params[1:])) self.quit(send=False) else: - time.sleep(self.parser_wait_time) + sleep(self.parser_wait_time) print("--- PARSELOOP EXITING ---") def send(self, data): @@ -207,15 +206,15 @@ class pircbot(): except: pass def join(self, channel): - while not self.ready: time.sleep(1) + while not self.ready: sleep(1) self.send("JOIN %s" % channel) def part(self, channel): - while not self.ready: time.sleep(1) + while not self.ready: sleep(1) self.send("PART %s" % channel) def set_mode(self, modes): - while not self.ready: time.sleep(1) + while not self.ready: sleep(1) self.send("MODE %s :%s" % (self.user["nick"], modes)) def on_command(self, prefix, origin, source, command, params): @@ -270,7 +269,7 @@ def main(): bot.connect() # wait for the bot to become ready while bot.ready and not bot.die_event.is_set() == False: - time.sleep(1) + sleep(1) if not bot.die_event.is_set(): # set modes and join channels @@ -280,7 +279,7 @@ def main(): # while bot is active, do nothing while not bot.die_event.is_set(): - time.sleep(1) + sleep(1) except KeyboardInterrupt: log.show(log.INFO, "Got Ctrl-C, dying now...") bot.quit()