X-Git-Url: https://plomlompom.com/repos/?p=plomlombot-irc.git;a=blobdiff_plain;f=plomlombot.py;h=d81ead38938b6c2072d3b9b712a7512399ceb073;hp=96b399b2eadc404c65e57f27ef97d6b344204ebf;hb=5377a72129557c7588b2a7e7e3e3890965f39813;hpb=a541bf77d3fc8f0f0a5c68640ae3d4a7af1306a0 diff --git a/plomlombot.py b/plomlombot.py index 96b399b..d81ead3 100755 --- a/plomlombot.py +++ b/plomlombot.py @@ -214,13 +214,13 @@ def handle_command(command, argument, notice, target, session): tokens = [] else: tokens = argument.split(" ") - if len(tokens) != 0: - if (len(tokens) == 1 and not tokens[0].isdigit()) or \ - tokens[0] not in {"search", "offset-search"} or \ - (tokens[0] == "offset-search" and - ((not len(tokens) > 2) or (not tokens[1].isdigit()))): - help() - return + if (len(tokens) == 1 and not tokens[0].isdigit()) or \ + (len(tokens) > 1 and + tokens[0] not in {"search", "offset-search"} or + (tokens[0] == "offset-search" and + ((not len(tokens) > 2) or (not tokens[1].isdigit())))): + help() + return if not os.access(session.quotesfile, os.F_OK): notice("no quotes available") return @@ -234,7 +234,7 @@ def handle_command(command, argument, notice, target, session): notice("there's no quote of that index") return i = i - 1 - else: + elif len(tokens) > 1: to_skip = 0 if tokens[0] == "search": query = str.join(" ", tokens[1:]) @@ -253,7 +253,7 @@ def handle_command(command, argument, notice, target, session): notice("skipped all quotes matching query") else: notice("found %s matches, showing max. 3, skipping %s" - %s (len(results), to_skip)) + % (len(results), to_skip)) for i in range(len(results)): if i >= to_skip and i < to_skip + 3: result = results[i]