Forráskód Böngészése

Merge branch 'choice-command' of kirkleon/rollbot3 into master

kirkleon 5 éve
szülő
commit
0c1ecd4bd2
1 módosított fájl, 7 hozzáadás és 0 törlés
  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"