I am not a smart person sometimes
This commit is contained in:
parent
fd7253ded7
commit
6518fe7136
|
@ -18,7 +18,6 @@ print 'CloudBot DEV <http://git.io/cloudbotirc>'
|
|||
# create new bot object
|
||||
bot = Bot()
|
||||
bot.vars = {}
|
||||
bot.history = {}
|
||||
|
||||
# record start time for the uptime command
|
||||
bot.start_time = time.time()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" \
|
||||
|
|
Reference in New Issue