| Commit message (Collapse) | Author | Age | Files | Lines |
| |\ |
|
| | |
| |
| |
| |
| | |
Add more `impl From<T> for Game` implementations, and make `Into<Game>` trait
bounds for all function parameters accepting a Game.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Move the unit tests into the relevant source files. There's no need for them to
be seprate, especially when the `tests` directory is meant to be for integration
tests.
The deserialization tests that include JSON files are still in the `tests` dir,
along with the public prelude re-export tests.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| |\ \ |
|
| | |/ |
|
| |/ |
|
| |
|
|
|
| |
Some lints were not resolved due to causing API changes. Most lints in the
framework were left unfixed.
|
| | |
|
| |
|
|
|
| |
Abstract the implementations for each of Channel's variants' `Mentionable`
implementations by using the underlying impl.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Instead, using the structfield is preferred, since that comes from gateway
events directly now anyway.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds an API for message caching. By default this caches 0 messages per
channel.
This can be customized when instantiating:
```rust
use serenity::cache::{Cache, Settings};
let mut settings = Settings::new();
// Cache 10 messages per channel.
settings.max_messages(10);
let cache = Cache::new_with_settings(settings);
```
After instantiation:
```rust
use serenity::cache::Cache;
let mut cache = Cache::new();
cache.settings_mut().max_messages(10);
```
And during runtime through the global cache:
```rust
use serenity::CACHE;
CACHE.write().settings_mut().max_messages(10);
```
|
| |
|
|
| |
Implements `From<&Id>` for all `Id` types, e.g. `From<&RoleId> for RoleId`.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit monomorphizes all functions, turning functions like:
```rust
fn foo<T: Into<Bar>>(baz: T) {
baz = baz.into();
// function here
}
```
Into functions like:
```rust
fn foo<T: Into<Bar>>(baz: T) {
_foo(baz.into())
}
fn _foo(baz: Bar) {
// function here
}
```
This avoids binary bloat and improves build times, by reducing the amount of
code duplication.
|
| | |
|
| |
|
|
|
|
|
|
| |
Make the `guild` structfield on `Invite` and `RichInvite` optional.
This was done due to a change in the [docs].
[docs]: https://github.com/discordapp/discord-api-docs/commit/bc0a15bd11db72644633080903171fbc3e71b026
|
| |
|
|
|
|
| |
this allows stateless bots to drop the need for a channel->guild mapping
(cherry picked from commit 74bb8fa5a3b4b5fd43559866b4627bf09484f6ae)
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Instead of calling `parking_lot::RwLock::read` on the member's guild,
call `parking_lot::RwLock::try_read` and return None early if it would
cause a deadlock.
|
| |
|
|
|
| |
Implementation `From<CurrentUser> for User` and `From<&'a CurrentUser>
for User`.
|
| | |
|
| |
|
|
|
| |
Adds the `Message::member` structfield, which contains a partial amount
of member data (deaf and mute status, role IDs, and joined_at).
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This makes them easier to be found by tools like rls.
Also update struct inits to use the shorthand version for `x: x`.
|
| | |
|
| | |
|
| |
|
|
| |
This brings the function in line with the 'tag' function for User models,
and with the official Discord app experience and other libraries.
|
| |
|
|
| |
Docs: <https://github.com/discordapp/discord-api-docs/commit/98f6643703012d2f3780ba730ce1191120f85dcd>
|
| |
|
|
|
| |
Fix broken links caused by the `model` module changes in v0.5.0, which
split up the module into sub-modules for better organization.
|
| | |
|
| |
|
|
|
|
| |
When creating a new role, correctly set its position if a position was
specified. This is because the "Create Role" endpoint no longer accepts
a `position` key.
|
| |
|
|
|
| |
Add `http::edit_guild_channel_positions`, `Guild::reorder_channels`, and
`GuildId::reorder_channels`.
|
| |
|
|
|
|
| |
In models' `delete_messages` methods, check the number of messages being
deleted. If 0 or more than 100, return a `ModelError::BulkDeleteAmount`,
as this amount would result in an invalid request.
|
| |
|
|
|
|
|
|
|
| |
Add a `member` function on `model::channel::Message` to retrieve a clone
of the author's Member instance in the channel's guild.
If the message was not sent in a guild, the guild could not be found in
the cache, or the member instance could not be found in the cache, then
`None` is returned.
|