31 lines
682 B
Python
31 lines
682 B
Python
import tomlkit.items
|
|
from tomlkit import parse
|
|
|
|
|
|
def parse_templates(cfg, key):
|
|
for insult in cfg[key]:
|
|
print(f"template\t{insult['template']}")
|
|
for k, v in insult["word_bank"].items():
|
|
if type(v) == tomlkit.items.Array:
|
|
print(f"{k}\t", end="")
|
|
for p in v:
|
|
print(f"{p}\t", end="")
|
|
print()
|
|
else:
|
|
print(f"{k}\t{v}")
|
|
|
|
|
|
def main():
|
|
with open("config.toml", "r") as f:
|
|
o = f.read()
|
|
cfg = parse(o)
|
|
|
|
parse_templates(cfg, "compliments")
|
|
print()
|
|
parse_templates(cfg, "insults")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|