X-Git-Url: https://plomlompom.com/repos/?p=plomlombot-irc.git;a=blobdiff_plain;f=plomlombot.py;h=64e46f8e42c8594d3be8748473fdfefecf827144;hp=c8c11f45ebb03a3e0a73a9339ba82013813278b7;hb=d937e8a8fd459058147747d896e8db18db609a3e;hpb=f3d948172f8b7c60c91621cd0adb2f0c9f0e37db diff --git a/plomlombot.py b/plomlombot.py index c8c11f4..64e46f8 100755 --- a/plomlombot.py +++ b/plomlombot.py @@ -185,14 +185,14 @@ def handle_command(command, argument, notice, target, session): shuffle(usable_selections) return usable_selections[0][select_length] - def purge_undesired(tokens): - for token in tokens: - if None != re.match("^" + URLREGEX, token): - del(tokens[tokens.index(token)]) + def malkovich_undesired(tokens): + #for token in tokens: + # if None != re.match("^" + URLREGEX, token): + # del(tokens[tokens.index(token)]) for name in session.uses_in_chan: while True: try: - del(tokens[tokens.index(name)]) + tokens[tokens.index(name.lower())] = "malkovich" except ValueError: break return tokens @@ -207,9 +207,9 @@ def handle_command(command, argument, notice, target, session): file.close() tokens = [] for line in lines: - line = line.replace("\n", "") + line = line.replace("\n", "").lower() tokens += line.split() - tokens = purge_undesired(tokens) + tokens = malkovich_undesired(tokens) if len(tokens) <= select_length: notice("NOT ENOUGH TEXT TO MARKOV.") return @@ -230,7 +230,7 @@ def handle_command(command, argument, notice, target, session): for i in range(select_length - 1): snippet[i] = snippet[i + 1] snippet[select_length - 1] = new_end - notice(msg.lower() + "malkovich.") + notice(msg + "malkovich.") if "addquote" == command: addquote()