Skip to content

Commit

Permalink
[dice] Add a reply if .dice/.roll is called without arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
creftos committed Sep 28, 2014
1 parent 7253466 commit 621198c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ def roll(bot, trigger):
# Get a list of all dice expressions, evaluate them and then replace the
# expressions in the original string with the results. Replacing is done
# using string formatting, so %-characters must be escaped.
if not trigger.group(2):
return bot.reply("No dice to roll.")
arg_str = trigger.group(2)
dice_expressions = re.findall(dice_regexp, arg_str)
arg_str = arg_str.replace("%", "%%")
Expand Down

0 comments on commit 621198c

Please sign in to comment.