| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This can instead check the `guild_id` structfield, so the cache is no longer
required.
|
| | |
|
| |
|
|
|
| |
Fix the compilation of `GuildChannel::_permissions_for` when the `cache` feature
is disabled.
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
| |
On certain feature combinations, compilation and tests would not function
correctly.
This commit goes through a number of feature combinations and gates some tests
behind the required features and fixes other compilation errors.
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
|
| |
Instead, using the structfield is preferred, since that comes from gateway
events directly now anyway.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
this allows stateless bots to drop the need for a channel->guild mapping
(cherry picked from commit 74bb8fa5a3b4b5fd43559866b4627bf09484f6ae)
|
| | |
|
| | |
|
| |
|
|
|
| |
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.
|
| |
|
|
|
| |
Fix broken links caused by the `model` module changes in v0.5.0, which
split up the module into sub-modules for better organization.
|
| |
|
|
|
|
| |
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 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Further generic-ify the `after` parameter on the `reaction_users` method
of the following structs:
- `ChannelId`
- `Group`
- `GuildChannel`
- `Message`
- `Channel`
- `GuildChannel`
Do this by changing the `U` trait bound from `Into<UserId>` to
`Into<Option<UserId>>`.
This resolves problems determining types when passing `None` as the
argument, as reported in #247.
|
| |
|
|
| |
This also fixes no-builder compilation
|
| | |
|
| |
|
|
|
|
|
| |
Add missing 'num' implementations from the following models:
- `channel::{ChannelType, MessageType}`
- `gateway::GameType`
|
| |
|
|
|
|
| |
By negating hashing altogether.
The increase is around 1000-ish nanoseconds saved.
|
| |
|
|
|
|
|
|
|
|
| |
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)
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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};
```
|
| | |
|
| |
|
|
|
|
| |
Add a `user` method to `Reaction::user`, which retrieves the User who
made the reaction. This will check the cache for the user and, if either
disabled or not found, falls back to hitting the REST API.
|
| |
|
|
|
|
| |
Adds a `channel` method to `model::Reaction`, which retrieves the
channel the reaction was made in from the Cache, falling back to hitting
the REST API if one was not found (or the cache is disabled).
|
| | |
|
| |
|
|
|
|
|
| |
Documents that the following `model::Reaction` methods hit the REST API:
- `message`
- `users`
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|