| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Upgrade `rust-websocket` to v0.20, maintaining use of its sync client.
This indirectly switches from `rust-openssl` v0.7 - which required
openssl-1.0 on all platforms - to `native-tls`, which allows for use of
schannel on Windows, Secure Transport on OSX, and openssl-1.1 on other
platforms.
Additionally, since hyper is no longer even a dependency of
rust-websocket, we can safely and easily upgrade to `hyper` v0.10 and
`multipart` v0.12.
This commit is fairly experimental as it has not been tested on a
long-running bot.
|
| |
|
|
|
|
|
|
|
|
| |
Make read/writes to the stream timeout after 90 seconds to prevent a
potentially infinitely blocked call.
If the timeout is reached, perform a reconnect.
This fixes issues such as intermittent internet issues causing a message
to never be received, and thus infinitely blocking.
|
| |
|
|
|
|
| |
When returning, the Client would return an Ok(()). Instead, return an
error, since there is currently no reason the client would return under
"okay" circumstances.
|
| |
|
|
|
|
|
|
|
|
| |
Instead of running a loop forever, have the client join threads when
they end.
This is currently a poor way of having the client eventually end, but
for now it's a duck-tape solution, as when one shard completely fails to
reboot it's an indicator of a larger issue (invalidated authentication,
intermittent network issues, etc.)
|
| |
|
|
|
| |
The logic for this was duplicated, and can be easily separated into its
own function.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
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`.
|
| |
|
|
|
|
| |
Sometimes a user might be working with a buffer of bytes in-memory and
not writing to the disk, so `http::AttachmentType` should accept an
&[u8].
|
| |
|
|
|
| |
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`.
|
| | |
|
| | |
|
| |
|
|
|
|
|
| |
Some of the methods used in the client dispatch, namely `Channel::id`
and `Message::transform_content`, are not _required_ for functionality
by the dispatcher. Since these methods are `model` features, they can be
gated behind a `model` feature cfg.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
When heartbeating, first ensure that the previous heartbeat was
acknowledged. If it wasn't, shutdown the sender and receiver so that
an auto-reconnect can take place.
When receiving a Heartbeat Acknowledgement, set the
`last_heartbeat_acknowledged` to `true` to prevent the auto-reconnect
process.
|
| |
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Values are now wrapped within an Arc<Mutex>, so the example needs to
obtain a lock and unwrap it.
|
| |
|
|
|
| |
In addition to the amount of time sleeping, include the route being
ratelimited.
|
| | |
|
| |
|
| |
Allow `push` and `push_safe` to use a flexible syntax for formatting.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
Add new methods to MessageBuilder to push content similar to the other
methods, except with the addition of appending a newline afterwards.
This should help prettify some MessageBuilder usage.
|
| |
|
|
|
| |
The docs were on the impl, when instead they should be on the struct
itself.
|
| | |
|
| |
|
|
| |
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.
|