Damus
Ungovernable Misfits · 2d
How do I schedule posts on Nostr? https://blossom.primal.net/9b42419b4c27f79b3adf26475079534693f684a344dcd65bf0c27bb1076b038a.gif
Peg Otis profile picture
There isn't anything that special about posting. It is just sending signed JSON to a relay over WebSockets. You can create the JSON yourself, or use something like Will's nostril [1].

I use Deno to post, since I'm always hanging in JS land (the rep object is the output of nostril).

```
for (const i in relays) {
state[i] = state[i] || {};
state[i].envelope = new TextDecoder().decode(rep.stdout);
state[i].websocket = new WebSocket(relays[i]);
state[i].websocket.addEventListener("open", () => {
state[i].websocket.send(state[i].envelope);
});
state[i].websocket.addEventListener("message", (e) => {
state[i].data = e.data;
state[i].websocket.close();
console.log(`${e.origin}:${e.data.slice(2, 4)}`);
});
}
```
If you have the code, you can schedule anytime you like on your OS of choice. You don't have to use a special client.

[1] https://github.com/jb55/nostril