Yes Fletcher, there was a good reason
This commit is contained in:
parent
415740a399
commit
a157a250be
1 changed files with 8 additions and 4 deletions
|
@ -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()
|
Reference in a new issue