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.
Songbird
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 aConnectionInfousing 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.
Dependencies
Songbird needs a few system dependencies before you can use it.
- Opus - Audio codec that Discord uses.
If you are on Windows and you are using the MSVC toolchain, a prebuilt DLL is provided for you, you do not have to do anything.
On other platforms, you will have to install it. You can install the library with
apt install libopus-devon Ubuntu orpacman -S opuson Arch Linux. If you do not have it installed it will be built for you. However, you will need a C compiler and the GNU autotools installed. Again, these can be installed withapt install build-essential autoconf automake libtool m4on Ubuntu orpacman -S base-develon Arch Linux.
This is a required dependency. Songbird cannot work without it.
- FFmpeg - Audio/Video conversion tool.
You can install the tool with
apt install ffmpegon Ubuntu orpacman -S ffmpegon Arch Linux.
This is an optional, but recommended dependency. It allows Songbird to convert from, for instance, .mp4 files to the audio format Discord uses.
- youtube-dl - Audio/Video download tool.
You can install the tool with Python's package manager, pip, which we recommend for youtube-dl. You can do it with the command
pip install youtube_dl. Alternatively, you can install it with your system's package manager,apt install youtube-dlon Ubuntu orpacman -S youtube-dlon Arch Linux.
This is an optional dependency. It allows Songbird to download an audio source from the Internet, which will be converted to the audio format Discord uses.
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.
