diff --git a/cloudbot.py b/cloudbot.py index 032d4e7..91515db 100755 --- a/cloudbot.py +++ b/cloudbot.py @@ -18,7 +18,6 @@ print 'CloudBot DEV ' # create new bot object bot = Bot() bot.vars = {} -bot.history = {} # record start time for the uptime command bot.start_time = time.time() diff --git a/core/irc.py b/core/irc.py index 7d5896c..35d4efa 100644 --- a/core/irc.py +++ b/core/irc.py @@ -135,6 +135,7 @@ class IRC(object): self.server = server self.port = port self.nick = nick + self.history = {} self.vars = {} self.out = Queue.Queue() # responses from the server are placed here diff --git a/plugins/correction.py b/plugins/correction.py index 7ed71cd..7617e11 100644 --- a/plugins/correction.py +++ b/plugins/correction.py @@ -6,7 +6,7 @@ CORRECTION_RE = r'^(s|S)/.*/.*/?\S*$' @hook.regex(CORRECTION_RE) -def correction(match, input=None, bot=None, message=None): +def correction(match, input=None, conn=None, message=None): split = input.msg.split("/") if len(split) == 4: @@ -17,7 +17,7 @@ def correction(match, input=None, bot=None, message=None): find = split[1] replace = split[2] - for item in bot.history[input.chan].__reversed__(): + for item in conn.history[input.chan].__reversed__(): name, timestamp, msg = item if msg.startswith("s/"): # don't correct corrections, it gets really confusing diff --git a/plugins/history.py b/plugins/history.py index e41b142..8b9e027 100644 --- a/plugins/history.py +++ b/plugins/history.py @@ -28,12 +28,12 @@ def track_seen(input, message_time, db): db.commit() -def track_history(input, message_time, bot): +def track_history(input, message_time, conn): try: - history = bot.history[input.chan] + history = conn.history[input.chan] except KeyError: - bot.history[input.chan] = deque(maxlen=100) - history = bot.history[input.chan] + conn.history[input.chan] = deque(maxlen=100) + history = conn.history[input.chan] data = (input.nick, message_time, input.msg) history.append(data) @@ -41,17 +41,17 @@ def track_history(input, message_time, bot): @hook.singlethread @hook.event('PRIVMSG', ignorebots=False) -def chat_tracker(paraml, input=None, db=None, bot=None): +def chat_tracker(paraml, input=None, db=None, conn=None): message_time = time.time() track_seen(input, message_time, db) - track_history(input, message_time, bot) + track_history(input, message_time, conn) @hook.command(autohelp=False) -def resethistory(inp, input=None, bot=None): +def resethistory(inp, input=None, conn=None): """resethistory - Resets chat history for the current channel""" try: - bot.history[input.chan].clear() + conn.history[input.chan].clear() return "Reset chat history for current channel." except KeyError: # wat diff --git a/plugins/minecraft_user.py b/plugins/minecraft_user.py index 6bd9175..4026994 100644 --- a/plugins/minecraft_user.py +++ b/plugins/minecraft_user.py @@ -87,7 +87,7 @@ def mcuser(inp): profile["lt"] = ", legacy" if profile["legacy"] else "" if profile["paid"]: - return u"The account \x02{name}\x02 ({id}{lt}) exists. It is a \x033\x02paid\x02\x0f" \ + return u"The account \x02{name}\x02 ({id}{lt}) exists. It is a \x02paid\x02" \ u" account.".format(**profile) else: return u"The account \x02{name}\x02 ({id}{lt}) exists. It \x034\x02is NOT\x02\x0f a paid" \