home · contact · privacy
Simplify quote line counting.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 22 Jan 2016 01:59:14 +0000 (02:59 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 22 Jan 2016 01:59:14 +0000 (02:59 +0100)
plomlombot.py

index 9da116646679d15cb582a18e21ffb6026512361e..4befc396de3539871b95c1442bcbfd77b9e259b4 100755 (executable)
@@ -151,8 +151,9 @@ def lineparser_loop(io, nickname):
                 quotesfile = open(quotesfile_name, "r")
                 lines = quotesfile.readlines()
                 quotesfile.close()
-                i = random.randrange(len(lines) - 1) + 1
-                notice("QUOTE #" + str(i) + ": " + lines[i])
+                lines = lines[1:]
+                i = random.randrange(len(lines))
+                notice("QUOTE #" + str(i + 1) + ": " + lines[i])
 
         sender = ""
         for rune in tokens[0]: