| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This will allow the command macro to be used in sub-modules.
|
| | |
|
| | |
|
| |
|
|
| |
Add a Blurple colour with RGB value 114,137,218.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
The status routes were missing from the HTTP module (now the REST
module) rewrite, as well as the `GET /guilds/:id/members` route. In
addition, remove an unnecessary counter to the global ratelimit mutex.
|
| |
|
|
|
|
|
|
| |
The examples include a README located in `examples/README.md`, which
contains instructions for running these examples.
They act as a simple form of tutorial to the library, without getting
into too many details.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
The script was made with the eventual purpose to build custom docs.
This has been replaced by [cargo-external-doc], which was released a
few days after the script was added.
Since the only other purpose of the script besides adding the image has
been fulfilled by another crate, we can just utilize a rustdoc attribute
to do this.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These hooks will each be run prior to or after the command, and will
finish execution before executing the command.
These can be configured in a Framework via:
```rs
client.with_framework(|f| f
.before(|_context, message, _command_name| {
println!("Got command '{}'", command_name);
})
.after(|_context, _message, command_name| {
println!("Finished command '{}'", command_name);
}));
```
This does introduce a backwards compatibility break, by requiring
commands' Context/Message to be borrowed
Upgrade path:
If not using the `command!` macro, modify command signatures from:
```rs
fn some_command(context: Context, message: Message, args: Vec<String>)
```
to
```rs
fn some_command(context: &Context, message: &Message, args: Vec<String>)
```
|
| |
|
|
|
| |
Add documentation for some missing methods - such as Game methods - and
add more methods to the Message Builder.
|
| |
|
|
|
| |
When a guild delete is received, add its Id to the unavailable guild list,
and when a create is received, remove it.
|
| | |
|
| |
|
|
|
| |
Add documentation for Context methods, as well as brief documentation
for REST functions and model definitions.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Additionally, allow it to search the groups' and private channels' maps
in the cache. As these are usually O(1) operations, it's cheap to allow,
in comparison to the current unoptimized method of getting a guild's
channel.
|
| |
|
|
|
|
| |
There aren't many things behind this flag (6), and it only causes
annoyances for locally-generated docs, which won't show these
mostly-useful items behind the flag.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is an 'extras'-enabled function to get a guild's channel. This will
allow a simple Option pattern match over the result, rather than working
with an Option<Channel<T>>.
Example of old code vs. new code, in the context of an event handler:
Old:
```rs
use serenity::cache::CACHE;
use serenity::model::Channel;
let cache = CACHE.read().unwrap();
let channel = match cache.get_channel(channel_id) {
Some(Channel::Guild(channel)) => channel,
Some(Channel::Private(_)) => {
context.say("Groups and DMs not supported")
.map_err(|x| println!("Err sending message: {:?}", why);
return;
},
None => {
context.say("Could not find channel")
.map_err(|x| println!("Err sending message: {:?}", x);
return;
},
}
```
New:
```rs
use serenity::cache::CACHE;
let cache = CACHE.read().unwrap();
let channel = match cache.get_guild_channel(channel_id) {
Some(channel) => channel,
None => {
context.say("Could not find channel")
.map_err(|x| println!("Err sending message: {:?}", x));
return;
},
};
```
|
| |
|
|
|
|
|
| |
Conditional compiles with the 'methods' feature enabled - but the
'cache' feature disabled - were supported, but methods would call an
empty function to check if the current user has permissions. Instead,
put these function calls behind macros which check for feature cfgs.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The events were cluttering the `model` module, and so are now moved into
their own `model::event` module.
As users should not usually have to work with events all that much -
only currently in some rarely used event handlers - this change should
not be much more effort to import from.
i.e.:
```rs
use serenity::model::event::ChannelPinsAckEvent;
```
vs. the now-old:
```rs
use serenity::model::ChannelPinsAckEvent;
```
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Some of the methods relied on the cache being present. Now, these
methods only conditionally require the cache to be compiled and
present.
The cache was mainly used for checking if the current user had
permission to perform operations.
|
| | |
|
| |
|
|
|
|
|
| |
This may turn out to be a bad idea, but this causes a reconnect, as part
of the catch-all `rust-websocket` crate error handling. Since this
variant in particular doesn't seem directly harmful to ignore, it may be
better to just throw away than to reconnect.
|
| |
|
|
|
|
|
| |
90% of use cases require embed fields to be inlined, so it's a better
default.
Also this makes the documentation accurate.
|
| | |
|