home · contact · privacy
Only show first 3 of >3 quotes, fix broken multi-quote printing.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 18 Apr 2016 00:17:13 +0000 (02:17 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 18 Apr 2016 00:17:13 +0000 (02:17 +0200)
plomlombot.py

index 66b902f672e978ad0ff5e01961c7fdd94e5e196a..7224b29e2ccff2a90504a113676edd625278253e 100755 (executable)
@@ -180,9 +180,11 @@ def handle_command(command, argument, notice, target, session):
             if len(results) == 0:
                 notice("NO QUOTES MATCHING QUERY")
             else:
-                for result in results:
-                    notice("QUOTE #" + str(result[0] + 1) + " : "
-                           + result[1][-1])
+                if len(results) > 3:
+                    notice("SHOWING 3 OF " + str(len(results)) + " QUOTES")
+                for result in results[:3]:
+                    notice("QUOTE #" + str(result[0] + 1) + ": "
+                           + result[1][:-1])
             return
         else:
             i = random.randrange(len(lines))