zynko 0.1.0

Biblioteca oficial para bots do Zynko: API, gateway e voz.
Documentation
//! `zynko`: the official library for Zynko bots (docs.zynko.org/bots/rust).
//!
//! The gateway (with reconnection), caches kept current by events, the whole HTTP API, "/"
//! commands, cards and buttons. With the `voice` feature, voice rooms through LiveKit: a player
//! (ffmpeg, PCM, tones) and per-person audio.
//!
//! ```no_run
//! use zynko::{async_trait, Client, EventHandler, HandlerResult, Intents, Message};
//!
//! struct Bot;
//!
//! #[async_trait]
//! impl EventHandler for Bot {
//!     async fn message_create(&self, _ctx: Client, msg: Message) -> HandlerResult {
//!         if !msg.mine() && msg.content == "!ping" {
//!             msg.reply("pong").await?;
//!         }
//!         Ok(())
//!     }
//! }
//!
//! #[tokio::main]
//! async fn main() -> zynko::Result<()> {
//!     let client = Client::builder(std::env::var("ZYNKO_TOKEN").expect("ZYNKO_TOKEN"))
//!         .intents(Intents::GUILDS | Intents::MESSAGES)
//!         .event_handler(Bot)
//!         .build()?;
//!     client.start().await
//! }
//! ```

mod bits;
mod cache;
mod client;
mod error;
mod events;
mod gateway;
mod interaction;
mod message;
mod permissions;
pub mod player;
mod rest;
mod types;
#[cfg(feature = "voice")]
pub mod voice;

pub use async_trait::async_trait;
pub use bits::{id_time, Intents, Permissions};
pub use cache::{Cache, CachedGuild};
pub use client::{Client, ClientBuilder};
pub use error::{BoxError, Error, Result};
pub use events::{Event, EventHandler, HandlerResult, ReconnectInfo};
pub use interaction::Interaction;
pub use message::Message;
pub use permissions::compute_permissions;
pub use player::{
    tone, tone_with_volume, AudioInput, AudioPlayer, PlayerEvent, PlayerOptions, Track,
};
pub use reqwest::Method;
pub use rest::{
    CallbackType, ChannelEdit, EditOptions, FileInput, InviteOptions, MessagesQuery, NewChannel,
    NewRole, ReplyOptions, Rest, SendOptions, DEFAULT_API,
};
pub use types::*;
#[cfg(feature = "voice")]
pub use voice::{JoinVoiceOptions, VoiceConnection, VoiceEvent, VoiceStatus};

/// Picks rustls's crypto provider once, so the HTTP client, the gateway and LiveKit agree.
pub(crate) fn install_crypto() {
    static ONCE: std::sync::Once = std::sync::Once::new();
    ONCE.call_once(|| {
        let _ = rustls::crypto::aws_lc_rs::default_provider().install_default();
    });
}