| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
| |
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.
|
| |
|
|
|
|
| |
When using `Guild::greater_member_hierarchy`, check if both user IDs are
the same (returning None) or if one of them is the guild owner, in which
case the guild owner's ID is returned.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
When editing messages, not all fields are applicable. Attachments, TTS,
and reactions are not applicable. To help with this distinction,
separate message editing into a different builder.
|
| |
|
|
|
|
|
|
| |
If a presence update for a guild comes in and their associated member
instance is not present (e.g. in a large guild that wasn't member
chunked), then create one with the infomation known out of the presence
update. This includes their user information, guild ID, nickname, and
roles, but not their `deaf`, `joined_at`, and `mute` state.
|
| | |
|
| |
|
|
|
|
|
|
| |
Update the docs for `User::has_role` to reflect that
`Into<GuildContainer>` is only implemented for `PartialGuild`,
`GuildId`, and `u64`, not `Guild`.
(cherry picked from commit 00deef894ec458ac8abff914ed864ea63c47eda6)
|
| | |
|
| | |
|