Changed the data_to_send to be a stack so many lines of code can

be pre-processed before the user interacts.
When the /happening api is called it just dequeues the front item
This commit is contained in:
2026-05-19 19:23:19 +01:00
parent 019f1088a3
commit ee34493895
6 changed files with 180 additions and 148 deletions
+18 -16
View File
@@ -1,6 +1,12 @@
import requests
import os
import time
import sys
debug = False
try:
if sys.argv[1] == "debug": debug = True
except:
debug = False
# Loop and get new api
def main():
@@ -9,22 +15,18 @@ def main():
while True:
try:
response = api_get()
if response["id"] != id:
id = response["id"]
print(response)
match response["action_type"]:
case "output":
character = get_character(response["character"])
output(character, response["content"])
case "choice":
user_choice = choice(response["choices"])
time.sleep(0.5)
continue
case "end":
print("Exitting successfully")
os._exit(0)
else:
continue
if debug: print(response)
match response["action_type"]:
case "output":
character = get_character(response["character"])
output(character, response["content"])
case "choice":
user_choice = choice(response["choices"])
time.sleep(0.5)
continue
case "end":
print("Exitting successfully")
os._exit(0)
except:
print("Server not up or cannot be reached")
input() # Enter to go to next loop (testing)