summaryrefslogtreecommitdiff
path: root/saylol.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2014-07-27 05:28:31 +0200
committerjomo <github@jomo.tv>2014-07-27 05:28:31 +0200
commite04053e46f14226859199b40c9a5c67bdaa4f260 (patch)
tree8db014f26c3049223cdfc99acd908ab4631ac96f /saylol.py
parent2a1c2f391973d9196835b482655a3947462cb328 (diff)
add /lol search <text>
Diffstat (limited to 'saylol.py')
-rw-r--r--saylol.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/saylol.py b/saylol.py
index 7c43eaa..392a1ca 100644
--- a/saylol.py
+++ b/saylol.py
@@ -49,6 +49,12 @@ def print_lol(sender, lid):
msg(sender, "&cYou can use SayLol again in &a%s seconds!" % int(timeout + 1 - (time() - last_msg)))
+def search_lols(sender, keyword):
+ for i, lol in enumerate(lols):
+ if keyword in lol:
+ msg(sender, "&a%s: &e%s" % (str(i).rjust(3), lol))
+
+
@hook.command("lol")
def on_lol_command(sender, args):
cmd = args[0] if len(args) > 0 else None
@@ -74,6 +80,12 @@ def on_lol_command(sender, args):
for i in range(len(lols)):
msg(sender, "&a%s: &e%s" % (str(i).rjust(3), lols[i]))
+ elif cmd == "search":
+ if sender.hasPermission("utils.lol.search"):
+ search_lols(sender, " ".join(args[1:]))
+ else:
+ noperm(sender)
+
elif cmd == "add":
if sender.hasPermission("utils.lol.modify"):
plugin_header(sender, "SayLol")