Skip to content

Commit

Permalink
Fix issue sopel-irc#624. Add a reply if .dice/.roll is called without…
Browse files Browse the repository at this point in the history
… arguments.
  • Loading branch information
creftos committed Sep 28, 2014
1 parent 1a4a13d commit b805d1e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions willie/modules/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 b805d1e

Please sign in to comment.