Yes Fletcher, there was a good reason

This commit is contained in:
Luke Rogers 2013-09-10 13:29:38 +12:00
parent 415740a399
commit a157a250be

View file

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