Fixed namegen
I need to redesign TextGenerator a bit, I kinda hacked it to do two things and it's not the most elegant.
This commit is contained in:
parent
f98774032f
commit
c0b3285c4a
2 changed files with 3 additions and 2 deletions
|
@ -8,8 +8,8 @@ GEN_DIR = "./plugins/data/name_files/"
|
||||||
|
|
||||||
def get_generator(_json):
|
def get_generator(_json):
|
||||||
data = json.loads(_json)
|
data = json.loads(_json)
|
||||||
return textgen.TextGenerator(data["name"], data["templates"],
|
return textgen.TextGenerator(data["templates"],
|
||||||
data["parts"], data["default_templates"])
|
data["parts"], default_templates = data["default_templates"])
|
||||||
|
|
||||||
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
|
|
|
@ -16,6 +16,7 @@ class TextGenerator(object):
|
||||||
Generates one string using the specified templates.
|
Generates one string using the specified templates.
|
||||||
If no templates are specified, use a random template from the default_templates list.
|
If no templates are specified, use a random template from the default_templates list.
|
||||||
"""
|
"""
|
||||||
|
# this is bad
|
||||||
if self.default_templates:
|
if self.default_templates:
|
||||||
text = self.templates[template or random.choice(self.default_templates)]
|
text = self.templates[template or random.choice(self.default_templates)]
|
||||||
else:
|
else:
|
||||||
|
|
Reference in a new issue