Main goal: a lot of nested future/result folding. This mainly modifies error handling for Tracks and TrackHandles to be more consistent, and hides the underlying channel result passing in get_info. Errors returned should be far clearer, and are domain specific rather than falling back to a very opaque use of the underlying channel error. It should be clearer to users why their handle commands failed, or why they can't make a ytdl track loop or similar. Also fixed/cleaned up Songbird::join(_gateway) to return in a single await, sparing the user from the underlying channel details and repeated Errs. I was trying for some time to extend the same graces to `Call`, but could not figure out a sane way to get a 'static version of the first future in the chain (i.e., the gateway send) so that the whole thing could happen after dropping the lock around the Call. I really wanted to fix this to happen as a single folded await too, but I think this might need some crazy hack or redesign.
88 lines
3.0 KiB
Rust
88 lines
3.0 KiB
Rust
#![doc(
|
|
html_logo_url = "https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird.png",
|
|
html_favicon_url = "https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird-ico.png"
|
|
)]
|
|
#![deny(missing_docs)]
|
|
#![deny(broken_intra_doc_links)]
|
|
//! ![project logo][logo]
|
|
//!
|
|
//! Songbird is an async, cross-library compatible voice system for Discord, written in Rust.
|
|
//! The library offers:
|
|
//! * A standalone gateway frontend compatible with [serenity] and [twilight] using the
|
|
//! `"gateway"` and `"[serenity/twilight]-[rustls/native]"` features. You can even run
|
|
//! driverless, to help manage your [lavalink] sessions.
|
|
//! * A standalone driver for voice calls, via the `"driver"` feature. If you can create
|
|
//! a [`ConnectionInfo`] using any other gateway, or language for your bot, then you
|
|
//! can run the songbird voice driver.
|
|
//! * And, by default, a fully featured voice system featuring events, queues, RT(C)P packet
|
|
//! handling, seeking on compatible streams, shared multithreaded audio stream caches,
|
|
//! and direct Opus data passthrough from DCA files.
|
|
//!
|
|
//! ## Intents
|
|
//! Songbird's gateway functionality requires you to specify the `GUILD_VOICE_STATES` intent.
|
|
//!
|
|
//! ## Examples
|
|
//! Full examples showing various types of functionality and integrations can be found
|
|
//! in [this crate's examples directory].
|
|
//!
|
|
//! ## Attribution
|
|
//!
|
|
//! Songbird's logo is based upon the copyright-free image ["Black-Capped Chickadee"] by George Gorgas White.
|
|
//!
|
|
//! [logo]: https://raw.githubusercontent.com/serenity-rs/songbird/current/songbird.png
|
|
//! [serenity]: https://github.com/serenity-rs/serenity
|
|
//! [twilight]: https://github.com/twilight-rs/twilight
|
|
//! [this crate's examples directory]: https://github.com/serenity-rs/songbird/tree/current/examples
|
|
//! ["Black-Capped Chickadee"]: https://www.oldbookillustrations.com/illustrations/black-capped-chickadee/
|
|
//! [`ConnectionInfo`]: struct@ConnectionInfo
|
|
//! [lavalink]: https://github.com/Frederikam/Lavalink
|
|
|
|
pub mod constants;
|
|
#[cfg(feature = "driver")]
|
|
pub mod driver;
|
|
pub mod error;
|
|
#[cfg(feature = "driver")]
|
|
pub mod events;
|
|
#[cfg(feature = "gateway")]
|
|
mod handler;
|
|
pub mod id;
|
|
pub(crate) mod info;
|
|
#[cfg(feature = "driver")]
|
|
pub mod input;
|
|
#[cfg(feature = "gateway")]
|
|
mod manager;
|
|
#[cfg(feature = "serenity")]
|
|
pub mod serenity;
|
|
#[cfg(feature = "gateway")]
|
|
pub mod shards;
|
|
#[cfg(feature = "driver")]
|
|
pub mod tracks;
|
|
#[cfg(feature = "driver")]
|
|
mod ws;
|
|
|
|
#[cfg(feature = "driver")]
|
|
pub use audiopus::{self as opus, Bitrate};
|
|
#[cfg(feature = "driver")]
|
|
pub use discortp as packet;
|
|
#[cfg(feature = "driver")]
|
|
pub use serenity_voice_model as model;
|
|
|
|
#[cfg(test)]
|
|
use utils as test_utils;
|
|
|
|
#[cfg(feature = "driver")]
|
|
pub use crate::{
|
|
driver::Driver,
|
|
events::{CoreEvent, Event, EventContext, EventHandler, TrackEvent},
|
|
input::{ffmpeg, ytdl},
|
|
tracks::create_player,
|
|
};
|
|
|
|
#[cfg(feature = "gateway")]
|
|
pub use crate::{handler::*, manager::*};
|
|
|
|
#[cfg(feature = "serenity")]
|
|
pub use crate::serenity::*;
|
|
|
|
pub use info::ConnectionInfo;
|