From d5886fbd945c8e9764b6843e9590a040a25bc0e7 Mon Sep 17 00:00:00 2001 From: Thorsten Date: Fri, 27 May 2016 21:48:33 +0200 Subject: [PATCH] fix --- plugins/commands.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/commands.py b/plugins/commands.py index dd1af44..5d9c34f 100644 --- a/plugins/commands.py +++ b/plugins/commands.py @@ -284,14 +284,17 @@ def command_choose(argv, **args): alternatives = argv binary = ['Yes', 'No', 'Maybe'] - # single choose request - if 'choose' not in alternatives: - log.info('sent random choice') + # single or no choice + if len(alternatives) < 2: return { - 'msg': '%s: I prefer %s!' % (args['reply_user'], random.choice(alternatives)) + 'msg': '{}: {}.'.format(args['reply_user'], random.choice(binary)) + } + elif 'choose' not in alternatives: + choice = random.choice(alternatives) + return { + 'msg': '%s: I prefer %s!' % (args['reply_user'], choice) } - # multiple choices def choose_between(options): responses = [] current_choices = []