I'm sure there was a reason this was complicated.

This commit is contained in:
Fletcher Boyd 2013-09-05 08:53:07 +08:00
parent 8c60a923ba
commit a211115b7e

View file

@ -1,4 +1,3 @@
import re
import random
from util import hook
@ -6,13 +5,10 @@ from util import hook
@hook.command
def choose(inp):
"""choose <choice1>, [choice2], [choice3] ... [choiceN]
"""choose <choice1>, [choice2], [choice3]
Randomly picks one of the given choices."""
c = re.findall(r'([^,]+)', inp)
c = inp.split(" ")
if len(c) == 1:
c = re.findall(r'(\S+)', inp)
if len(c) == 1:
return 'The decision is up to you!'
return 'banana'
return random.choice(c).strip()