Skip to main content

garudust_platforms/
lib.rs

1//! Chat platform adapters for Garudust agents.
2//!
3//! Each adapter implements [`garudust_core::platform::PlatformAdapter`] and
4//! connects the agent to an external messaging platform.  Enable only the
5//! platforms you need via Cargo features.
6//!
7//! # Feature flags
8//!
9//! | Feature | Platform | Adapter |
10//! |---|---|---|
11//! | `telegram` *(default)* | Telegram Bot API | [`telegram::TelegramAdapter`] |
12//! | `webhook` *(default)* | HTTP Webhook | [`webhook::WebhookAdapter`] |
13//! | `discord` | Discord Gateway | [`discord::DiscordAdapter`] |
14//! | `slack` | Slack RTM/Events | [`slack::SlackAdapter`] |
15//! | `matrix` | Matrix (Element) | [`matrix::MatrixAdapter`] |
16//! | `line` | LINE Messaging API | [`line::LineAdapter`] |
17//! | `all` | All of the above | — |
18//!
19//! # Example — running Telegram and a webhook simultaneously
20//!
21//! ```no_run
22//! use std::sync::Arc;
23//! use garudust_platforms::{telegram::TelegramAdapter, webhook::WebhookAdapter};
24//! use garudust_core::platform::{MessageHandler, PlatformAdapter};
25//!
26//! async fn start(handler: Arc<dyn MessageHandler>) -> anyhow::Result<()> {
27//!     let tg = TelegramAdapter::new(std::env::var("TELEGRAM_TOKEN")?);
28//!     let wh = WebhookAdapter::new(3001);
29//!     tg.start(handler.clone()).await?;
30//!     wh.start(handler).await?;
31//!     Ok(())
32//! }
33//! ```
34
35#[cfg(feature = "telegram")]
36pub mod telegram;
37
38#[cfg(feature = "discord")]
39pub mod discord;
40
41#[cfg(feature = "webhook")]
42pub mod webhook;
43
44#[cfg(feature = "slack")]
45pub mod slack;
46
47#[cfg(feature = "matrix")]
48pub mod matrix;
49
50#[cfg(feature = "line")]
51pub mod line;
52
53#[cfg(feature = "whatsapp")]
54pub mod whatsapp;