aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix no-feature testsZeyla Hellyer2017-06-242-1/+14
|
* Make Message::nonce a serde_json::ValueZeyla Hellyer2017-06-233-81/+3
| | | | | | | | | | | | | | | | | | Nonces can actually be almost anything - including booleans - so just use a Value to represent it since very few users will need it. This fixes errors like: ``` WARN:serenity::internal::ws_impl: (╯°□°)╯︵ ┻━┻ Error decoding: {"t":"MESSAGE_CREATE","s":12187872,"op":0,"d":{"type":0,"tts":false,"timestamp":"2017-06-01T01:00:00.000000+00:00","pinned":false,"nonce":"","mentions":[{"username":"redacted","id":"redacted","discriminator":"redacted","avatar":"redacted"}],"mention_roles":[],"mention_everyone":false,"id":"redacted","embeds":[],"edited_timestamp":null,"content":"redacted","channel_id":"redacted","author":{"username":"redacted","id":"redacted","discriminator":"redacted","bot":true,"avatar":"redacted"},"attachments":[]}} ERROR:serenity::client: Shard handler received err: Json(ErrorImpl { code: Message("Unknown i64 value: "), line: 0, column: 0 }) ``` and: ``` WARN:serenity::internal::ws_impl: (╯°□°)╯︵ ┻━┻ Error decoding: {"t":"MESSAGE_CREATE","s":1001192,"op":0,"d":{"type":0,"tts":false,"timestamp":"2017-06-01T01:01:01.000000+00:00","pinned":false,"nonce":true,"mentions":[],"mention_roles":[],"mention_everyone":false,"id":"redacted","embeds":[],"edited_timestamp":null,"content":"bork","channel_id":"redacted","author":{"username":"redacted","id":"redacted","discriminator":"redacted","bot":true,"avatar":"redacted"},"attachments":[]}} ERROR:serenity::client: Shard handler received err: Json(ErrorImpl { code: Message("invalid type: boolean `true`, expected identifier"), line: 0, column: 0 }) ```
* Update max embed lengthZeyla Hellyer2017-06-221-1/+1
| | | | Embeds can now have a combined textual length of 6000, up from 4000.
* Attempt to reconnect if heartbeating failsZeyla Hellyer2017-06-212-7/+7
|
* Reconnect on failed heartbeatsZeyla Hellyer2017-06-212-7/+15
|
* Update dependenciesZeyla Hellyer2017-06-215-40/+40
|
* Extract Discord close codes to constantsZeyla Hellyer2017-06-212-13/+60
|
* Add 'wait' parameter to http::execute_webhookZeyla Hellyer2017-06-203-15/+31
| | | | | | The 'wait' parameter allows you to specify waiting for the Message to be sent prior to receiving a response, which will have Discord include the JSON representation of the Message in the body.
* Fix broken docs links on Permissions structZeyla Hellyer2017-06-171-5/+5
|
* Deprecate a couple Channel methodsZeyla Hellyer2017-06-171-0/+2
| | | | | | | Deprecate `Channel::delete_messages` and `Channel::delete_permission`. These methods aren't available on all of the variants' types, so they shouldn't be on the Channel either.
* Rework shard logic and shard handlingZeyla Hellyer2017-06-165-547/+447
|
* Fix broken link from ModelErrorZeyla Hellyer2017-06-141-0/+1
|
* Re-export all errors from the preludeZeyla Hellyer2017-06-141-0/+8
|
* Call send_files from http::send_fileZeyla Hellyer2017-06-141-35/+7
| | | | | | | | | | | | | | | | | | | When made, the `http::send_files` code was duplicated from `http::send_file`. Instead call `http::send_files`, which provides a fix for when an, e.g. 4xx status code, is received, and the library would continue to deserialize the response as usual. This fixes errors like: ``` Err(Json(ErrorImpl { code: Message("missing field `id`"), line: 1, column: 54 })) ``` Instead returning: ``` Err(Http(InvalidRequest(PayloadTooLarge))) ```
* Reset shard handling on reconnectsZeyla Hellyer2017-06-141-0/+6
| | | | | | After the shard handler successfully reconnects a shard, reset the `last_ack_time` and `last_heartbeat_sent` to avoid going into an endless reconnection loop.
* Make EmbedFooter icon URLs optionalZeyla Hellyer2017-06-141-2/+2
|
* Fix no-framework compilationZeyla Hellyer2017-06-142-1/+3
|
* Split up long documentation lineZeyla Hellyer2017-06-141-1/+2
|
* Add `Member::permissions`alex2017-06-142-0/+33
|
* Switch from #[doc(hidden)] to pub(crate)alex2017-06-1415-122/+65
| | | | | | Switch from using `#[doc(hidden)]` to hide some internal functions to `pub(crate)`. The library now requires rustc 1.18.
* Use HTTPS Connector with remaining HTTP functionsMaiddog2017-06-141-9/+20
|
* Make framework dynamic_prefix accept an &MessageZeyla Hellyer2017-06-133-15/+14
|
* Remove Context::{channel_id, queue}Zeyla Hellyer2017-06-134-89/+61
| | | | | | | | | The `channel_id` field on Context is no longer required internally, and is no longer of use to userland as event handlers are given the channel ID in some way where possible. `queue` is a remnant from when the Context was the primary way to interact with the REST API.
* Fix CurrentUser::invite_urlKen Swenson2017-06-131-14/+61
| | | Use the client ID instead of the user ID.
* Make Member::guild_id non-optionalZeyla Hellyer2017-06-133-64/+24
| | | | All codepaths result in Some value, so it doesn't need to be optional.
* Only set shard timeout after a READY is receivedZeyla Hellyer2017-06-131-5/+9
|
* Deserialize embed footersZeyla Hellyer2017-06-101-0/+2
|
* Fix negative nonces failing to deserializeZeyla Hellyer2017-06-103-3/+83
| | | | | | | | | | 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.
* Fix voice compilationZeyla Hellyer2017-06-105-67/+102
|
* Use an https connector in http::send_filesZeyla Hellyer2017-06-091-1/+5
|
* Fix shard doctestsZeyla Hellyer2017-06-071-7/+7
|
* Upgrade rust-websocket, rust-openssl, and hyperZeyla Hellyer2017-06-0711-259/+302
| | | | | | | | | | | | | | | | 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.
* Ws read/write timeout after 90sZeyla Hellyer2017-06-061-1/+25
| | | | | | | | | | 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.
* Make client starts return an errorZeyla Hellyer2017-06-062-2/+39
| | | | | | 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.
* Make client join shards and returnZeyla Hellyer2017-06-061-4/+8
| | | | | | | | | | 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.)
* Separate websocket client initializationZeyla Hellyer2017-06-061-12/+10
| | | | | The logic for this was duplicated, and can be easily separated into its own function.
* Deprecate Client::login, add Client::newZeyla Hellyer2017-06-0617-87/+102
|
* Add User::direct_message exampleZeyla Hellyer2017-06-061-4/+26
|
* Clippy lintsZeyla Hellyer2017-06-064-22/+26
|
* Make User::direct_message/dm accept a builderZeyla Hellyer2017-06-061-13/+10
| | | | | | Instead of accepting a `&str`, make `User::direct_message` and `User::dm` accept a `CreateMessage` builder for consistency with related functions.
* Use chrono for struct timestamp fieldsZeyla Hellyer2017-06-0619-70/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add CurrentUser::face(), User::face()Zeyla Hellyer2017-06-041-0/+24
| | | | | These functions return the user's avatar URL, or their default avatar URL as a fallback.
* Alphabetize CurrentUser/User methodsZeyla Hellyer2017-06-041-35/+35
|
* Fix links to ChannelId::send_filesZeyla Hellyer2017-06-044-8/+8
| | | | | | Helper methods such as `GuildChannel::send_files` linked to the documentation for `ChannelId::send_file`, when they should be linking to `ChannelId::send_files`.
* Make http::send_files accept a slice of bytesZeyla Hellyer2017-06-041-4/+13
| | | | | | 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].
* Make http::AttachmentType only use borrowed valuesZeyla Hellyer2017-06-046-25/+27
| | | | | 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.
* Remove a FQN usage in User::refreshZeyla Hellyer2017-06-041-1/+1
| | | | | Instead of fully qualifying the namespace when using `std::mem::replace`, use just `mem::replace`.
* Move user avatar method logic outZeyla Hellyer2017-06-041-26/+34
| | | | | | 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 CurrentUser::default_avatar_urlZeyla Hellyer2017-06-041-0/+7
| | | | | Add `default_avatar_url` to `CurrentUser` to match `User`'s avatar functions.
* Add Message::channel()Zeyla Hellyer2017-06-041-0/+43
| | | | | The method can be used as a shortcut for retrieving a message's channel from the cache.