Browse Source

Added a choice command for random selection

Kirk Trombley 5 years ago
parent
commit
1256ac7b6f
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/plugins/simple.py

+ 7 - 0
src/plugins/simple.py

@@ -34,3 +34,10 @@ def console(message):
     if argstr is not None:
         opts.append("It'll be okay, {}! Keep trying!".format(argstr))
     return random.choice(opts)
+
+
+@as_plugin
+def choice(message):
+    opts = list(message.args)
+    chosen = random.choice(opts)
+    return f"Randomly chose {chosen} from {len(opts)} options"