Add generate list

This commit is contained in:
Robert Miles 2019-11-03 14:01:49 -05:00
parent 01a070158e
commit b8db724ed2
1 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,7 @@ NAME = re.compile(r'\$([^\s]+)')
SUB = r"#\1#"
replace_name = lambda x: NAME.sub(SUB,x)
GENERATORS = [
GENERATORS_LIST = [
"book_fantasy",
"book_horror",
"book_hp",
@ -29,8 +29,10 @@ def get_generator(name):
GENERATORS = utils.LazyLoadedDict(get_generator)
@plugin.command("generate")
@plugin.command("generate","<{}>".format("|".join(GENERATORS_LIST)))
def generate(bot,channel,nick,generator):
if generator not in GENERATORS_LIST:
bot.say(channel,"{}: Invalid generator!".format(nick))
res = GENERATORS[generator]()
if generator!="idea":
res = titlecase.titlecase(res)