Skip to main content

cmd_send

Function cmd_send 

Source
pub async fn cmd_send(
    room_id: &str,
    token: &str,
    to: Option<&str>,
    content: &str,
    socket: Option<&Path>,
) -> Result<()>
Expand description

One-shot send subcommand: connect, send, print echo JSON to stdout, exit.

Authenticates via token (from room join). The broker resolves the sender’s username from the token — no username arg required. When to is Some(recipient), the message is sent as a DM routed only to sender, recipient, and host.

Slash commands (e.g. /who, /dm user msg) are automatically converted to the appropriate JSON envelope, matching TUI behaviour.

socket overrides the default socket path (auto-discovered if None).