<commit_before>import random

@command("choose")
def choose(nick, channel, message):
    choices = message.split(sep = ",")
    #this line rids of empty choices caused by consecutive commas
    choices = [i for i in choices if i != '']
    choice = random.sample(choices, 1)
    #this line cleans up the winner, removing leading spaces and brackets
    winner = "".join(choice).strip()

    say(channel, "{}: {}".format(nick, winner))
<commit_msg>Fixes and issue where !choose would crash the bot when there were no choices<commit_after>import random

@command("choose")
def choose(nick, channel, message):
    choices = message.split(sep = ",")
    #this line rids of empty choices caused by consecutive commas
    choices = [i for i in choices if i != '']
    if len(choices) > 0:
        choice = random.sample(choices, 1)
        #this line cleans up the winner, removing leading spaces and brackets
        winner = "".join(choice).strip()

        say(channel, "{}: {}".format(nick, winner))

    else:
        say(channel, "{}: Please give me things to choose from!".format(nick));

{'fraction_non_alphanumeric': 0.12264995523724262, 'fraction_numerical': 0.0026857654431512983, 'mean_word_length': 3.140740740740741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1632358', 'n_tokens_mistral': 335, 'n_tokens_neox': 315, 'n_words': 117}