diff options
| author | Austin Hellyer <[email protected]> | 2016-11-29 11:22:33 -0800 |
|---|---|---|
| committer | Austin Hellyer <[email protected]> | 2016-11-29 11:22:09 -0800 |
| commit | b7f70c6252125a1739066b531ea9e5dff07592a1 (patch) | |
| tree | 9845d27a7c978d5488bf5bd8ffc04cfbcd184448 /examples/06_command_framework/src | |
| parent | Remove duplicated gateway logic (diff) | |
| download | serenity-b7f70c6252125a1739066b531ea9e5dff07592a1.tar.xz serenity-b7f70c6252125a1739066b531ea9e5dff07592a1.zip | |
Add initial audio support
Audio can be played with support by passing one of the following into
the `Handler::play` method:
`serenity::ext::voice::{ffmpeg, pcm, ytdl}` functions, where
- `ffmpeg` accepts a path (such as a `File`);
- `pcm` accepts a raw reader source;
- `ytdl` accepts a URI, which works with everything youtube-dl supports:
<https://github.com/rg3/youtube-dl/blob/master/docs/supportedsites.md>
The source can be stopped via [`Handler::stop`].
Receive is supported through [`Handler::listen`], which accepts a
`serenity::ext::voice::AudioReceiver` implementation.
An example is provided in the form of the file located at
`./examples/07_voice.rs`, which can be run by cloning the repo and
performing the command `cargo run --example 07_voice`. Prior to running
the command, set a bot token as the value of the env variable
`DISCORD_TOKEN`. The example supports:
- `deafen`: deafens the bot;
- `join`: joins a voice channel by ID. The example is a primitive
implementation, and requires the ID of the channel to be passed to the
bot as a command of `~join 131937933270712320`;
- `leave`: leaves the current voice channel, if in one;
- `mute`: mutes the bot and will continue to play source audio;
- `play`: plays source audio from a URI, through a command like
`~play https://www.youtube.com/watch?v=5KJjBRm0ElA`;
- `ping`: responds with "Pong!" to ensure the bot is working properly;
- `undeafen`: undeafens the bot, if that's actually a word;
- `unmute`: unmutes the bot.
Documentation for audio can be found at:
<https://serenity.zey.moe/serenity/ext/voice/index.html>
Diffstat (limited to 'examples/06_command_framework/src')
0 files changed, 0 insertions, 0 deletions