Skip to main content

botkit_cli/
lib.rs

1//! botkit-cli: an IM platform implemented as an agent-friendly CLI.
2//!
3//! Instead of talking to Discord/Telegram/Matrix, a `CliBot` speaks a JSONL
4//! wire protocol: drivers inject [`Inbound`] events (messages, commands,
5//! button presses, reactions, edits — with media, stickers, threads, and
6//! replies) and observe every [`Outbound`] action the bot performs
7//! (messages, files, reactions, edits, deletes, pins, typing indicators).
8//!
9//! Two transports:
10//!
11//! - [`Transport::Stdio`] — stdin/stdout, for `cargo run` debugging.
12//! - [`Transport::Unix`] — a unix socket the `botkit-cli` driver binary
13//!   connects to, for driving a long-running bot process.
14//!
15//! [`Transport::Manual`] attaches nothing: the owner injects and subscribes
16//! through the [`CliHub`] handle directly (tests, in-process embedding).
17//!
18//! ```ignore
19//! use botkit_cli::{CliBot, Transport};
20//! use botkit_core::Bot;
21//!
22//! let bot = CliBot::new(Transport::Stdio)
23//!     .command("ping", || async { "pong" })
24//!     .message(|ctx: botkit_core::Context| async move {
25//!         format!("echo: {}", ctx.message_content().unwrap_or(""))
26//!     });
27//! bot.run().await?;
28//! ```
29
30mod bot;
31mod context;
32mod hub;
33mod transport;
34pub mod wire;
35
36pub use bot::CliBot;
37pub use context::{CliActionSender, CliContextData};
38pub use hub::CliHub;
39pub use transport::Transport;
40pub use wire::{Inbound, Outbound};