add main page and multiple stories
This commit is contained in:
@@ -2,3 +2,10 @@
|
||||
|
||||
[NO AI USAGE]
|
||||
Simple choose your own adventure story hosted over Discord's new link embed V2 system, controlled with sed commands to edit your message's query value
|
||||
|
||||
it's cache friendly as well, since the same code will always have the same result
|
||||
stories are easy to store as json files
|
||||
and you can switch between stories through pathing
|
||||
main page also displays how to play the game (WIP)
|
||||
|
||||
this is just a fun little test I wanted to try with discords new scraper embed system they announced
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Test</title>
|
||||
</head>
|
||||
<body>
|
||||
test
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,17 +5,21 @@ app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route("/")
|
||||
def game():
|
||||
def mainPage():
|
||||
return open("main.html").read()
|
||||
|
||||
@app.route("/<path:path>")
|
||||
def game(path):
|
||||
if "Discord" not in str(request.user_agent):
|
||||
return mainPage()
|
||||
gamecode = request.args.get('code')[:-1]
|
||||
|
||||
#return open("page copy.html", "r").read()
|
||||
#print(buildHTML(gamecode))
|
||||
|
||||
return buildHTML(gamecode)
|
||||
gameName = request.path[1:]
|
||||
print(gameName)
|
||||
return buildHTML(gamecode,gameName)
|
||||
|
||||
|
||||
def buildHTML(gamecode):
|
||||
with open("story.json", "r") as f:
|
||||
def buildHTML(gamecode, gameName):
|
||||
with open("stories/" + gameName.replace(".", "") + ".json", "r") as f:
|
||||
print("\n\n")
|
||||
story = json.loads(f.read())
|
||||
nodeName = "start"
|
||||
|
||||
Reference in New Issue
Block a user