reformat message and add images

This commit is contained in:
LockeShor
2026-09-19 21:33:38 -04:00
parent e5ce7f6426
commit ef6ebbba78
6 changed files with 40 additions and 13 deletions
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

+1 -1
View File
@@ -11,7 +11,7 @@
{
"component": {
"type": 17,
"accent_color": 16711680,
"accent_color": {{Color}},
"components": [
{
"type": 10,
+19 -7
View File
@@ -11,20 +11,32 @@
{
"component": {
"type": 17,
"accent_color": 16711680,
"accent_color": {{Color}},
"components": [
{
"type": 10,
"content": "{{CurrText}}\n{{Choices}}"
"type": 9,
"components": [
{
"type": 10,
"content": "## {{CurrText}}"
}
],
"accessory": {
"type": 11,
"media": {
"url": "https://adventure.lockeshor.com/img/{{StoryName}}.png"
}
}
},
{{Choices}}
{
"type": 14,
"spacing": 1,
"divider": true
"divider": false,
"spacing": 2
},
{
"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">
</head>
<body>
<p class="p1">test</p>
<p class="p1">you should not see this. contact lockeshor@lockeshor.com</p>
</body></html>
+19 -5
View File
@@ -1,5 +1,5 @@
import json
from flask import Flask, request, render_template
from flask import Flask, request, send_file
app = Flask(__name__)
@@ -12,8 +12,11 @@ def mainPage():
def game(path):
if "Discord" not in str(request.user_agent):
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]
gameName = request.path[1:]
print(gameName)
return buildHTML(gamecode,gameName)
@@ -31,11 +34,22 @@ def buildHTML(gamecode, gameName):
choices = ""
for i in range(len(info["choices"])):
choice = info["choices"][i]
choices += f"{(i + 1) * 10}: " + choice["text"] + "\\n"
print(str(request.user_agent) + "\n",currText,choices)
choiceText = f"{(i + 1) * 10}: " + choice["text"].replace('"', '\\"') + "\\n"
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:
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__':
app.run(debug=True, port=1387)
+1
View File
@@ -1,4 +1,5 @@
{
"SPECIAL-color": "8388863",
"start": {
"text": "Willow wants water. She screams at the top of her lungs. What do you do?",
"choices": [