13 lines
421 B
Python
13 lines
421 B
Python
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": generate_flavor_text()})], weights=[16, 1])[0] |