Crate songbird[][src]

project 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.

Re-exports

pub use audiopus as opus;
pub use discortp as packet;
pub use serenity_voice_model as model;
pub use typemap_rev as typemap;
pub use crate::driver::Driver;
pub use crate::events::Event;
pub use crate::events::EventHandler;
pub use crate::tracks::create_player;
pub use crate::serenity::*;

Modules

constants

Constants affecting driver function and API handling.

driver

Runner for a voice connection.

error

Driver and gateway error handling.

events

Events relating to tracks, timing, and other callers.

id

Newtypes around Discord IDs for library cross-compatibility.

input

Raw audio input data streams and sources.

serenity

Compatability and convenience methods for working with serenity. Requires the "serenity-rustls" or "serenity-native" features.

shards

Handlers for sending packets over sharded connections.

tracks

Live, controllable audio instances.

Structs

Call

The Call handler is responsible for a single voice connection, acting as a clean API above the inner state and gateway message management.

ConnectionInfo

Parameters and information needed to start communicating with Discord's voice servers, either with the Songbird driver, lavalink, or other system.

Songbird

A shard-aware struct responsible for managing Calls.

Enums

Bitrate
CoreEvent

Voice core events occur on receipt of voice packets and telemetry.

EventContext

Information about which tracks or data fired an event.

TrackEvent

Track events correspond to certain actions or changes of state, such as a track finishing, looping, or being manually stopped. Voice core events occur on receipt of voice packets and telemetry.

Functions

ffmpeg

Opens an audio file through ffmpeg and creates an audio source.

ytdl

Creates a streamed audio source with youtube-dl and ffmpeg.