Skip to main content

Crate garudust_platforms

Crate garudust_platforms 

Source
Expand description

Chat platform adapters for Garudust agents.

Each adapter implements garudust_core::platform::PlatformAdapter and connects the agent to an external messaging platform. Enable only the platforms you need via Cargo features.

§Feature flags

FeaturePlatformAdapter
telegram (default)Telegram Bot APItelegram::TelegramAdapter
webhook (default)HTTP Webhookwebhook::WebhookAdapter
discordDiscord Gateway[discord::DiscordAdapter]
slackSlack RTM/Events[slack::SlackAdapter]
matrixMatrix (Element)[matrix::MatrixAdapter]
lineLINE Messaging API[line::LineAdapter]
allAll of the above

§Example — running Telegram and a webhook simultaneously

use std::sync::Arc;
use garudust_platforms::{telegram::TelegramAdapter, webhook::WebhookAdapter};
use garudust_core::platform::{MessageHandler, PlatformAdapter};

async fn start(handler: Arc<dyn MessageHandler>) -> anyhow::Result<()> {
    let tg = TelegramAdapter::new(std::env::var("TELEGRAM_TOKEN")?);
    let wh = WebhookAdapter::new(3001);
    tg.start(handler.clone()).await?;
    wh.start(handler).await?;
    Ok(())
}

Modules§

telegram
webhook