Skip to main content

Crate botkit_cli

Crate botkit_cli 

Source
Expand description

botkit-cli: an IM platform implemented as an agent-friendly CLI.

Instead of talking to Discord/Telegram/Matrix, a CliBot speaks a JSONL wire protocol: drivers inject Inbound events (messages, commands, button presses, reactions, edits — with media, stickers, threads, and replies) and observe every Outbound action the bot performs (messages, files, reactions, edits, deletes, pins, typing indicators).

Two transports:

  • Transport::Stdio — stdin/stdout, for cargo run debugging.
  • Transport::Unix — a unix socket the botkit-cli driver binary connects to, for driving a long-running bot process.

Transport::Manual attaches nothing: the owner injects and subscribes through the CliHub handle directly (tests, in-process embedding).

use botkit_cli::{CliBot, Transport};
use botkit_core::Bot;

let bot = CliBot::new(Transport::Stdio)
    .command("ping", || async { "pong" })
    .message(|ctx: botkit_core::Context| async move {
        format!("echo: {}", ctx.message_content().unwrap_or(""))
    });
bot.run().await?;

Re-exports§

pub use wire::Inbound;
pub use wire::Outbound;

Modules§

wire
The JSONL wire protocol shared by the bot-side transport and the botkit-cli driver binary.

Structs§

CliActionSender
Chat action sender that reports indicators as outbound action lines.
CliBot
A bot whose “platform” is the CLI wire protocol.
CliContextData
Per-event context for the CLI platform.
CliHub
Shared CLI-platform state.

Enums§

Transport
How the CLI platform moves events and actions.