use foukoapi::{Bot, Platform, Result};
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "info,foukoapi=debug".into()),
)
.init();
let mut bot = Bot::new();
if let Ok(token) = std::env::var("TG_TOKEN") {
bot = bot.add_platform(Platform::telegram(token));
}
if let Ok(token) = std::env::var("DISCORD_TOKEN") {
bot = bot.add_platform(Platform::discord(token));
}
bot.command("/ping", |ctx| async move { ctx.reply("pong").await })
.command(
"/help",
|ctx| async move { ctx.reply("hi! try /ping").await },
)
.run()
.await
}