Add ability to generate more than 1 at a time

This commit is contained in:
Robert Miles 2019-11-06 12:30:34 -05:00
parent 6e2fb19e37
commit 5268fba2da
1 changed files with 5 additions and 4 deletions

View File

@ -30,10 +30,11 @@ def get_generator(name):
GENERATORS = utils.LazyLoadedDict(get_generator) GENERATORS = utils.LazyLoadedDict(get_generator)
@plugin.command("generate","<{}>".format("|".join(GENERATORS_LIST))) @plugin.command("generate","<{}>".format("|".join(GENERATORS_LIST)))
def generate(bot,channel,nick,generator): def generate(bot,channel,nick,generator,count="1"):
if generator not in GENERATORS_LIST: if generator not in GENERATORS_LIST:
bot.say(channel,"{}: Invalid generator!".format(nick)) bot.say(channel,"{}: Invalid generator!".format(nick))
res = GENERATORS[generator]() count = int(count)
res = [GENERATOR[generator]() for x in range(count)]
if generator!="idea": if generator!="idea":
res = titlecase.titlecase(res) res = [titlecase.titlecase(x) for x in res]
bot.say(channel,"{}: {}".format(nick,res)) bot.say(channel,"{}: {}".format(nick,",".join(res)))