aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve performance of builders even furtheracdenisSK2017-12-2724-65/+200
| | | | | | By negating hashing altogether. The increase is around 1000-ish nanoseconds saved.
* Fix Guild::member_named and add teststahahawa2017-12-241-8/+15
| | | | | | | Use rfind, in case there's more '#' in username than just the discriminator Split at pos+1 instead of pos and remove the trailing '#' in the split.0 (Name) Fix bug with parsing
* Add `iter_quoted`acdenisSK2017-12-241-10/+28
|
* Fix `multiple_quoted` (#241)Lakelezz2017-12-241-50/+50
|
* Update model to include new voice regions (#240)Ken Swenson2017-12-231-0/+8
|
* Better support for multiple delimiters on `Args` (#239)Lakelezz2017-12-223-160/+246
|
* Add `animated` to `Emoji` and `ReactionType`Zeyla Hellyer2017-12-203-2/+29
| | | | | | | | | | 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)
* Add variant adapters to Channel (#238)Timo2017-12-201-0/+133
|
* GatewayEvent: don't unwrap deserializationsZeyla Hellyer2017-12-191-1/+2
| | | | | This commit makes GatewayEvent no longer unwrap Dispatch deserializations, and instead Try? it away.
* Actually fix `Args`'s `parse` and add a few tests (#236)Lakelezz2017-12-181-8/+3
|
* Fix ifsacdenisSK2017-12-181-6/+6
|
* Fix multiple char delimitersacdenisSK2017-12-181-4/+9
|
* Add a special `len` to `Args`acdenisSK2017-12-182-6/+23
|
* Fix `Guild` deser without `system_channel_id`Zeyla Hellyer2017-12-171-4/+4
| | | | | | | Fix the deserialization of `model::guild::Guild` when `Guild::system_channel_id` is not present. Additionally, add a test case for this.
* Default serde on a couple Ready structfieldsZeyla Hellyer2017-12-171-6/+8
| | | | | | | 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 typo (#235)Lakelezz2017-12-171-1/+1
|
* Add missing trailing comma in matchZeyla Hellyer2017-12-171-1/+1
|
* Trim given token in Client::newZeyla Hellyer2017-12-171-0/+2
| | | | | Trims the token given as an argument in Client::new, which will strip away whitespace that might occur due to including the token from a file.
* Fix doc-tests and `single_zc`acdenisSK2017-12-174-26/+28
|
* Fix shards attempting to re-identify on their ownZeyla Hellyer2017-12-163-35/+51
| | | | | | | | | | Fix shards by taking away their responsibility to re-identify, instead shutting down shard runners and going through the shard queuer to restart a shard runner and its associated shard. This fixes the case where a running shard's session invalidates and re-IDENTIFYs within 5 seconds before queued shard starts, causing a cascading failure of sessions for new shards.
* Avoid an unwrap in args::parse_quotesZeyla Hellyer2017-12-161-1/+1
|
* Fix most clippy lints, take more refeerncesZeyla Hellyer2017-12-1616-108/+117
| | | | | Fix clippy lints and subsequently accept references for more function parameters.
* Fix voice feature compilationZeyla Hellyer2017-12-165-5/+6
|
* Attempt to restart failed shard bootsZeyla Hellyer2017-12-162-18/+48
| | | | | | | | | | | | When the ShardQueuer fails to restart a shard (such as due to a network error, an issue on Discord's side, Cloudflare, etc.), it will now push the ID onto a queue. Every 5 seconds messages will attempt to be read from the receiver, and if one is not read after the timeout, a queued shard start will occur (if one is queued). This should fix a number of reconnection issues.
* Break up the model moduleZeyla Hellyer2017-12-1661-411/+505
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}; ```
* Revamp the internals of `Args`acdenisSK2017-12-163-128/+156
| | | | 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 deserialization of `Guild::application_id`Zeyla Hellyer2017-12-152-2/+4
| | | | | | | Fix the deserialization of the `Guild::application_id` structfield. Additionally, create a new ID type for it. A test has been added for this.
* Change type of a couple Guild/PartialGuild fieldsZeyla Hellyer2017-12-153-20/+44
| | | | | | Changes the types of `Guild` and `PartialGuild`'s `default_message_notifications` and `mfa_level` structfields to be a bit more type-strong.
* Add missing fields to Guild modelZeyla Hellyer2017-12-151-0/+46
| | | | | | | | Adds the following missing fields to the Guild model: - `application_id` - `explicit_content_filter` - `system_channel_id`
* Make `Context::edit_profile` slightly efficientacdenisSK2017-12-141-3/+3
|
* Remove the `Box<Command>` implacdenisSK2017-12-111-22/+0
| | | | | This was included back then as an afterthought about this impl from a user perspective, not from the lib's. Plus it's unlikely we'll be using this in the near future.
* Use a macro to generate FromStr implsacdenisSK2017-12-101-177/+92
|
* Shutdown everything on ShardManager::shutdown_allZeyla Hellyer2017-12-095-1/+17
| | | | | | | | | | Calling `ShardManager::shutdown_all` will now send a message to the shard queuer and shard monitor to shutdown. This will now cause `Client::start_connection` to exit. Additionally, `Client::start_connection` and related functions that call this (e.g. `Client::start_autosharded`) now return `Ok(())` on clean exits.
* Merge branch 'branch-v0.4.5' into v0.5.0Zeyla Hellyer2017-12-092-33/+4
|\
| * Release v0.4.5v0.4.5Zeyla Hellyer2017-12-091-2/+1
| |
| * Remove EditRole::default implementationZeyla Hellyer2017-12-091-29/+1
| | | | | | | | | | Removes the custom implementation for `EditRole`, instead deriving Default.
| * Fix remaining deserializersZeyla Hellyer2017-12-091-2/+2
| | | | | | | | | | | | 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.
| * Fix snowflake deserializerZeyla Hellyer2017-12-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix snowflake deserializerZeyla Hellyer2017-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | Fall back to `str::parse` on `ChannelId` as wellacdenisSK2017-12-061-7/+56
| | | | | | | | Also give an actual error type for `Channel` too.
* | Make the comment for the `AsRef` impl more clearacdenisSK2017-12-061-1/+3
| |
* | Use `AsRef` instead of just `&MessageId`acdenisSK2017-12-061-1/+1
| |
* | Add the `VIEW_AUDIT_LOG` permission (#229)Lakelezz2017-12-041-0/+8
| |
* | Tune down repetition with a macroacdenisSK2017-11-301-56/+31
| |
* | Fix whitespacing and change `and` to `or`. (#228)Lakelezz2017-11-301-2/+2
| |
* | Make help-commands customisable (#227)Lakelezz2017-11-307-77/+468
| |
* | Use `ToString`'s blanket impl for `Display`sacdenisSK2017-11-273-5/+5
| |
* | Do a temporary fix for options for commands created in the `command!` macroacdenisSK2017-11-241-1/+24
| |
* | Convert from macro to ? (#226)Mei Boudreau2017-11-233-10/+2
| |
* | Add `before`/`after` middleware to `Command`acdenisSK2017-11-232-1/+36
| |