BothDocumentation Index
Fetch the complete documentation index at: https://docs.photon.codes/docs/llms.txt
Use this file to discover all available pages before exploring further.
react and reply live directly on an incoming message. They no-op silently on platforms that don’t support the feature — no try/catch required.
Spectrum also exports first-class reaction() and reply() content builders that you can pass directly to space.send(...) — the sugar methods on message delegate through the same send pipeline.
Reactions
- Sugar (message.react)
- Canonical (space.send)
message.react(emoji) delegates to space.send(reaction(emoji, message)) internally.
The reaction string is platform-specific. For iMessage, use the built-in tapback constants:
reaction() rejects reaction messages as targets — reacting to a reaction throws at build time.
Available tapbacks:
| Constant | Value |
|---|---|
imessage.tapbacks.love | "love" |
imessage.tapbacks.like | "like" |
imessage.tapbacks.dislike | "dislike" |
imessage.tapbacks.laugh | "laugh" |
imessage.tapbacks.emphasize | "emphasize" |
imessage.tapbacks.question | "question" |
Threaded replies
- Sugar (message.reply)
- Canonical (space.send)
message.reply(content) wraps each content item in reply(content, message) and delegates to space.send(...) internally.
On platforms with thread support (iMessage, WhatsApp Business), this sends a threaded reply. On platforms without, the call resolves as a no-op — the reply is not downgraded to a regular send. If you need guaranteed delivery, use space.send(...) instead.
reply() cannot wrap reply, edit, reaction, group, or typing content — the builder throws at construction time.
Editing messages
- Sugar (message.edit)
- Canonical (space.send)
edit() takes new content and the outbound message to rewrite. Edits are fire-and-forget — space.send(edit(...)) resolves to undefined.
edit() cannot wrap edit, reply, reaction, group, or typing content.
When to use what
| Want to | Use |
|---|---|
| Send fresh content into the conversation | space.send(...) |
| Reply in-thread to a specific message | message.reply(...) or space.send(reply(...)) |
| React to a specific message | message.react(emoji) or space.send(reaction(emoji, message)) |
| Rewrite a sent message | message.edit(content) or space.send(edit(content, message)) |
space.send is the safe default — it works on every platform. The sugar methods (message.reply, message.react, message.edit) and the canonical content builders (reply(), reaction(), edit()) are interchangeable — they both route through the same send pipeline.