Merge branch 'develop' of github.com:ClouDev/CloudBot into develop
This commit is contained in:
commit
6fe8fbaee6
2 changed files with 9 additions and 10 deletions
|
@ -6,16 +6,15 @@ import random
|
|||
def coin(inp, me=None):
|
||||
"coin [amount] -- Flips [amount] of coins."
|
||||
|
||||
try:
|
||||
amount = int(inp)
|
||||
except ValueError:
|
||||
return "Invalid input!"
|
||||
if inp:
|
||||
try:
|
||||
amount = int(inp)
|
||||
except (ValueError, TypeError):
|
||||
return "Invalid input!"
|
||||
else:
|
||||
amount = 1
|
||||
|
||||
if amount == 1:
|
||||
if getrandbits(1):
|
||||
me("flips a coin and gets heads.")
|
||||
else:
|
||||
me("flips a coin and gets tails.")
|
||||
me("flips a coin and gets %s." % random.choice(["heads", "tails"]))
|
||||
elif amount == 0:
|
||||
me("makes a coin flipping motion with its hands.")
|
||||
|
|
Reference in a new issue