Bläddra i källkod

Added a choice command for random selection

Kirk Trombley 5 år sedan
förälder
incheckning
1256ac7b6f
1 ändrade filer med 7 tillägg och 0 borttagningar
  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"