| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
| |
Have serde default on the `presences` and `private_channels`
structfields of `Ready`. Some JSON serializers might leave these out
when serializing if they're empty, so resolve this by simply defaulting
to empty maps.
|
| | |
|
| | |
|
| |
|
|
|
| |
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};
```
|
| |
|
|
| |
Fixes #180, however this partially breaks `single_zc` and `multiple_quoted`, but since they're minor it's better to fix them later for now.
|
| |
|
|
|
|
|
| |
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`
|
| | |
|
| |\ |
|
| | |
| |
| |
| |
| |
| | |
Following up on the recent commit to fix the snowflake types'
deserializers, this commit fixes the rest of the library's usage of
deserializers in the same manner.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes snowflake deserializers (ChannelId, UserId, etc.) by switching
from a usage of `deserialize_u64` to `deserialize_any`.
Our usage of `deserialize_u64` was incorrect and the erroneous behaviour
was fixed in serde_json v1.0.8. We were essentially telling serde that
the received type was a u64, when in fact it can be multiple types
(strings, u64, or an i64 just in case).
This resulted in errors like:
```
Client error: Json(ErrorImpl { code: Message("invalid type: string
\"317727377985634305\", expected identifier"), line: 1, column: 100 })
```
Due to this, simple operations such as even connecting a client failed.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes snowflake deserializers (ChannelId, UserId, etc.) by switching
from a usage of `deserialize_u64` to `deserialize_any`.
Our usage of `deserialize_u64` was incorrect and the erroneous behaviour
was fixed in serde_json v1.0.8. We were essentially telling serde that
the received type was a u64, when in fact it can be multiple types
(strings, u64, or an i64 just in case).
This resulted in errors like:
```
Client error: Json(ErrorImpl { code: Message("invalid type: string
\"317727377985634305\", expected identifier"), line: 1, column: 100 })
```
Due to this, simple operations such as even connecting a client failed.
(cherry picked from commit 77f462ea2044ef7d2d12fd1289ea75a6a33cb5dd)
|
| | |
| |
| |
| | |
Also give an actual error type for `Channel` too.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Implement Deserialize for `model::event::GatewayEvent` and
`model::event::VoiceEvent`, and derive it for `model::event::Event`.
Due to the natural potential slowness of deserializing into`Event`
(attempting to deserialize into each variant until successful), a
function named `model::event::deserialize_event_with_type` is provided
for quickly deserializing into a known type if the dispatch type is
known.
|
| | |
| |
| |
| |
| |
| | |
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`
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| |\| |
|
| | | |
|
| | |
| |
| |
| |
| | |
There were a few doctests in the cache module that relied on the client
module, so instead feature-gate the doctests.
|
| | |
| |
| |
| |
| | |
The names of environment variable tokens in the examples differed, so
this makes them all use the same name.
|
| | |
| |
| |
| |
| |
| | |
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.
|
| | |
| |
| |
| |
| |
| | |
Add a method on the Guild for calculating only a member's guild-only
permissions, not including the permissions for either the default
channel or any specific channel.
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
The client now returns a Result in preparation of a future commit.
Upgrade path:
Handle the case of an error via pattern matching, or unwrap the Result.
|
| | | |
|
| | | |
|
| | | |
|