I'm sure there was a reason this was complicated.
This commit is contained in:
parent
8c60a923ba
commit
a211115b7e
1 changed files with 3 additions and 7 deletions
|
@ -1,4 +1,3 @@
|
||||||
import re
|
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from util import hook
|
from util import hook
|
||||||
|
@ -6,13 +5,10 @@ from util import hook
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def choose(inp):
|
def choose(inp):
|
||||||
"""choose <choice1>, [choice2], [choice3] ... [choiceN]
|
"""choose <choice1>, [choice2], [choice3]
|
||||||
Randomly picks one of the given choices."""
|
Randomly picks one of the given choices."""
|
||||||
|
|
||||||
c = re.findall(r'([^,]+)', inp)
|
c = inp.split(" ")
|
||||||
if len(c) == 1:
|
if len(c) == 1:
|
||||||
c = re.findall(r'(\S+)', inp)
|
return 'banana'
|
||||||
if len(c) == 1:
|
|
||||||
return 'The decision is up to you!'
|
|
||||||
|
|
||||||
return random.choice(c).strip()
|
return random.choice(c).strip()
|
||||||
|
|
Reference in a new issue