Delete your own board messages; drop chips name their item
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
70246f78ea
commit
2eed9b7ec4
4 changed files with 28 additions and 4 deletions
11
app.py
11
app.py
|
|
@ -330,6 +330,14 @@ class Handler(BaseHTTPRequestHandler):
|
|||
return "There's no raid to stand guard for"
|
||||
player["garrison"] = bool(body.get("join"))
|
||||
return None
|
||||
if path == "/api/board/delete":
|
||||
message = next((m for m in world["board"] if m.get("id") == body.get("id")), None)
|
||||
if not message:
|
||||
return "That message is gone"
|
||||
if message["who"] != player["id"]:
|
||||
return "You can only delete your own messages"
|
||||
world["board"].remove(message)
|
||||
return None
|
||||
if path == "/api/aid":
|
||||
return game.aid_problem(world, player, str(body.get("kind")), str(body.get("item")), str(body.get("source")), now)
|
||||
if path == "/api/hire":
|
||||
|
|
@ -358,7 +366,8 @@ class Handler(BaseHTTPRequestHandler):
|
|||
text = str(body.get("text", "")).strip()[:500]
|
||||
if not text:
|
||||
return "Say something"
|
||||
world["board"].append({"at": now, "who": player["id"], "text": text})
|
||||
world["next_message_id"] = world.get("next_message_id", 1) + 1
|
||||
world["board"].append({"id": world["next_message_id"] - 1, "at": now, "who": player["id"], "text": text})
|
||||
del world["board"][:-game.MAX_LOG]
|
||||
return None
|
||||
return "Not found"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue