From b805d1efcc504a295e0d2b0cf6defb3a57b22073 Mon Sep 17 00:00:00 2001 From: "Brian Donohoe (creftos)" Date: Sat, 27 Sep 2014 17:37:42 -0700 Subject: [PATCH] Fix issue #624. Add a reply if .dice/.roll is called without arguments. --- willie/modules/dice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/willie/modules/dice.py b/willie/modules/dice.py index 4dd981f6d4..dbb5109268 100644 --- a/willie/modules/dice.py +++ b/willie/modules/dice.py @@ -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("%", "%%")