Add generate list
This commit is contained in:
parent
01a070158e
commit
b8db724ed2
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue