Sfoglia il codice sorgente

Added a choice command for random selection

Kirk Trombley 5 anni fa
parent
commit
1256ac7b6f
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  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:
     if argstr is not None:
         opts.append("It'll be okay, {}! Keep trying!".format(argstr))
         opts.append("It'll be okay, {}! Keep trying!".format(argstr))
     return random.choice(opts)
     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"