reformat message and add images
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
{
|
{
|
||||||
"component": {
|
"component": {
|
||||||
"type": 17,
|
"type": 17,
|
||||||
"accent_color": 16711680,
|
"accent_color": {{Color}},
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": 10,
|
"type": 10,
|
||||||
|
|||||||
@@ -11,20 +11,32 @@
|
|||||||
{
|
{
|
||||||
"component": {
|
"component": {
|
||||||
"type": 17,
|
"type": 17,
|
||||||
"accent_color": 16711680,
|
"accent_color": {{Color}},
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": 10,
|
"type": 9,
|
||||||
"content": "{{CurrText}}\n{{Choices}}"
|
"components": [
|
||||||
|
{
|
||||||
|
"type": 10,
|
||||||
|
"content": "## {{CurrText}}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accessory": {
|
||||||
|
"type": 11,
|
||||||
|
"media": {
|
||||||
|
"url": "https://adventure.lockeshor.com/img/{{StoryName}}.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
{{Choices}}
|
||||||
{
|
{
|
||||||
"type": 14,
|
"type": 14,
|
||||||
"spacing": 1,
|
"divider": false,
|
||||||
"divider": true
|
"spacing": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": 10,
|
"type": 10,
|
||||||
"content": "type s/0/[choice] where [choice] is your selected option to choose your path!"
|
"content": "-# send \"s/0/[choice]\" where [choice] is your selected option to choose your path!"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -35,7 +47,7 @@
|
|||||||
<meta name="theme-color" content="#5865f2">
|
<meta name="theme-color" content="#5865f2">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<p class="p1">test</p>
|
<p class="p1">you should not see this. contact lockeshor@lockeshor.com</p>
|
||||||
|
|
||||||
|
|
||||||
</body></html>
|
</body></html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
from flask import Flask, request, render_template
|
from flask import Flask, request, send_file
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@@ -12,8 +12,11 @@ def mainPage():
|
|||||||
def game(path):
|
def game(path):
|
||||||
if "Discord" not in str(request.user_agent):
|
if "Discord" not in str(request.user_agent):
|
||||||
return mainPage()
|
return mainPage()
|
||||||
|
gameName = request.path.split("/")[1]
|
||||||
|
if gameName == "img":
|
||||||
|
print("returning image", "images/" + request.path.split("/")[-1].replace(".", "")[:-3] + ".png")
|
||||||
|
return send_file("images/" + request.path.split("/")[-1].replace(".", "")[:-3] + ".png", mimetype="image/png")
|
||||||
gamecode = request.args.get('code')[:-1]
|
gamecode = request.args.get('code')[:-1]
|
||||||
gameName = request.path[1:]
|
|
||||||
print(gameName)
|
print(gameName)
|
||||||
return buildHTML(gamecode,gameName)
|
return buildHTML(gamecode,gameName)
|
||||||
|
|
||||||
@@ -31,11 +34,22 @@ def buildHTML(gamecode, gameName):
|
|||||||
choices = ""
|
choices = ""
|
||||||
for i in range(len(info["choices"])):
|
for i in range(len(info["choices"])):
|
||||||
choice = info["choices"][i]
|
choice = info["choices"][i]
|
||||||
choices += f"{(i + 1) * 10}: " + choice["text"] + "\\n"
|
choiceText = f"{(i + 1) * 10}: " + choice["text"].replace('"', '\\"') + "\\n"
|
||||||
print(str(request.user_agent) + "\n",currText,choices)
|
choices += f"""{{
|
||||||
|
"type": 10,
|
||||||
|
"content": "{choiceText}"
|
||||||
|
}},"""
|
||||||
|
color = story["SPECIAL-color"] if "SPECIAL-color" in story.keys() else "0"
|
||||||
|
print(str(request.user_agent) + "\n",currText,choices,color)
|
||||||
|
|
||||||
with open('page.html', "r") as page:
|
with open('page.html', "r") as page:
|
||||||
return page.read().replace("{{CurrText}}", currText.replace('"', '\\"')).replace("{{Choices}}", choices.replace('"', '\\"'))
|
page = page.read()
|
||||||
|
page = page.replace("{{CurrText}}", currText.replace('"', '\\"'))
|
||||||
|
page = page.replace("{{Choices}}", choices)
|
||||||
|
page = page.replace("{{Color}}", color)
|
||||||
|
page = page.replace("{{StoryName}}", gameName.replace(".", ""))
|
||||||
|
print(page)
|
||||||
|
return page
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True, port=1387)
|
app.run(debug=True, port=1387)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"SPECIAL-color": "8388863",
|
||||||
"start": {
|
"start": {
|
||||||
"text": "Willow wants water. She screams at the top of her lungs. What do you do?",
|
"text": "Willow wants water. She screams at the top of her lungs. What do you do?",
|
||||||
"choices": [
|
"choices": [
|
||||||
|
|||||||
Reference in New Issue
Block a user