flavor text, autosaves

This commit is contained in:
2023-02-24 12:39:18 -08:00
parent 3c05ef8552
commit 55525a5235
7 changed files with 243 additions and 8 deletions

View File

@@ -1,8 +1,13 @@
import json
import random
import subprocess
from . import core
def generate_flavor_text():
proc_rant = subprocess.run(["rant", "/app/rant/flavor.rant"], capture_output=True)
return proc_rant.stdout.decode()
@core.app.route("/tick")
def tick():
return random.choices([json.dumps({"code": 200, "event_type": 0}), json.dumps({"code": 200, "event_type": 1, "log": "The server chose a flavor text event, which hasn't been fully implemented yet."})], weights=[16, 1])[0]
return random.choices([json.dumps({"code": 200, "event_type": 0}), json.dumps({"code": 200, "event_type": 1, "log": generate_flavor_text()})], weights=[16, 1])[0]