| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
| |
Switch from using `#[doc(hidden)]` to hide some internal functions to
`pub(crate)`.
The library now requires rustc 1.18.
|
| |
|
| |
Use the client ID instead of the user ID.
|
| |
|
|
| |
All codepaths result in Some value, so it doesn't need to be optional.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Negative message nonces caused deserialization errors, as serde would
not deserialize integers into strings.
To fix this, change `Message::nonce` into an `Option<Snowflake>` from an
`Option<String>`. This new `Snowflake` is a wrapper around an `i64`. Use
a new `I64Visitor` to deserialize i64s, u64s, and strs into the wanted
i64.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Instead of accepting a `&str`, make `User::direct_message` and
`User::dm` accept a `CreateMessage` builder for consistency with related
functions.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Chrono is easier to use than timestamped strings, so they should be
automatically deserialized and available for the user, instead of having
the user deserialize the strings themselves.
These fields have been changed to use a type of `DateTime<FixedOffset>`:
- `ChannelPinsUpdateEvent.last_pin_timestamp`
- `Group.last_pin_timestamp`
- `Guild.joined_at`
- `GuildChannel.last_pin_timestamp`
- `Invite.created_at`
- `Member.joined_at`
- `Message.edited_timestamp
- `Message.timestamp`
- `MessageUpdateEvent.edited_timestamp`
- `MessageUpdateEvent.timestamp`
- `PrivateChannel.last_pin_timestamp`
`Member.joined_at` is now also an `Option`. Previously, if a Guild
Member Update was received for a member not in the cache, a new Member
would be instantiated with a default String value. This is incorrect
behaviour, and has now been replaced with being set to `None` in that
case.
Id methods' `created_at()` method now return a `chrono::NaiveDateTime`
instead of a `time::Timespec`, and `User::created_at` has been updated
to reflect that.
Additionally, drop `time` as a direct dependency and use chrono for
internals.
|
| |
|
|
|
| |
These functions return the user's avatar URL, or their default avatar
URL as a fallback.
|
| | |
|
| |
|
|
|
|
| |
Helper methods such as `GuildChannel::send_files` linked to the
documentation for `ChannelId::send_file`, when they should be linking
to `ChannelId::send_files`.
|
| |
|
|
|
| |
With the way AttachmentType is meant to be used by `http::send_files`,
none of the values need to be moved, they only need to be borrowed.
|
| |
|
|
|
| |
Instead of fully qualifying the namespace when using
`std::mem::replace`, use just `mem::replace`.
|
| |
|
|
|
|
| |
The logic for the `User` and `CurrentUser` avatar methods (`avatar_url`,
`default_avatar_url`, `static_avatar_url`) were duplicated, so move the
logic out and have each method simply call the related function.
|
| |
|
|
|
| |
Add `default_avatar_url` to `CurrentUser` to match `User`'s avatar
functions.
|
| |
|
|
|
| |
The method can be used as a shortcut for retrieving a message's channel
from the cache.
|
| |
|
| |
Deprecate `Role::edit_role` and rename it to `Role::edit`.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
An internal `tag` function created in a previous commit is only required
for use when the `"model"` feature is enabled, but the function itself
was not gated behind the feature.
|
| |
|
|
|
|
| |
The function no longer fit's a short-lived period of serenity's design,
where it would have been preferred to do `User::get(ID)` over
`UserId(ID).get()`.
|
| |
|
|
|
|
|
|
|
|
| |
`distinct`, although accurate, is an odd name for the method. Deprecate
`distinct` on `CurrentUser` and `User` and rename them to `tag`.
Additionally, optimize the creation of the resultant String by about 2x.
Instead of using the `format!` macro, create a new String with a
capacity of 37 and push the username, `'#'`, and write the discriminator
in manually.
|
| | |
|
| | |
|
| |
|
|
| |
This can be used as a helpful shortcut for reactions.
|
| | |
|
| |
|
|
|
| |
Change `Guild::create_channel` to take a non-mutable reference, as
mutability isn't required.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the deprecated GuildChannel methods in preparation of an
incoming commit modifying GuildChannel.
Remove the following deprecated methods:
- `get_invites`
- `get_message`
- `get_messages`
- `get_reaction_users`
- `get_webhooks`
|
| |
|
|
|
|
|
|
|
|
|
| |
If http::send_file received a non-success status code due to reasons
such as sending to an invalid channel Id, not having permissions, or
sending too large of a file, then it would still try to deserialize
a response as if it were valid.
To fix this, ensure that the response is successful. Document that if
the file sent is too large, then
`HttpError::InvalidRequest(PayloadTooLarge)` is returned.
|
| |
|
|
| |
A link to model::permissions::SEND_MESSAGES was broken.
|
| |
|
|
|
|
| |
The examples didn't bring `model::PermissionOverwriteType` into scope.
Additionally, wrap the examples in try_main's to make use of the `?`
operator.
|
| |
|
|
|
| |
{ChannelId,GuildChannel}::create_permission don't need to take
ownership over the overwrite, so just accept a reference.
|
| |
|
|
|
| |
A new verification level was added for guilds with a value of 4, which
means "Must have a verified phone on their Discord account."
|
| |
|
|
|
| |
The struct was previously in `src/model/channel/message.rs` instead of
its own `src/model/channel/reaction.rs` file.
|
| | |
|
| |
|
|
| |
These reactions are added onto the `MessageCreate` builder, and are sent
after the message has been created.
|
| |
|
|
|
| |
Add examples to some functions, and update some of the old examples to
use the `?` operator instead of unwrapping.
|
| |
|
|
|
| |
Add fields in struct instantiation for the new stats fields introduced
by the recent invite stats commit.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modules are now separated into a fashion where the library can be used
for most use cases, without needing to compile the rest.
The core of serenity, with no features enabled, contains only the
struct (model) definitions, constants, and prelude. Models do not have
most functions compiled in, as that is separated into the `model`
feature.
The `client` module has been split into 3 modules: `client`, `gateway`,
and `http`.
`http` contains functions to interact with the REST API. `gateway`
contains the Shard to interact with the gateway, requiring `http` for
retrieving the gateway URL. `client` requires both of the other features
and acts as an abstracted interface over both the gateway and REST APIs,
handling the event loop.
The `builder` module has been separated from `utils`, and can now be
optionally compiled in. It and the `http` feature are required by the
`model` feature due to a large number of methods requiring access to
them.
`utils` now contains a number of utilities, such as the Colour struct, the
`MessageBuilder`, and mention parsing functions.
Each of the original `ext` modules are still featured, with `cache` not
requiring any feature to be enabled, `framework` requiring the `client`,
`model`, and `utils`, and `voice` requiring `gateway`.
In total the features and their requirements are:
- `builder`: none
- `cache`: none
- `client`: `gateway`, `http`
- `framework`: `client`, `model`, `utils`
- `gateway`: `http`
- `http`: none
- `model`: `builder`, `http`
- `utils`: none
- `voice`: `gateway`
The default features are `builder`, `cache`, `client`, `framework`,
`gateway`, `model`, `http`, and `utils`.
To help with forwards compatibility, modules have been re-exported from
their original locations.
|
| | |
|
| |
|
|
| |
We removed these a long time ago, and these were missed.
|
| |
|
|
|
| |
Add helper methods to easily produce invite URLs, such as
`"https://discord.gg/WxZumR"`.
|
| |
|
|
| |
Add a method to calculate a member's permissions in the channel.
|
| |
|
|
|
|
|
|
|
|
| |
When message type 7 is received from the gateway, transform the content
if the type is 7 to a proper greeting.
Additionally, when the type is 6, provide a proper content notifying that a
user has pinned a message to the channel.
These transformations are not done at REST-level when retrieving messages, and
are instead done in `ChannelId::message` and `ChannelId::messages`.
|
| |
|
|
|
|
|
| |
Previously retrieving an invite with the `?with_counts=true` wasn't possible.
Added support to `get_invite` for retrieving an invite with the counts, this requires the user to pass true to the function.
The counts include `approximate_presence_count` and `approximate_member_count` which have been added to the `Invite` stuct, as well as `text_channel_count` and `voice_channel_count` to the `InviteGuild` struct.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
When performing an action on a DM Channel or Group, an arbitrary
permission check would always fail, causing the action to error out with
a lacking permissions error.
To fix this, just assume the action will always succeed.
|