| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
Adds a `user_id` method to `Member`, which is a shortcut for retrieving the
member's user ID.
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
| |
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`.
|
| |
|
|
| |
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`.
|
| |
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
Add a function to determine which of two members has the higher
role hierarchy.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
While building permissions in the `Guild::permissions_in` function -
which is relied upon by most model functions to check CurrentUser
permissions - the channel overwrites of the given channel were iterated
over incorrectly.
The channel overwrites were iterated over in a non-specified order,
resulting in overwrites being applied in a random order. However,
Discord operates by applying permissions from a down-top order: role ID
0 is below role ID 1, which is below role ID 2, etc. This means that
prior to applying permissions we must first sort by position so that
lower positioned roles are iterated over first.
|
| | |
|
| |
|
|
|
|
| |
By negating hashing altogether.
The increase is around 1000-ish nanoseconds saved.
|
| |
|
|
|
|
|
| |
Use rfind, in case there's more '#' in username than just the discriminator
Split at pos+1 instead of pos and remove the trailing '#' in the split.0 (Name)
Fix bug with parsing
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Adds an animated structfield to `Emoji` and `ReactionType`'s `Custom`
variant, which defaults to false if not present.
A test has been added for deserializing it, taken from a REST API GET
Emojis response.
(cherry picked from commit 5286949f424e824784344ebb7b7af4e52fb819c3)
|
| |
|
|
|
|
|
| |
Fix the deserialization of `model::guild::Guild` when
`Guild::system_channel_id` is not present.
Additionally, add a test case for this.
|
| |
|
|
|
| |
Fix clippy lints and subsequently accept references for more function
parameters.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The `model` module has historically been one giant module re-exporting
all of the model types, which is somewhere around 100 types. This can be
a lot to look at for a new user and somewhat overwhelming, especially
with a large number of fine-grained imports from the module.
The module is now neatly split up into submodules, mostly like it has
been internally since the early versions of the library. The submodules
are:
- application
- channel
- error
- event
- gateway
- guild
- id
- invite
- misc
- permissions
- prelude
- user
- voice
- webhook
Each submodule contains types that are "owned" by the module. For
example, the `guild` submodule contains, but not limited to, Emoji,
AuditLogsEntry, Role, and Member. `channel` contains, but not limited
to, Attachment, Embed, Message, and Reaction.
Upgrade path:
Instead of glob importing the models via `use serenity::model::*;`,
instead glob import via the prelude:
```rust
use serenity::model::prelude::*;
```
Instead of importing from the root model module:
```rust
use serenity::model::{Guild, Message, OnlineStatus, Role, User};
```
instead import from the submodules like so:
```rust
use serenity::model::channel::Message;
use serenity::model::guild::{Guild, Role};
use serenity::model::user::{OnlineStatus, User};
```
|
| |
|
|
|
|
|
| |
Fix the deserialization of the `Guild::application_id` structfield.
Additionally, create a new ID type for it.
A test has been added for this.
|
| |
|
|
|
|
| |
Changes the types of `Guild` and `PartialGuild`'s
`default_message_notifications` and `mfa_level` structfields to be a bit
more type-strong.
|
| |
|
|
|
|
|
|
| |
Adds the following missing fields to the Guild model:
- `application_id`
- `explicit_content_filter`
- `system_channel_id`
|
| | |
|
| | |
|
| | |
|
| |\ |
|
| | |
| |
| |
| |
| |
| | |
Fixes what is realistically a bug where `Member::permissions` would
retrieve the permissions for the Member in the default channel of the
guild. This now only returns the guild-level permissions of the member.
|
| | |
| |
| |
| |
| |
| | |
Rename `Guild::permissions_for` to `Guild::permissions_in`, deprecating
`Guild::permissions_for` which is only an inline method to
`permissions_in`.
|
| | |
| |
| |
| |
| |
| | |
Make `Guild`'s internal method `has_perms` go through
`Guild::member_permissions` to check permissions, since all method that
use it don't need channel-specific permissions.
|